To remove (way - direction) exit from (place - room): (- I7_ChangeExit({place},{way},nothing); -).
Usage:
Remove the north exit from Home.
Understand "your" as a thing when the item described is held by the person asked.
Include (-
Global topic_noun;
[ I7_TopicNoun ; return topic_noun; ];
[ I7_IdenticalTopic test snippet w1;
w1 = snippet/100;
if ( (topic_noun = (test)(w1, 0)) ~= GPR_FAIL) return w1*100+wn-w1;
rfalse;
];
[ I7_RefersTopic test snippet w1 wlen i;
w1 = snippet/100;
wlen = snippet%100;
for (i=w1 : wlen>0 : i++, wlen-- ) {
if ( (topic_noun = (test)(i, 0)) ~= GPR_FAIL) return i*100+wn-i;
}
rfalse;
];
-).
To decide if (snip - snippet) is identical to (capricorn - topic): (- (I7_match_snippet = I7_IdenticalTopic({capricorn},{snip})) -).
To decide if (snip - snippet) refers to (capricorn - topic): (- (I7_match_snippet = I7_RefersTopic({capricorn},{snip})) -).
To decide which object is the matched thing: (- I7_TopicNoun() -).
Usage:
if the topic understood refers to "[any thing]", say "You mentioned [the matched thing]." if the topic understood is identical to "[any person] is nice", say "You seem to like [the matched thing]."
To decide which snippet is verb word: (- (100*verb_wordnum+1) -).
To make the location visible: (- FindVisibilityLevels(); if (location ~= thedark && visibility_ceiling == location) PlaceInScope(location); -).Usage:
After deciding the scope of the player when examining: make the location visible. Instead of examining the location, try looking.
Removed; functionality now exists in Inform.
To label (n - number): (- .marked_spot{n}; -).
To jump to label (n - number): (- jump marked_spot{n}; -).
Usage:
Instead of jumping: say "This is a test."; jump to label 42; say "This should not appear."; label 42; say "End of test."
To say perform (ph - phrase): (- if (0==0) {ph} -).
Usage:
Home is a room. A hamburger is here. Mary is a woman in home. Mary carries a flower. Instead of asking Mary about a topic listed in the table of Mary talk, say response entry. Table of Mary talk topic response "food" "'I like food.'[paragraph break][perform try mary trying taking the hamburger]" "flowers" "[if mary carries the flower]'Here, have a flower.'[paragraph break] [perform try mary trying dropping the flower] [otherwise]'I'm sorry, I have no more flowers.'[paragraph break][end if]" "exits" "'I have to go now.' And with that, she vanishes.[perform remove mary from play][paragraph break]" Test me with "ask mary about food / ask mary about flowers / ask mary about flowers / ask mary about exits".
Removed; can use indexed text instead.
This can be done more easily now using indexed text.
Include (-
Array status_text --> 512;
[ StartTextBuffer ; @output_stream 3 status_text; ];
[ StopTextBuffer ; @output_stream -3; ];
[ PrintStatusBuffer i len ch width depth last count;
width = ScreenWidth();
len = status_text-->0;
depth = 1;
! calculate depth
last = 0;
count = 0;
for (i=WORDSIZE:i<(len+WORDSIZE):i++) {
count++;
ch = status_text->i;
if (ch == 32) { last = count; }
if (ch == 13) {
depth++;
count = 0;
last = 0;
}
if (count > width && last > 0) {
count = count - last;
status_text->(i - count) = 13;
depth++;
}
}
! print buffer
font off;
style roman;
@erase_window 1;
StatusLineHeight(depth);
depth = 1;
@set_cursor depth 1;
for (i=WORDSIZE:i<(len+WORDSIZE):i++) {
ch = status_text->i;
if (ch == 13) {
depth++;
@set_cursor depth 1;
}
else print (char) ch;
}
font on;
];
[ StatusSpacer i ;
font off;
print "<";
for (i = 2 : i < ScreenWidth() : i++) print "-";
print ">";
font on;
];
-).
To start buffering text: (- StartTextBuffer(); -).
To stop buffering text: (- StopTextBuffer(); -).
To display buffer in status line: (- PrintStatusBuffer(); -).
To output spacer: (- StatusSpacer(); -).
Rule for constructing the status line:
start buffering text;
if the status line description of the location is "", say "I'm in a [location]";
otherwise say status line description of the location;
say "[line break]Obvious exits: [obvious exits][line break]Visible items: [notable things][line break]";
output spacer.
stop buffering text;
display buffer in status line.
To say obvious exits:
repeat with way running through directions begin;
let neighbor be the room way from location;
if neighbor is a room, say "[way capitalized] ";
end repeat;
To say (way - direction) capitalized:
if way is north, say "NORTH";
if way is northwest, say "NORTHWEST";
if way is northeast, say "NORTHEAST";
if way is west, say "WEST";
if way is east, say "EAST";
if way is south, say "SOUTH";
if way is southeast, say "SOUTHEAST";
if way is southwest, say "SOUTHWEST";
if way is up, say "UP";
if way is down, say "DOWN";
if way is inside, say "IN";
if way is outside, say "OUT".
To say notable things:
let count be the number of notable things;
if count > 0 begin;
let i be 1;
repeat with item running through notable things begin;
say "[item]";
if i < count, say ", ";
increase i by 1;
end repeat;
otherwise;
say "None";
end if.
Definition: a thing is notable if it is visible and it is not the player and it is in location.
A room has some text called status line description. The status line description of a room is usually "".
Usage:
Ghost Town is a room. A hat and a shovel are here. Saloon is north of Ghost Town. Brothel is south of Ghost Town. The status line description of the brothel is "I'm in a seedy looking brothel".
Removed; no longer functional. See my extension Consolidated Multiple Actions.
To decide if testing is in progress: (- (TestCheck()) -). To decide if testing is not in progress: (- (~~TestCheck()) -). Include (- [ TestCheck ; if (test_stack-->2 > 1) rtrue; rfalse; ]; -).
The last command is an indexed text that varies. The parser error flag is a truth state that varies. The parser error flag is false. Rule for printing a parser error when the parser error is only understood as far as and the player's command matches the text "with": change the last command to the player's command; change the parser error flag to true; let n be indexed text; let n be the player's command; replace the regular expression ".* with (.*)" in n with "with \1"; say "(ignoring the unnecessary words '[n]')[line break]"; replace the regular expression "with .*" in the last command with "". Rule for reading a command when the parser error flag is true: change the parser error flag to false; change the text of the player's command to the last command.Usage:
The cave is a room. The troll is a man in the cave. The player carries a sword. The chest is a locked lockable container in the cave. Test me with "attack troll with sword / unlock chest with sword / attack troll as a test".
To say kind name of (x - thing): (- print (I7_Kind_Name) {x}.&i7_kind-->0; -).
Usage:
say "[The noun] has kind [kind name of noun]."
To say then at random -- ending say_one_of with marker I7_SOO_TAR:
(- {-close-brace} -).
To say then purely at random -- ending say_one_of with marker I7_SOO_TPAR:
(- {-close-brace} -).
To say then in random order -- ending say_one_of with marker I7_SOO_TSHU:
(- {-close-brace} -).
Include (-
[ I7_SOO_TAR oldval count; if (oldval < count) return oldval+1;
return count + 1 + I7_SOO_RAN(oldval%(count+1), count); ];
[ I7_SOO_TPAR oldval count; if (oldval < count) return oldval+1;
return count + 1 + I7_SOO_PAR(oldval%(count+1), count); ];
[ I7_SOO_TSHU oldval count; if (oldval < count) return oldval+1;
if (oldval == count) oldval++;
return count + 1 + I7_SOO_SHU(oldval - count - 1, count); ];
-).
Usage:
say "[one of]One[or]Two[or]Three[then at random]."
To say stopping with label (n - number) -- ending say_one_of with marker I7_SOO_STOP:
(- {-close-brace} {-allocate-storage:STOPLABEL} {-allocate-storage:STOPINDEX}
if ( {-counter:STOPLABEL} >= I7_ST_STOPLABEL-->0 ) I7_ST_STOPLABEL-->0 = {-counter:STOPLABEL}+1;
I7_ST_STOPLABEL-->({-advance-counter:STOPLABEL}+1)={n};
I7_ST_STOPINDEX-->({-advance-counter:STOPINDEX}+1)={-counter:say_one_of};
-).
Include (-
[ ResetStoplist n i;
for (i = 0; i0; i++) if (I7_ST_STOPLABEL-->(i+1)==n) I7_ST_say_one_of-->((I7_ST_STOPINDEX-->(i+1))-1)=0;
];
-).
To reset label (n - number): (- ResetStoplist({n}); -).
Usage:
Every turn: say "[one of]One[or]Two[or]Three[stopping with label 666]." Instead of jumping: reset label 666; say "RESET."