intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Dec 10, 2018 2:44 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Jul 05, 2018 2:25 am 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
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
Code:
south = finishGameMsg(ftDeath, [finishOptionUndo]);


Produces a nil reference error with a yellow arrow pointing at
Code:
finishGameMsg(ftDeath, [finishOptionUndo]) + 0x1C

in the "stack" and another yellow arrow pointing at
Code:
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


Last edited by Selva on Thu Jul 05, 2018 10:08 pm, edited 2 times in total.

Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 5:52 am 
Offline

Joined: Sat Oct 17, 2015 5:48 am
Posts: 85
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 8:15 am 
Offline

Joined: Sat Jul 16, 2011 3:48 pm
Posts: 309
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]);
        }
    }
;


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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 5:42 pm 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 5:54 pm 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
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?


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 8:29 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 1033
Location: Greece
The standard way is to throw a QuittingException, which is what QuitAction.terminateGame() does. So try:

Code:
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


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jul 05, 2018 10:07 pm 
Offline

Joined: Mon Apr 04, 2011 8:33 pm
Posts: 17
RealNC you rock. I appreciate the help and all the hand holding. This works perfectly. Thank you.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group