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 »If statement problems

Author Topic: If statement problems (4 messages, Page 1 of 1)
Moderators: Dennis

Me2
Joined: Mar 28, 2009


Posted: Jan 25, 2011 06:41 AM    Msg. 1 of 4       
I am currently having problems with trying to use if statements in scripts, here is my code
(if (= points 5))
(show_hud_help_text true)
(hud_set_help_text s1)
(sleep 90)
(show_hud_help_text false)

The code produces this error
01.25.11 22:30:11  [zombies line 7] i expected (if   []).: (if (= points 5))

01.25.11 22:30:11 recompiling scripts after scenarios were merged.
01.25.11 22:30:11 [zombies line 2] this left parenthesis is unmatched.: (script continuous zombified

Can someone please tell me what I am doing wrong?


Muscl3r
Joined: May 22, 2010

dont pray 4 easy lives...pray to be STRONGER MEN


Posted: Jan 25, 2011 07:53 AM    Msg. 2 of 4       
My guess is that it needs to be this:

(if (= points 5) true)

Try that


Me2
Joined: Mar 28, 2009


Posted: Jan 25, 2011 08:39 AM    Msg. 3 of 4       
Unfortunately that did not work
01.26.11 00:35:30  [zombies line 7] the value of this expression (in a  slot) can never be used.: true)

01.26.11 00:35:30 recompiling scripts after scenarios were merged.
01.26.11 00:35:30 [zombies line 2] this left parenthesis is unmatched.: (script continuous zombified


Noobyourmom
Joined: Mar 23, 2010


Posted: Jan 25, 2011 12:32 PM    Msg. 4 of 4       
Halo script isn't like normal coding. Since there's no END IF, the thing you want to happen is part of the if statement. So it should be (if (= points 5)(show_hud_help_text true)). And you would need an if statement for every action you want to happen. However, an if statement is evaluated immediately, and then passed over for the rest of the script. So with this script, at the startup it would check the if statements, see that they're false, and complete the script forever. I believe you probably want to use the command sleep_until. ie:

(sleep_until (= points 5) 15) ; 15 is the number for how often it checks if the condition is true
(show_hud_help_text true)
(hud_set_help_text s1)
(sleep 90)
(show_hud_help_text false)

Is that clear enough?

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 8:45 AM 141 ms.
A Halo Maps Website