Page 1 of 1

Adding to EndGame message

Posted: Sun Sep 02, 2012 7:19 pm
by Bainespal
The documentation to the roodylib extension suite explains the use of SpecialKey to add another option during a particular ending state. I'm pretty sure you're also going to need to tell the player that there is such a choice, by printing your "(A)musing" (or whatever) notice.

You could almost use NewMessages to replace the messages for case &EndGame. However, I only want to show the special option for some ending states and not all of them. I'd need to add a new "num" value case, but that would mean I'd also have to replace EndGame itself, in order to test for the new case.

I've added roodylib, and I see that roodylib has changed EndGame. Looking at the code, I still don't see what I have to replace in order to add text to the message.

Posted: Sun Sep 02, 2012 8:36 pm
by Roody_Yogurt
If you notice, EndGame has this line:

Code: Select all

Message(&EndGame, 1,end_type)
"end_type" is the endflag value you used to call EndGame (example: endflag = 3)

Because of this, you can replace the EndGame message with something like this:

Code: Select all

replace NewMessages(r, num, a, b)
{
   select r
	case &EndGame
	{
		select num
		case 1
		{
			print "\nThe game has ended.  Do you want to (R)ESTART,
				R(E)STORE a saved game, ";
#ifclear NO_UNDO
			if not UNDO_OFF         ! if not otherwise overridden
				print "(U)NDO your last turn, ";
#endif
                        if a = 3 ! ( a = end_flag)
                             print "(A)musing notes, ";
			print "or (Q)UIT? ";
		}
		case 2
		{
			print "Enter (R)ESTART, R(E)STORE, ";
#ifclear NO_UNDO
			if not UNDO_OFF
				print "(U)NDO, ";
#endif
                        if a = 3 ! ( a = end_flag)
                             print "(A)musing notes, ";
			print "or (Q)UIT: ";
		}
	}

   case else : return false
   return true ! this line is only reached if we replaced something
}
where the applicable text only prints when it's the right endflag.

Posted: Sat Sep 08, 2012 3:42 pm
by Bainespal
That works well. Thank you.

Posted: Sat Sep 08, 2012 9:52 pm
by Roody_Yogurt
Glad to hear it!