Paying bits for a script teacher
#4
Might as well put it up here, so that other people can get some use out of it.

First thing you need to know is how Buildism stores data in games. The root object, in which everything in the game is stored, is called simply "game". Everything you can create or edit is somewhere inside of game. However, game alone is not much help to us. So let's go a step further.

All physical parts in games belong in the World. (There can be multiple worlds but that's advanced stuff.) So all your boxes, circles, characters, and ladders belong in game.World. Your character, when you enter a game, can be found at game.World.Username.

Let's say you want to change your health to 0, for example if you've gotten stuck somewhere. We'd want to change the Health variable of your character. This is called in mostly the same way: game.World.Username.Health. To change it, you would type this code:

[lua]
game.World.Username.Health = 0
[/lua]

and viola, your character is dead.

There is another way to access objects: the getChild method. This is for when the name of the object has a space or other odd character like @ or #, or you can't be sure the object actually exists or not. The way you do this is you write the path to the "parent" object normally, then add :getChild("objectname") to the end.

[lua]
game.World:getChild("Username").Health = 0
[/lua]

You can do this for nearly any object and property you can find in the Advanced Tools browser in the editor (and some ones you can't), except for some important things like player and service names, and class types. Generally, if you can change it with Advanced Tools, you can change it with a script.


I'll post some more stuff later.
Reply


Messages In This Thread
Paying bits for a script teacher - by Invader - 09-04-2012, 02:15 AM

Forum Jump:


Users browsing this thread: 9 Guest(s)