Need Help with Scripting Help!!!

Non-platform specific questions.

Need Help with Scripting Help!!!

Postby Turon » Mon Aug 30, 2010 6:34 am

Um, scripting is hard especially the user variables. Can someone brief it out?! :P :(
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Need Help with Scripting Help!!!

Postby lcl » Mon Aug 30, 2010 12:33 pm

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
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Need Help with Scripting Help!!!

Postby Turon » Tue Aug 31, 2010 3:59 pm

I mean could you give a basic introduction for scripting and a lot of information about scripting I need to know more! :P
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Need Help with Scripting Help!!!

Postby Game A Gogo » Tue Aug 31, 2010 6:19 pm

Open Game Editor, Click Help, Click Documentation
this should help
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest