Page 1 of 1

Need Help with Scripting Help!!!

PostPosted: Mon Aug 30, 2010 6:34 am
by Turon
Um, scripting is hard especially the user variables. Can someone brief it out?! :P :(

Re: Need Help with Scripting Help!!!

PostPosted: Mon Aug 30, 2010 12:33 pm
by lcl
User vars are totally easy to learn and to use. :D

So, if you want to create variable, go to script editor and press "Variables" then press add.
First, give it a name. (It's always good to use short variable names like: jump, dir, ...)

Then, you can choose is it global or actor variable. If you make it global, you can use it like to hold some global things, like score. If you make it actor variable, it becomes same kind of variable as x and y coordinates; every actor will have it's own value for it.

Next thing you choose is integer, real or string. Integer can hold number like: 1, real can hold number with decimals, like: 1.43, and string is for characters, and strings of them.

You can choose is it array or no, and the array size. If you choose to make it array, then you have to give it some size. One array can hold many things like positions. You can use it like this:
Code: Select all
pos[0] = view.x;
pos[1] = view.y;
pos[2] = Player.x;
pos[3] = Player.y;

This is just simple example of how you can use arrays. It's easier to create array called pos and give it size of 4, and then use it like what the code was, than create single vars for all of those, like viewX, viewY, etc.

And save group is for making variables able to save. For positions, you can create own save group called positions and other groups for other things.

For saving and loading variables, you can use saveVars and loadVars.
They work like this:

Saving:
Code: Select all
saveVars("file name here with ending, like .dat", "save group name here");

Loading:
Code: Select all
loadVars("file name here with ending, like .dat", "save group name here");

You can find saveVars and loadVars also from script editor by clicking variables / functions and then searching them from there. Then it opens a new window where you can choose file and save group.

I think these were the most important things about variables. :D
If you still need help with them, ask. :D

Re: Need Help with Scripting Help!!!

PostPosted: Tue Aug 31, 2010 3:59 pm
by Turon
I mean could you give a basic introduction for scripting and a lot of information about scripting I need to know more! :P

Re: Need Help with Scripting Help!!!

PostPosted: Tue Aug 31, 2010 6:19 pm
by Game A Gogo
Open Game Editor, Click Help, Click Documentation
this should help