Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 03/11/2007 19:20:00

Title: # (sharp) symbol
Post by: on Sat 03/11/2007 19:20:00
What does exactly the sharp symbol ( # ) mean/do in the global script? I've searched the manual, but I didn't found anything.
Title: Re: # (sharp) symbol
Post by: Khris on Sat 03/11/2007 19:52:48
Special compiler commands use this. Say you put
#define VAR 10
at the start of a script. At compile-time, every occurance of VAR is replaced by a 10.

It's even possible to do
#define AI player.ActiveInventory
or
#define IFMAX if(player==cMax)
Then you could do this:
IFMAX AI=iBall;

Other commands are #IFDEF and #IFNDEF.

Opposed to the usual script commands, those compiler commands are used to alter the actual source code directly before it is compiled.
Title: Re: # (sharp) symbol
Post by: on Sat 03/11/2007 20:04:37
Quote from: KhrisMUC on Sat 03/11/2007 19:52:48
Special compiler commands use this. Say you put
#define VAR 10
at the start of a script. At compile-time, every occurance of VAR is replaced by a 10.

It's even possible to do
#define AI player.ActiveInventory
or
#define IFMAX if(player==cMax)
Then you could do this:
IFMAX AI=iBall;

Other commands are #IFDEF and #IFNDEF.

Opposed to the usual script commands, those compiler commands are used to alter the actual source code directly before it is compiled.

Got it! But what about the #sectionstart on_mouse_click or similar we find even in the basic globalscript? May I just ignore them in future developements (e.g.of the GUI) or are they important?

I've tried to cut some of them and leave only the lines between and everything seems alright.
Title: Re: # (sharp) symbol
Post by: Khris on Sat 03/11/2007 22:58:58
They are used by AGS to find its functions. Leave them be or it gets screwed up.
It's not necessary to add them to your own functions.