Page 2 of 3

Posted: Sun Jul 18, 2004 2:51 pm
by 519
" the objects would have to be placed before the racing object, so that the stat orders would allow the checkpoint code to run before the racer code each cycle"

Well, you learn something new every day...

Posted: Mon Jul 19, 2004 11:30 pm
by Micah
You could have the finish line 2 blocks wide, and have 2 objects checking for alignment. One goes before the other in a check order, so that you know the player is crossing the line the right way. If the player does it backwards, the
flag commands are zapped so that they cannot come back and cross again.
Then, have another set of objects at the opposite side of the track that check
for allignment. If the player goes past the wrong way, you could probably have a "WRONG WAY" message. Once the car passes this point, it sends the finish like objects to a label which restores the commands which set the lap flags. This may seem confusing...so I will provide an example:

This is the first object that checks the finish line:

Code: Select all

@Finish1
#cycle 1
:loop1
#if alligned send
#send loop1
:send
#send finish2:loop1
#send loop1
This is the second object for the finish line:

Code: Select all

@Finish2
#cycle1
:loop
#if alligned wrong
#send loop
:loop1
#if alligned set
#send loop
:set
#send setflag
:setflag
#set lap1
#zap setflag
#send loop
:setflag
#set lap2
#zap setflag
#send loop
:setflag
You win the race
#end
:wrong
#zap set
WRONG WAY
#send loop
:restore
#restore set
#send loop
And the other two objects:

Code: Select all

@Way1
:loop
#if alligned send
#send loop
:send
#send Way2:loop1
#send loop
And the second:

Code: Select all

@Way2
:loop
#if alligned wrong
#send loop
:loop1
#if alligned right
#send loop
:wrong
WRONG WAY
#send loop
:right
#send Finish2:restore
#send loop
Not sure if that would work...but it seems right in my own mind.

Suddenly, everything is beautiful.

Posted: Tue Jul 20, 2004 1:45 am
by Quantum P.
Interesting idea! The basic concept seems sound to me. However, there are a few problems, but these can be fixed. When the player is running in the right direction on a side of the track opposite from a pair of sensors, it will appear to the sensors to be going the wrong way, triggering the message "WRONG WAY" to appear. Also, there is the opportunity for cheating if you run back and forth between sensors. The player would still have to cover some distance, but chances are, it would be less distance than actually running the entire length of the track.

The fix: Set up the objects so that a wrong way followed by a right way is not considered passing the checkpoint/finish line. If a wrong way is detected, two consecutive right ways must be detected for the event to be accepted as a pass. Once the player passes a pair of objects, those objects should shut off and send a message to the other pair to start up again. This should also get rid of any "WRONG WAY" messages that shouldn't be sent.

Finally, the ZZT-OOP code could be tidied up, and the engine only works when the player is the racer (unless you use an object alignment workaround). However, it <i>should</i> work (I haven't tested it yet), and it is a very clever solution to the problem. Nicely done, micah!

Posted: Tue Jul 20, 2004 5:18 am
by Micah
It already does that. I am a newbie to ZZT-OOP, so I am not really good at keeping the code neat and clean. But you can't acheive a checkpoint until you go post the halfway mark of the track, which is covered in the other 2 objects. After you achieve a right way from those, you can cross the line. I don't see the point in going backwards after reaching the halfway point, so you really don't have to worry about the player going past the halfway sensors then backtracking. Thanks for the encouragement :).

Actually, I see what you mean. The sensors would pick up the player on
the opposite side of the track. Shutting them down until the player gets a right way is a damn good idea.

Posted: Tue Jul 20, 2004 5:46 am
by Dr. Dos
haha wow we're talking about ZZT (all because of that fascist moose no longer being in charge)

Posted: Tue Jul 20, 2004 6:12 am
by Mooseka
my evolution at z2 was like

fag who lurked a lot (0-25 posts)
highly respected admin (25-30 posts)
LORD AND PUPPETMASTER OF Z2 (30-1000 posts)
Figurehead and mascot of z2 also owner (1000-1600)
LORD AND PUPPERMASTER AGAIN (1600-now)

Posted: Tue Jul 20, 2004 8:19 am
by Micah
Mooseka why do you mess everything up? Huh?

Posted: Tue Jul 20, 2004 5:55 pm
by Dr. Dos
Mine's like 0-1581 - Huge fag

Posted: Tue Jul 20, 2004 8:02 pm
by Micah
Oh hell. I'm like 0-21 Who the fuck is Micah?

Posted: Tue Jul 20, 2004 8:42 pm
by Kjorteo
0 to like...12 or so? - Some random guy
Then someone altered my sig from then on so it's like
12 - present - HUGE FURRY

<strike>So you see it's all your fault</strike>

Posted: Tue Jul 20, 2004 10:24 pm
by Stak
Mine went something like

1-GameMstr1: OMG N00B
GameMstr1-Stak: NAME CHANGE WTF
Stak-100: HAHA GAMEMSTR
100-Present: Oh, hey, sup

Posted: Tue Jul 20, 2004 11:29 pm
by http://yahoo.com/
mine's something like

hi

Posted: Wed Jul 21, 2004 12:16 am
by Commodore
You idiots, the post count has been reset at least twice.

Posted: Wed Jul 21, 2004 1:35 am
by Mooseka
Commodore wrote:You idiots, the post count has been reset at least twice.
mine hasn't! because I got here like late last year.

Posted: Wed Jul 21, 2004 10:24 am
by Kjorteo
Also, let me optimize this in particular piece a little while blatantly ignoring the other three for now:
micah wrote:This is the second object for the finish line:

Code: Select all

@Finish2
#cycle1
:loop
#if alligned wrong
#send loop
:loop1
#if alligned set
#send loop
:set
#send setflag
:setflag
#set lap1
#zap setflag
#send loop
:setflag
#set lap2
#zap setflag
#send loop
:setflag
You win the race
#end
:wrong
#zap set
WRONG WAY
#send loop
:restore
#restore set
#send loop

Code: Select all

@Finish2
#cycle 1
#if alligned wrong
#restart
:loop1
#if alligned #if not wrongway advance
#restart
:advance
:advance
#zap advance
#restart
:advance
You win the race!
#end
:wrong
Wrong way!
#set wrongway
#restart
:restore
#clear wrongway
#restart
I had it just #restart instead of making a separate loop just for one command that happens at the very beginning. It #cycle 1s a lot more often now, but in my experience, that has no noticeable effect and the code just looks prettier.

I also consolidated the crap out of the "setflag" thing, since there should be no need to use flags to keep track of what lap you're on. If you even have any events that revolve around checking what lap you're on before doing something (like a cheerleader who says something different on lap 2,) you could keep track of laps with some counter you don't use. I find score to work nicely since you can't ?+ for it and no one cares what your score is outside Tim Sweeny ZZT games anyway. That's if you even have anything aside from this one object that needs to know what lap you're on. If you don't, simply having it keep a mental note to itself with #zapping like that should work fine.

Also note that I didn't even try to understand the whole racing engine overall, so this object may be screwed up in the concept level and that's not my fault. I just took their word for it that it works and had it do the same exact thing with more sleek and sexay code.

Also also note that I normally put one /i after every text output (ie "You win the race") just in case, and I probably would have some sort of "You advanced a lap!" type of output between the #zap advance and #restart, just to make it friendlier. But I didn't, because I wanted to see just how much shorter in lines I could make my version. And since the original didn't do that, it would erode my clear lead to waste time with it. <strike>SO EAT THAT, BITCHES</strike>