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 »Making an (if command only run the commands under it once?

Author Topic: Making an (if command only run the commands under it once? (10 messages, Page 1 of 1)
Moderators: Dennis

MoooseGuy
Joined: Aug 10, 2008

I Approve This Message.


Posted: Oct 25, 2010 06:42 AM    Msg. 1 of 10       
OK, so I have a question about (if commands. I have a continuous script set up for lives, where I would like to make it so that if lives = x, a cinematic title will display, but only once.

At the moment I am using something like this:

(if (= lives 9)
(begin (cinematic_set_title lives9)))
....etc.

This makes my title display over and over again, but when I do this:

(if (= lives 9)
(begin (cinematic_set_title lives9) (sleep 999)))
...etc.

,or any other sleep command, it just makes the title never display. What am I doing wrong?

Thanks,
MoooseGuy


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Oct 25, 2010 06:31 PM    Msg. 2 of 10       
It's chronological, isn't it? You could do one giant startup script using sleep_until, and create a chain of those, or if you're using the script you have now, just set each cinematic title to stay up for 0.5 seconds. That way, you don't need to change your script and waste any brain cells.


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Oct 25, 2010 11:18 PM    Msg. 3 of 10       
Not efficiency wise :3

Yours would run in O(n^2), because of the nested if conditions. You'd be checking for whether cinematic equaled to zero for every check for lives. Since this script checks for = lives 9, it would be a fair assumption (and a correct assumption) that he would check for lives = 1 - 10. It'd be a simpler task to factor out the cinematic check condition.

Of course, another issue is that I'm assuming that he wants the Lives indicator to display forever, so using any method short of continuous display, essentially my method, would result in a cinematic title that would disappear after some time. It's impossible to set up the cinematic title to display forever in the scenario tag itself; thus, it must be accomplished through scripts.

Easy and quick solution: Just go to the scenario, find every cinematic title, and set the up time to 0.25 seconds.


Maniac1000
-Helpful Poster-
Joined: Feb 24, 2007


Posted: Oct 25, 2010 11:21 PM    Msg. 4 of 10       
Quote: --- Original message by: ASP_GRUNTS
Roger Murdock: Flight 2-0-9'er, you are cleared for take-off.
Captain Oveur: Roger!
Roger Murdock: Huh?
Tower voice: L.A. departure frequency, 123 point 9'er.
Captain Oveur: Roger!
Roger Murdock: Huh?
Victor Basta: Request vector, over.
Captain Oveur: What?
Tower voice: Flight 2-0-9'er cleared for vector 324.
Roger Murdock: We have clearance, Clarence.
Captain Oveur: Roger, Roger. What's our vector, Victor?
Tower voice: Tower's radio clearance, over!
Captain Oveur: That's Clarence Oveur. Over.
Tower voice: Over.
Captain Oveur: Roger.
Roger Murdock: Huh?
Tower voice: Roger, over!
Roger Murdock: What?
Captain Oveur: Huh?
Victor Basta: Who?

My way's cooler than all of yours.


Thats a terrible script, its like something from a 1980's movie.

also: The white zone is for immediate loading and unloading of passengers only. There is no stopping in the red zone.

Edited by Maniac1000 on Oct 25, 2010 at 11:23 PM


MoooseGuy
Joined: Aug 10, 2008

I Approve This Message.


Posted: Oct 26, 2010 03:13 AM    Msg. 5 of 10       
Quote: --- Original message by: Gamma927
Not efficiency wise :3

Yours would run in O(n^2), because of the nested if conditions. You'd be checking for whether cinematic equaled to zero for every check for lives. Since this script checks for = lives 9, it would be a fair assumption (and a correct assumption) that he would check for lives = 1 - 10. It'd be a simpler task to factor out the cinematic check condition.

Of course, another issue is that I'm assuming that he wants the Lives indicator to display forever, so using any method short of continuous display, essentially my method, would result in a cinematic title that would disappear after some time. It's impossible to set up the cinematic title to display forever in the scenario tag itself; thus, it must be accomplished through scripts.

Easy and quick solution: Just go to the scenario, find every cinematic title, and set the up time to 0.25 seconds.

Well, the idea was to make the script work in any direction, thus allowing the ability to add lives as well as subtract them, without impacting the functionality of the cinematic title display scripts. Also, I want to make it so that the cinematic title only displays once, not forever (I already have the titles set up to display for 4 seconds in the scenario). So that's the problem: To make a non-chronolgical script that displays a corresponding cinematic title only once based on the value of the lives global (which is a short).
Edited by MoooseGuy on Oct 26, 2010 at 03:21 AM


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Oct 26, 2010 04:46 PM    Msg. 6 of 10       
The script I gave to you will work for adding and subtracting; essentially, in any direction. The only issue here, is that it assumes you're using it forever. Fortunately, it's an easy tweak. For each one of these:

(if
(= lives 11)
(cinematic_set_title livesmax)
)

Change it to:

(if
(= lives 11)
(cinematic_set_title livesmax)
(sleep_until (!= lives 11) 15)
)


MoooseGuy
Joined: Aug 10, 2008

I Approve This Message.


Posted: Oct 26, 2010 05:57 PM    Msg. 7 of 10       
Thanks Gamma and Grunts, once again your Guru powers have come to save meh.
I shall test this out in a few hours.
Edited by MoooseGuy on Oct 26, 2010 at 06:02 PM


DarkAvengerX
Joined: Jul 13, 2010

I'll just stick to music as mapping is not for me.


Posted: Oct 26, 2010 05:58 PM    Msg. 8 of 10       
Yay to scripts!!!!!!!!!!!!!!!!!!!!!!!!!!!


Dwood
Joined: Oct 23, 2007

Judge Ye Therefore


Posted: Oct 26, 2010 09:35 PM    Msg. 9 of 10       
Quote: --- Original message by: MoooseGuy

Thanks Gamma and Grunts, once again your Guru powers have come to save meh.
I shall test this out in a few hours.
Edited by MoooseGuy on Oct 26, 2010 at 06:02 PM


Don't use the 15, I don't see the need for it. 30 game ticks (default for sleep_until) would save performance for people with uber computers like mine.


Gamma927
Joined: Jun 12, 2008

Steam: gamma927


Posted: Oct 26, 2010 10:49 PM    Msg. 10 of 10       
Wouldn't make a difference.

 

 
Previous Older Thread    Next newer Thread







Time: Fri January 20, 2023 10:34 PM 110 ms.
A Halo Maps Website