! plback.h v1.1 Copyright 2003, 2004 Alexandre Muniz <
[email protected]>
! This file implements a "back" verb to allow the player to direct the
! PC to go back to the previous room that it had occupied. It requires
! Platypus, (a replacement for the standard Inform library.)
! How to use this:
! 1) Include this file after Last.h.
! 2) Add the following line to your GamePreRoutine(), or any
! convenient place that you are absolutely certain will occur before
! something can move the player:
! LastRoomCheck();
! 3) You'll probably want to add a line for the back verb in your
! PrintVerb entry point routine, which might look something like this:
! [ PrintVerb word;
! switch (word)
! {
! 'b//', 'back': print "go back to your previous location"; rtrue;
! }
! rfalse;
! ];
! Note: "Extend only" is somewhat broken in the Inform 6.21
! compiler. You may wish to use the 6.30 compiler instead. However, the
! 6.30 compiler exposes other bugs in Platypus, which make strict mode
! unusable. I suggest applying the patch for Platypus I've made
! available at
http://www.xprt.net/~munizao/games/platypus-tips.html
Global thisroom;
Global lastroom;
[ LastRoomCheck;
if (thisroom ~= player.location)
{
lastroom = thisroom;
thisroom = player.location;
}
];
[ GoBackSub;
if ((~~lastroom) || (lastroom == player.location))
"It's not clear where you want to go.";
else
<<GoToRoom lastroom>>;
];
Extend 'go' first
* 'back' -> GoBack;
Extend only 'turn'
* 'around'/'back' -> GoBack;
Verb 'back' 'b//' 'return' 'retreat' 'backtrack'
* -> GoBack;