Main      Site Guide    
Message Forum
Re: AGLL Guide -- Make your own AGL games
Posted By: Sam, on host 12.16.110.5
Date: Monday, December 14, 1998, at 11:46:00
In Reply To: Re: AGLL Guide -- Make your own AGL games posted by Stephen on Monday, December 14, 1998, at 11:32:31:

> > There is, however, a way to accomplish what you suggest by not using *either* the "win" or "lose" commands. At each ending, jump to a new location called "ending"...
> > Let me know if this is not clear, and I'll provide an example with AGLL code.
>
> Eh, could you?

Sure.

> This means when it displays the ending, you still have options that are availible from the start...

Yes, that's one of the problems. But if there is interest in this approach, I may be able to make a "suppress constant options" command for this. For that matter, a "suppress inventory" command is just as feasible.

At any rate, here's the example.

------- In location file "loc1": -------
* 1 Win via path #1.
______v 1 = 1
______g ending

------- In location file "loc2": -------
* 2 Win via path #2.
______v 1 = 2
______g ending

------- In location file "ending": -------
c v1=1
_____. You won via path #1! It is dramatic and tragic!
_____v 99 + 1
c v1=2
_____. You won via path #2! It is triumphant and happy!
_____v 99 + 1
c v99=2
_____* f Finish.
__________w
c v99!2
_____* undo Undo that last move.
__________c v1=1
________________g loc1
__________c v1=2
________________g loc2

v1 stores the number of the ending the player did. v99 stores the total number of endings the player has seen thus far. Once the player has seen them all, the "ending" location code jumps to the "win" routine. At the "ending" location, you only ever get to "undo" the move (which isn't really an undo in the sense that variable changes get undone -- the undo has to be done manually by throwing the player back to where he was) *OR* "finish" the game. Those are the only two options that ever appear, and they never appear together.

This example doesn't handle the case where the player attempts one ending more than once. This can be handled in the "ending" location with one global per ending, but it's probably better handled in the locations that *lead* to the "ending" location. That way you can use their state variables instead and disallow their respective "win" options from becoming available after they've been selected once. I can give code that will do that, too, if you need it, but the example above illustrates what I was trying to say before. (Disclaimer: I *think* the above works, but I haven't tested it. At any rate, that's the idea.)

Replies To This Message