Author Topic: Global Varibles  (Read 887 times)

0 Members and 1 Guest are viewing this topic.

Offline Ahmed Muhammad

  • Major(1)
  • Posts: 6
Global Varibles
« on: June 15, 2007, 11:57:53 pm »
Hey just wondering if u can assign a global varible which you can then call from any procedure/function.

for eg.

OnJoinGame
If name = jack thompson then
dickhead := 1
end;

OnPlayerSpeak
if dickhead := 1 then
Command('/KILL ' + inttostr(Dickhead));
end;

not proper scripting but just to give you an idea of what i want to be able to do. I was thinking I could do it by writing and reading from files but thats seems like unnessasery effort if it's possible to just define a global varible.

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Global Varibles
« Reply #1 on: June 16, 2007, 12:01:35 am »
Yep, put them up the top under const.

var
  fuckhead: byte;

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Global Varibles
« Reply #2 on: June 17, 2007, 11:06:53 pm »
are those accessible in functions in a separate include file?
Can't think of anything original to put here...

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: Global Varibles
« Reply #3 on: June 17, 2007, 11:20:08 pm »
are those accessible in functions in a separate include file?
No

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Global Varibles
« Reply #4 on: June 17, 2007, 11:54:20 pm »
are those accessible in functions in a separate include file?
Yes

But you have to be carefull with the order in which you include the files.
If you want global vars accesible in all files you should decalre them in another file and include that file before any other.
« Last Edit: June 17, 2007, 11:59:12 pm by PerroAZUL »
urraka