Home   Help Search Login Register  

Author Topic: What can you do whit a call command?  (Read 419 times)

0 Members and 1 Guest are viewing this topic.

GeneralCoder

  • Guest
What can you do whit a call command?
« on: 30 Aug 2003, 16:40:01 »
Hi! so far I've seen call used whit function call's and to get unit like this:
_man = call format["%1",_name]
I know what this does but don't fully understand the logic behind this.

So more infromation about that call please!?   ::)

Unnamed

  • Guest
Re:What can you do whit a call command?
« Reply #1 on: 30 Aug 2003, 21:55:31 »
I use the call command alot to make my scripts easier to follow, when my if statements are getting to big:

Code: [Select]
;Initialise local functions
_FO_REGISTER_INITIALISED={(Format["%1",FO_RegisterArray]=="scalar bool array string 0xfcffffef")}
_FO_INITIALISED={(Format["%1",FO_Initialised_Library]=="scalar bool array string 0xfcffffef")}

;Check for existing variables
If !((Call _FO_REGISTER_INITIALISED) and (Call _FO_INITIALISED)) Then {goto "RegisterObserver"}
If !((Call _FO_REGISTER_INITIALISED) or (Call _FO_INITIALISED)) then {goto "InitilaisationError"}


Or to save typing the same bit of code over and over again:

Code: [Select]

_INCREMENT_DIR = {_Dir=_Dir+90; if (_Dir>360) then {_Dir=_Dir-360}; [(_XPos+(_ObjDistance * Cos(_Dir))),(_YPos+(_ObjDistance * Sin(_Dir))),0]};
_CALCH = {_sensor setpos (Call _INCREMENT_DIR) ; getpos _sensor};

_Positions set [0,Call _CALCH];
_Positions set [1,Call _CALCH];
_Positions set [2,Call _CALCH];
_Positions set [3,Call _CALCH];


But you can use it to create code and variables at runtime aswell.

But effectivly all the call command does is execute a string of commands, but you can build the string to execute, using whatever you want, when you want.

Check out the Chain Of Command site, I think the CoC guys do some advance stuff with the call command.

GeneralCoder

  • Guest
Re:What can you do whit a call command?
« Reply #2 on: 31 Aug 2003, 12:21:01 »
I see now, thanks!