counting health without endgame

NOTE: I HATE A LOT OF YOUR ZZT GAMES, SO WATCH OUT!

Moderators: Commodore, Zenith Nadir

Post Reply
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

counting health without endgame

Post by Commodore »

I want to tally health in the middle of the game and award points, but counting means taking and taking all the health makes the game end.

#take health 100
#give health 100

ends the game (assuming you have exactly 100 health)
yet we know the odd truth that:

#endgame
#give health 100

does not end the game. any ideas?
*POW* *CLANK* *PING*
Xhin
newcomer
Posts: 7
Joined: Sun Mar 26, 2006 4:56 pm

Post by Xhin »

#take health 100
#give health 100

Doesn't end the game, although if there's an idle or any other type of command that doesn't happen instantaneously, it will make your game go into hyperspeed. So, just keep taking health until you are incapable, and then immediately give back at least one health point.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

well this is sort of what I had, but it goes into super speed

:loop
#take health 1 #done
#give score 1
#loop
:done
#give health 100

it executes a couple lines after getting to 0 health before giving health so I guess that's why it doesn't work
*POW* *CLANK* *PING*
User avatar
Dr. Dos
OH YES! USE VINE WHIP! <3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Commodore wrote:well this is sort of what I had, but it goes into super speed

:loop
#take health 1 #done
#give score 1
#loop
:done
#endgame
#give health 100
Fixed for you.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

no i tried that. the hyper effect starts when health reaches zero and doing an endgame after the effect starts doesn't slow the game back down.
*POW* *CLANK* *PING*
Microwave
hi
Posts: 114
Joined: Fri Aug 03, 2007 10:34 pm

Post by Microwave »

:loop
#take health 3#check2
#give score 3
#loop
:check2
#take health 2#done
#give score 2
#loop
:done
#give score 1
#give health 98

Does that work?
User avatar
Dr. Dos
OH YES! USE VINE WHIP! <3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Commodore wrote:no i tried that. the hyper effect starts when health reaches zero and doing an endgame after the effect starts doesn't slow the game back down.
Could the stat order cause that?

Because I ended up making a test world with code exactly like that before seeing your own code.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

You could do it backwards:

Code: Select all

#give score 100
#start
:loop
#give health 1
#take score 1
:start
#take health 100 loop
#give health 100
There's still one #take health in there, so it might still send you into hyperspeed. Might be solvable by throwing in an idle before the #take health. I haven't tested it.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

actually dos you were right, I don't know what I was doing before wrong though because I thought I tried that.

ok. thx
*POW* *CLANK* *PING*
Post Reply