Game won't terminate

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

Bainespal
Posts: 151
Joined: Fri Jul 09, 2010 8:59 am

Game won't terminate

Post by Bainespal »

It's about time that I ask for help with a bug in T&S that I've always known about but have no leads on. When the game ends, if the player selects "Q" to quit, the game simply goes back into normal execution. You can then re-do the action that trigged the ending, and win (or die) over and over again:
*** YOU’VE WON THE GAME! ***

The game has ended. Do you want to (R)ESTART, R(E)STORE a saved game, (U)NDO your last turn, or (Q)UIT? q

>q
Are you sure you want to quit (YES or NO)? y
I assume that the problem has to be with the endflag variable, but I have no way to prove it. I tried watching endflag in the Debugger, but the watch window always shows "endflag = 0" even when the "YOU'VE WON..." message is being displayed and the interpreter is waiting for one of the options to be selected.

In the code, I trigger the endings with the EndGlag routine, like this:

Code: Select all

Endgame(1)

Roody_Yogurt
Posts: 2181
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

As http://hugo.gerynarsabode.org/index.php?title=EndGame points out, EndGame is just one of those unintuitive things. You never should call it yourself. The engine calls it automatically when you change the endflag global.

Wherever you have EndGame(1), you should just have:

Code: Select all

endflag = 1

Bainespal
Posts: 151
Joined: Fri Jul 09, 2010 8:59 am

Post by Bainespal »

That's the opposite of what I had been assuming. I thought using the routine would be the better, more "official" method. But anyways, I'm glad it's a simple fix!

Post Reply