# (sharp) symbol

Started by , Sat 03/11/2007 19:20:00

Previous topic - Next topic

bicilotti

What does exactly the sharp symbol ( # ) mean/do in the global script? I've searched the manual, but I didn't found anything.

Khris

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.

bicilotti

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
Code: ags
 #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.

Khris

#3
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.

SMF spam blocked by CleanTalk