Debugging
version 10 by Al Golden
Version 10 of Debugging by Al Golden begins here.
Include (-
Verb meta 'recording' * -> CommandsOn
* 'on' -> CommandsOn
* 'off' -> CommandsOff;
Verb meta 'replay' * -> CommandsRead;
#ifdef TARGET_ZCODE;
[ CommandsOnSub;
@output_stream 4;
xcommsdir = 1;
"[Command recording on.]";
];
[ CommandsOffSub;
if (xcommsdir == 1) @output_stream -4;
xcommsdir = 0;
"[Command recording off.]";
];
[ CommandsReadSub;
@input_stream 1;
xcommsdir = 2;
"[Replaying commands.]^^";
];
#ifnot; ! TARGET_GLULX
[ CommandsOnSub fref;
if (gg_commandstr ~= 0) {
if (gg_command_reading) "[Commands are currently replaying.]";
else "[Command recording already on.]";
}
! fileref_create_by_prompt
fref = glk($0062, $103, $01, 0);
if (fref == 0) "[Command recording failed.]";
gg_command_reading = false;
! stream_open_file
gg_commandstr = glk($0042, fref, $01, GG_COMMANDWSTR_ROCK);
glk($0063, fref); ! fileref_destroy
if (gg_commandstr == 0) return L__M(##CommandsOn, 4);
"[Command recording on.]";
];
[ CommandsOffSub;
if (gg_commandstr == 0) "[Command recording already off.]";
if (gg_command_reading) "[Command replay complete.]";
glk($0044, gg_commandstr, 0); ! stream_close
gg_commandstr = 0;
gg_command_reading = false;
"[Command recording off.]";
];
[ CommandsReadSub fref;
if (gg_commandstr ~= 0) {
if (gg_command_reading) "[Commands are already replaying.]";
else "[Command replay failed. Command recording is on.]";
}
! fileref_create_by_prompt
fref = glk($0062, $103, $02, 0);
if (fref == 0) "[Command replay failed.]";
gg_command_reading = true;
! stream_open_file
gg_commandstr = glk($0042, fref, $02, GG_COMMANDRSTR_ROCK);
glk($0063, fref); ! fileref_destroy
if (gg_commandstr == 0) return L__M(##CommandsRead, 4);
"[Command replay complete.]";
];
#endif; ! TARGET_
-).
placing is an action applying to nothing.
understand "places" as placing.
before placing:
say "You have visited the following rooms:[paragraph break]".
carry out placing:
repeat with item running through visited rooms:
say "[item] [line break]";
objecting is an action applying to nothing.
understand "objects" as objecting
instead of objecting:
say "You have handled the following items: [line break]";
repeat with obj running through handled things:
say "the [obj]";
After printing the name of something (called item) while objecting:
if the location of the item is nothing
begin;
say " (lost)[line break]";
otherwise if the player carries the item;
say " (carried)[line break]";
otherwise if the player wears the item;
say " (worn)[line break]";
otherwise;
say " (in [the location of the item])[line break]";
end if.