A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE Technical / Map Design »defining global variables

Author Topic: defining global variables (3 messages, Page 1 of 1)
Moderators: Dennis

Jobalisk
Joined: Feb 8, 2014

The haiku master。


Posted: Jun 24, 2016 04:36 PM    Msg. 1 of 3       
hey all!

so as part of a campaign I've been rehashing I need to check if a global variable has been set to three. now if that was just one script using the variable it would be fine, however I have a main script where the variable is defined and then three other scripts that add +1 to the variable at various times, the main script then waits until the variable is three before continuing. this is logical and should work, however sapian cannot compile the scripts as the three outside scripts do not recognise the global variable as a real variable.

here's how I've defined it:

(main script (endgame):



(global short all_marines 0)
(script startup endgame

outside script1/2/3:

(set (all_marines) (+ (all_marines) 1))

These scripts all do the same thing

back to the main script:

(sleep_until (= (all_marines) 3)

end

can anyone see whats wrong here?


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Jun 24, 2016 07:18 PM    Msg. 2 of 3       
Don't put parenthesis around the global variable name; it believes its something it can execute. (set all_marines (+ all_marines 1)) etc.

Also, since you say you've made them multiple scripts (I assume you means .hsc files), they compile in alphabetical order; if something that uses the global is compiled before the global is compiled, it will fail, since the global really doesn't exist yet. Its easiest using one HSC file.


Jobalisk
Joined: Feb 8, 2014

The haiku master。


Posted: Jun 24, 2016 08:43 PM    Msg. 3 of 3       
thanks

 

 
Previous Older Thread    Next newer Thread







Time: Tue December 10, 2019 11:51 AM 156 ms.
A Halo Maps Website