|
| 07 Jul 2011 05:18 PM |
I don't really know what scripting is, I just play games and do my work and deal with groups, but never made a script, what does it do? How do you make one? I think scripting [Script] would help me make my places better! Please reply :D |
|
|
| Report Abuse |
|
|
myrco919
|
  |
| Joined: 12 Jun 2009 |
| Total Posts: 13241 |
|
| |
|
ns001111
|
  |
| Joined: 15 Jan 2011 |
| Total Posts: 2849 |
|
|
| 07 Jul 2011 05:20 PM |
| Scripting is Basically Another Language that Computers use. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 05:21 PM |
o.o You are a rare one. I applaud to your wanting to learn.
Scripting is the act of creating scripts to make your game interactive. There would be no guns if there was no scripting. There would be no tycoons if there was no scripting. There wouldn't even be any *useful* GUIs if there was no scripting.
There are many good tutorials for beginners, but you must first figure out how the game is set up before you can start scripting.
I've been told that DingDong727 has some good tutorials.
I may be able to get some links if you need help finding tutorials. |
|
|
| Report Abuse |
|
|
myrco919
|
  |
| Joined: 12 Jun 2009 |
| Total Posts: 13241 |
|
| |
|
myrco919
|
  |
| Joined: 12 Jun 2009 |
| Total Posts: 13241 |
|
| |
|
|
| 07 Jul 2011 05:23 PM |
| I meant 272... Where did 727 come from...? -.- |
|
|
| Report Abuse |
|
|
myrco919
|
  |
| Joined: 12 Jun 2009 |
| Total Posts: 13241 |
|
| |
|
|
| 07 Jul 2011 05:41 PM |
ARGH!
I can't find the link to a post I made a few days ago! :( |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 06:04 PM |
BAM FOUND IT!
First you need to know how the game is set up. You can think of it as a tree. 'game' is the stump, and branches off into other objects (these objects are special and are called Services). Workspace, Lighting, Players are all examples of these services.
These services may be branches themselves, but they are also extended further into more branches. Here's a simple diagram:
game / | \ / | \ / | \ / | \ Workspace Lighting Players / \ \ Base Camera PlayerName
Different properties and methods exist in these objects. We will be using the findFirstChild method. This method is found in ALL in-game objects, and is one of the most widely used methods in RBX.Lua.
To travel through the "tree," we do something called indexing. To index, you simple add a period to the end of the name of the object. You index an object when you add the period and supply the name of another object right after.* Let's index Lighting:
game.Lighting
The object you index is called the child. In this case, Lighting is the child. The object you're indexing INTO is called the parent. In this case, game is the parent.
Here we go.
game.Players.PlayerName.Character.Humanoid.MaxHealth = math.huge game.Players.PlayerName.Character.Humanoid.Health = math.huge
This script CAN error if one or more children are missing. This is when you'd want to use the findFirstChild method to prevent errors. You also want to utilize variables.
local player = game.Players:findFirstChild("PlayerName") if player ~= nil then local humanoid = player.Character:findFirstChild("Humanoid") if humanoid ~= nil then humanoid.MaxHealth = math.huge humanoid.Health = math.huge end end
There's a new word. nil. In Lua, nil is a reference to nothing. nil does not exist. It's somewhat of a hard concept to explain.
The if-then statement tests if a condition is true. When you assigned the 'player' variable, you used the findFirstChild method. The findFirstChild method returns the object you're looking for if it is found. If the object is not found, it returns nil. You then use the if-then statement to check to see that player is NOT nil. Here's the list of operators:
== - is equal to ~= - is not equal to < - is less than > - is greater than <= - is less than or equal to >= - is greater than or equal to
Notice you use double equal signs (==). The double equal sings are used to compare two snips of data. The single equal sign (=) is used to ASSIGN things. Please remember this.
*There are other ways to index, but it isn't necessary to know as a beginner scripter. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 06:10 PM |
My apologies, I messed that post up big time...
First you need to know how the game is set up. You can think of it as a tree. 'game' is the stump, and branches off into other objects (these objects are special and are called Services). Workspace, Lighting, Players are all examples of these services.
These services may be branches themselves, but they are also extended further into more branches. Here's a simple diagram:
game / | \ / | \ / | \ / | \ Workspace Lighting Players / \ \ Base Camera PlayerName
Different properties and methods exist in these objects. We will be using the findFirstChild method. This method is found in ALL in-game objects, and is one of the most widely used methods in RBX.Lua.
To travel through the "tree," we do something called indexing. To index, you simple add a period to the end of the name of the object. You index an object when you add the period and supply the name of another object right after.* Let's index Lighting:
game.Lighting
The object you index is called the child. In this case, Lighting is the child. The object you're indexing INTO is called the parent. In this case, game is the parent.
Here we go.
game.Players.PlayerName.Character.Humanoid.MaxHealth = math.huge game.Players.PlayerName.Character.Humanoid.Health = math.huge
This script CAN error if one or more children are missing. This is when you'd want to use the findFirstChild method to prevent errors. You also want to utilize variables.
local player = game.Players:findFirstChild("PlayerName") if player ~= nil then local humanoid = player.Character:findFirstChild("Humanoid") if humanoid ~= nil then humanoid.MaxHealth = math.huge humanoid.Health = math.huge end end
There's a new word. nil. In Lua, nil is a reference to nothing. nil does not exist. It's somewhat of a hard concept to explain.
The if-then statement tests if a condition is true. When you assigned the 'player' variable, you used the findFirstChild method. The findFirstChild method returns the object you're looking for if it is found. If the object is not found, it returns nil. You then use the if-then statement to check to see that player is NOT nil. Here's the list of operators:
== - is equal to ~= - is not equal to < - is less than > - is greater than <= - is less than or equal to >= - is greater than or equal to
Notice you use double equal signs (==). The double equal sings are used to compare two snips of data. The single equal sign (=) is used to ASSIGN things. Please remember this.
*There are other ways to index, but it isn't necessary to know as a beginner scripter. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 06:14 PM |
| lol last year I started learning to script because I was curious on how epic games were made and how I could make epic games! then after a year of scripting I made an epic place! :D my lighting place! |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 06:15 PM |
@bluey
When I was going through my threads, I noticed you had asked about metatables. Do you still need help with them (after 2 years :D)? |
|
|
| Report Abuse |
|
|
|
| 09 Jul 2011 10:38 AM |
| @Agent thanks for the help :D [?] ok... |
|
|
| Report Abuse |
|
|