How do I make it quit ... durring the intro? *solved*

How do I get the bloody program to end the bloody game?
This should be easy. And I have tried everything I can find. I started with a cut and paste of the bit from Heidi. That throws an error but the program doesn’t stop. I tried a Lot of permutations of said same. Same errors. The program is still running in the background of all the errors Buuuuuuut it is all blank and only responds to closing it with the mouse.

So this

south = finishGameMsg(ftDeath, [finishOptionUndo]);

Produces a nil reference error with a yellow arrow pointing at

finishGameMsg(ftDeath, [finishOptionUndo]) + 0x1C

in the “stack” and another yellow arrow pointing at

libGlobal.totalTurns = gPlayerChar.nextRunTime + gAction.actionTime;

in the finishGameMsg(msg, extra) section of tads3\lib\adv3\misc.t

I tried to post a screen shot of all that but I don’t have a web page to set it up on. Sorry.
I even found myself trying that “endGame()” function, even though I know it’s only a locally defined thing in the user manual examples. Obviously that didn’t help.
It should not be this hard.
Has something fundamental changed that isn’t represented in the reference materials?
As usual please and thank you in advance for any assistance.

  • Selva

what terp are you using, and with terp version ? from your bug description I will investigate compiler and interpreter…

Best regards from Italy,
dott. Piergiorgio.

finishGameMsg is a function you can call to end game. However south property is expected to contain a reference to a room (or room connector object to be more precise), therefore the library tries to access methods and properties of this room connector once the player travels through it, but finishGameMsg is a function and doesn’t provide any object. Create travel connector instead and do what you like in noteTraversal method:

[code]room: OutdoorRoom ‘room’ ‘room’
"A room. "

south: TravelConnector
{
    noteTraversal(traveler)
    {
        finishGameMsg(ftDeath, [finishOptionUndo]);
    }
}

;
[/code]

Of course finishGameMsg will take you to the finish menu and it will not terminate the program as such, but quit could be one of options in the finish menu. If you really want to terminate the program you can call QuitAction.terminateGame(); This will quit frobtads altogether, but show message that the game ended in QTads.

I had original been using it in the intro to allow players to bail if they were uninterested in explicit violence. The south transition was an ecxperiemnt that emitted thre same error. However I will modify and see if I can get it to work in the proper environment. Info on that when it is finished.

I am using
workbench = Release HT-24 (Build Win121; TADS 3.1.3)
interpreter … shows the same about screen as above.

Thank you. I am beginning to get a better sense of my real problem. The finishGameMsg works fne form within the travel connector. It does not work form within the showIntro() function. I had assumed it would work because another custom function was working fine from there. So… I need to amend my original question and apologize for the inaccuracy of my difficulties.

My game may contain some rated R for violence sequences and I wish to warn players and give them a chance to bail in the introduction sequence. However the finishGameMsg(‘Game Over’, [finishOptionUndo]); function produces a heap of bizarre errors when I try to do this. What would be the best way to accomplish this mission?

The standard way is to throw a QuittingException, which is what QuitAction.terminateGame() does. So try:

if (player_wants_to_quit) {
    "I'm sorry you feel that way. ";
    throw new QuittingException;
}

If you know what exception handling is (like in Java, C++, C#) then this does exactly what you expect it does. It throws that specific exception, which is caught by the library and this exits the game. This is not the best use of exceptions normally, but TADS sometimes uses them as abort-like signals, since it lacks a proper signalling mechanism.

RealNC you rock. I appreciate the help and all the hand holding. This works perfectly. Thank you.