Using Global Code

Game Editor comments and discussion.

Using Global Code

Postby irblinx » Thu Sep 07, 2006 7:21 pm

I'm probably missing something obvious but how do I call global code from within an actors script?

I assumed that global code worked like C functions and that I should be able to call it using something like:

solutionCheck();

Am I on the right track but missing something or do I have to create a new function in the global code and call that?
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby makslane » Thu Sep 07, 2006 8:25 pm

Use the global code editor to define the function:

Code: Select all
void solutionCheck()
{
  //Your code
}


And call the function from any Script Editor action:

Code: Select all
solutionCheck();
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby irblinx » Thu Sep 07, 2006 10:09 pm

Ok, just out of interest then, what are the names of the global code functions used for? Why don't we just have one global code area?
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby makslane » Fri Sep 08, 2006 4:24 am

Just for a better organization of the code, but you can use a single global code, if you want.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby irblinx » Fri Sep 08, 2006 8:14 am

Cheers Mak, confusion over, I just use normal C functions and can call them from the Actors script, sweet :)
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron