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 »this is not a valid global variable error

Author Topic: this is not a valid global variable error (4 messages, Page 1 of 1)
Moderators: Dennis

casual mods
Joined: May 2, 2013

I be chillin


Posted: Oct 7, 2013 09:29 PM    Msg. 1 of 4       
alright so i made this script and it works,
i have (global long points 0) in a separate script file called globals.hsc

(script continuous place_gmpp
(sleep_until (= 0 (ai_living_count gmpp)))
(set points (+ 5 points))
(ai_place gmpp)
(ai_magically_see_players gmpp)
)

i copied the script for another encounter as place_gmpp2
and it works alongside place_gmpp.

(script continuous place_gmpp2
(sleep_until (= 0 (ai_living_count gmpp2)))
(set points (+ 5 points))
(ai_place gmpp2)
(ai_magically_see_players gmpp2)
)

when i try to use the encounter empr (elite minor plasma rifle)
it tells me:
error line 3 this is not a valid global variable points (+ 5 points))
error line 1 the left parenthesis is unmatched (script continuous place_empr

(script continuous place_empr
(sleep_until (= 0 (ai_living_count empr)))
(set points (+ 5 points))
(ai_place empr)
(ai_magically_see_players empr)
)

i havent changed anything other than encounter referenced and it works above whats wrong?


Hobbet360
Joined: Jan 10, 2012

ProTools > ToolPro


Posted: Oct 8, 2013 01:54 AM    Msg. 2 of 4       
Quote: --- Original message by: casual mods
alright so i made this script and it works,
i have (global long points 0) in a separate script file called globals.hsc

(script continuous place_gmpp
(sleep_until (= 0 (ai_living_count gmpp)))
(set points (+ 5 points))
(ai_place gmpp)
(ai_magically_see_players gmpp)
)

i copied the script for another encounter as place_gmpp2
and it works alongside place_gmpp.

(script continuous place_gmpp2
(sleep_until (= 0 (ai_living_count gmpp2)))
(set points (+ 5 points))
(ai_place gmpp2)
(ai_magically_see_players gmpp2)
)

when i try to use the encounter empr (elite minor plasma rifle)
it tells me:
error line 3 this is not a valid global variable points (+ 5 points))
error line 1 the left parenthesis is unmatched (script continuous place_empr

(script continuous place_empr
(sleep_until (= 0 (ai_living_count empr)))
(set points (+ 5 points))
(ai_place empr)
(ai_magically_see_players empr)
)

i havent changed anything other than encounter referenced and it works above whats wrong?


Can't reference across script files... you only can reference relative to the script.

and you can only reference to something above (or to the left of) the script referencing.

eg.


(global long "its_over" 9000)

(script startup whatever
(set "its_over" (+ 5 its_over));"This WILL work as the global script is up there ^^^"
(wake "lickme");"This won't work because the dormant script is below this."
)

(script dormant lickme
(begin
(print "I am to low to be referenced to, I need to get high!")
)
)

Edited by hobbet360 on Oct 8, 2013 at 02:01 AM


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Oct 8, 2013 01:09 PM    Msg. 3 of 4       
Quote: --- Original message by: hobbet360
Can't reference across script files... you only can reference relative to the script.

You can reference things across scripts, it still is required to of been compiled before it is referenced however. When it compiles HSC files, it does it alphabetically, so, if he compiled a script like a50.hsc and globals.hsc, it would load a50.hsc into the scripts first, hence not knowing about the contents of globals.hsc existing. Now, if he compiled aaaaaa.hsc and zzzzzzzzz.hsc, zzzzzz.hsc could reference anything inside aaaaaaa.hsc since it would of compiled first.


Anyways, your problem is the global your looking for not being compiled before you try to use it.


casual mods
Joined: May 2, 2013

I be chillin


Posted: Oct 8, 2013 08:23 PM    Msg. 4 of 4       
thanks for the help, i understand how its load order works now and got the scritps running.

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 7:11 AM 140 ms.
A Halo Maps Website