! ==============================================================================
! VERBLIB: Front end to standard verbs library.
!
-! Supplied for use with Inform 6 -- Release 6.12.2 -- Serial number 180520
+! Supplied for use with Inform 6 -- Release 6.12.4 -- Serial number 200718
!
-! Copyright Graham Nelson 1993-2004 and David Griffith 2012-2018
+! Copyright Graham Nelson 1993-2004 and David Griffith 2012-2020
!
! This file is free software: you can redistribute it and/or modify
! it under the terms of the GNU Affero General Public License as
#Ifndef NO_PLACES;
[ ObjectsSub; Objects1Sub(); ];
+[ ObjectsTallSub; Objects1TallSub(); ];
+[ ObjectsWideSub; Objects1WideSub(); ];
[ PlacesSub; Places1Sub(); ];
+[ PlacesTallSub; Places1TallSub(); ];
+[ PlacesWideSub; Places1WideSub(); ];
#Endif; ! NO_PLACES
! ------------------------------------------------------------------------------
print "^", (string) Story;
glk_set_style(style_Normal);
#Endif; ! TARGET_
- }
+ } else
+ new_line;
+
if (Headline) print (string) Headline;
+ else
+ new_line;
+
#Ifdef TARGET_ZCODE;
- print "Release ", (HDR_GAMERELEASE-->0) & $03ff, " / Serial number ";
+ print (string) RELEASE__TX, (HDR_GAMERELEASE-->0) & $03ff, " / ", (string) SERNUM__TX;
for (i=0 : i<6 : i++) print (char) HDR_GAMESERIAL->i;
#Ifnot; ! TARGET_GLULX;
- print "Release ";
+ print (string) RELEASE__TX;
@aloads ROM_GAMERELEASE 0 i;
print i;
- print " / Serial number ";
+ print " / ", (string) SERNUM__TX;
for (i=0 : i<6 : i++) print (char) ROM_GAMESERIAL->i;
#Endif; ! TARGET_
new_line;
#Ifdef TARGET_ZCODE;
ix = 0; ! shut up compiler warning
if (standard_interpreter > 0) {
- print "Standard interpreter ", standard_interpreter/256, ".", standard_interpreter%256,
+ print (string) STDTERP__TX, standard_interpreter/256, ".", standard_interpreter%256,
" (", HDR_TERPNUMBER->0;
#Iftrue (#version_number == 6);
print (char) '.', HDR_TERPVERSION->0;
print ") / ";
}
else {
- print "Interpreter ", HDR_TERPNUMBER->0, " Version ";
+ print (string) TERP__TX, HDR_TERPNUMBER->0, (string) VER__TX;
#Iftrue (#version_number == 6);
print HDR_TERPVERSION->0;
#Ifnot;
#Ifnot; ! TARGET_GLULX;
@gestalt 1 0 ix;
- print "Interpreter version ", ix / $10000, ".", (ix & $FF00) / $100,
+ print (string) TERPVER__TX, ix / $10000, ".", (ix & $FF00) / $100,
".", ix & $FF, " / ";
@gestalt 0 0 ix;
- print "VM ", ix / $10000, ".", (ix & $FF00) / $100, ".", ix & $FF, " / ";
+ print (string) VM__TX, ix / $10000, ".", (ix & $FF00) / $100, ".", ix & $FF, " / ";
#Endif; ! TARGET_;
- print "Library serial number ", (string) LibSerial, "^";
+ print (string) LIBSER__TX, (string) LibSerial, "^";
#Ifdef LanguageVersion;
print (string) LanguageVersion, "^";
#Endif; ! LanguageVersion
#Ifdef LanguageError;
LanguageError(n, p1, p2);
#Ifnot;
+
+ print "** ", (string) LIBERROR__TX, n, " (", p1, ", ", p2, ") **";
#Ifdef DEBUG;
- print "** Library error ", n, " (", p1, ", ", p2, ") **^** ";
- switch (n) {
- 1: print "preposition not found (this should not occur)";
- 2: print "Property value not routine or string: ~", (property) p2, "~ of ~", (name) p1,
- "~ (", p1, ")";
- 3: print "Entry in property list not routine or string: ~", (property) p2, "~ list of ~",
- (name) p1, "~ (", p1, ")";
- 4: print "Too many timers/daemons are active simultaneously.
- The limit is the library constant MAX_TIMERS
- (currently ", MAX_TIMERS, ") and should be increased";
- 5: print "Object ~", (name) p1, "~ has no ~", (property) p2, "~ property";
- 7: print "The object ~", (name) p1, "~ can only be used as a player object if it has
- the ~number~ property";
- 8: print "Attempt to take random entry from an empty table array";
- 9: print p1, " is not a valid direction property number";
- 10: print "The player-object is outside the object tree";
- 11: print "The room ~", (name) p1, "~ has no ~", (property) p2, "~ property";
- 12: print "Tried to set a non-existent pronoun using SetPronoun";
- 13: print "A 'topic' token can only be followed by a preposition";
- 14: print "Overflowed buffer limit of ", p1, " using '@@64output_stream 3' ", (string) p2;
- 15: print "LoopWithinObject broken because the object ", (name) p1, " was moved while the loop passed through it.";
- 16: print "Attempt to use illegal narrative_voice of ", p1, ".";
- default:
- print "(unexplained)";
- }
- " **";
- #Ifnot;
- "** Library error ", n, " (", p1, ", ", p2, ") **";
- #Endif; ! DEBUG
+ L__M(##RunTimeError, n, p1, p2);
+ #Endif;
+ print "^";
+
#Endif; ! LanguageError
];
if (c_style & ISARE_BIT) {
if (j == 1 && o hasnt pluralname) Tense(IS__TX, WAS__TX);
else Tense(ARE__TX, WERE__TX);
- if (c_style & NEWLINE_BIT) print ":^";
- else print (char) ' ';
+ if (c_style & NEWLINE_BIT) print (string) COLON__TX, "^";
+ else print (char) ' ';
c_style = c_style - ISARE_BIT;
}
EnglishNumber(q); print " ";
print (string) j.list_together;
if (c_style & ENGLISH_BIT) print " (";
- if (c_style & INDENT_BIT) print ":^";
+ if (c_style & INDENT_BIT) print (string) COLON__TX, "^";
}
q = c_style;
if (k2 ~= String) {
EnglishNumber(l); print " ";
print (string) j.list_together;
if (c_style & ENGLISH_BIT) print " (";
- if (c_style & INDENT_BIT) print ":^";
+ if (c_style & INDENT_BIT) print (string) COLON__TX, "^";
}
q = c_style;
if (k ~= String) {
restore Rmaybe;
return L__M(##Restore, 1);
.RMaybe;
- L__M(##Restore, 2);
+ if (AfterRestore() == 1)
+ LibraryExtensions.RunAll(ext_afterrestore);
+ else
+ L__M(##Restore, 2);
];
[ SaveSub flag;
@save -> flag;
switch (flag) {
0: L__M(##Save, 1);
- 1: L__M(##Save, 2);
+ 1:
+ if (AfterSave() == 1)
+ LibraryExtensions.RunAll(ext_aftersave);
+ else
+ L__M(##Save, 2);
2:
RestoreColours();
- L__M(##Restore, 2);
+ if (AfterRestore() == 1)
+ LibraryExtensions.RunAll(ext_afterrestore);
+ else
+ L__M(##Restore, 2);
}
#Ifnot;
save Smaybe;
return L__M(##Save, 1);
.SMaybe;
- L__M(##Save, 2);
+ if (AfterSave() == 1)
+ LibraryExtensions.RunAll(ext_aftersave);
+ else
+ L__M(##Save, 2);
#Endif; ! V5
];
L__M(##Restore, 1);
];
-[ SaveSub res fref;
+[ SaveSub res fref retval;
fref = glk_fileref_create_by_prompt($01, $01, 0);
if (fref == 0) jump SFailed;
gg_savestr = glk_stream_open_file(fref, $01, GG_SAVESTR_ROCK);
GGRecoverObjects();
glk_stream_close(gg_savestr, 0);
gg_savestr = 0;
- return L__M(##Restore, 2);
+ if (AfterRestore() == 1)
+ return LibraryExtensions.RunAll(ext_afterrestore);
+ else
+ return L__M(##Restore, 2);
+ return retval;
}
glk_stream_close(gg_savestr, 0);
gg_savestr = 0;
- if (res == 0) return L__M(##Save, 2);
+ if (res == 0) {
+ if (AfterSave() == 1)
+ return LibraryExtensions.RunAll(ext_aftersave);
+ else
+ return L__M(##Save, 2);
+ }
.SFailed;
L__M(##Save, 1);
];
if (gg_scriptstr == 0) jump S1Failed;
glk_window_set_echo_stream(gg_mainwin, gg_scriptstr);
L__M(##ScriptOn, 2);
- VersionSub();
return;
.S1Failed;
L__M(##ScriptOn, 3);
[ NotifyOnSub; notify_mode = true; L__M(##NotifyOn); ];
[ NotifyOffSub; notify_mode = false; L__M(##NotifyOff); ];
+[ Places1TallSub;
+ places_style = NEWLINE_BIT+INDENT_BIT+FULLINV_BIT;
+ <Places>;
+];
+
+[ Places1WideSub;
+ places_style = ENGLISH_BIT+FULLINV_BIT;
+ <Places>;
+];
+
[ Places1Sub i j k;
- L__M(##Places, 1);
objectloop (i has visited) j++;
+ if (j == 0)
+ return L__M(##Places, 3);
+
+ L__M(##Places, 1);
+ if (places_style & INDENT_BIT) print (string) COLON__TX, "^";
+ else print " ";
+
objectloop (i has visited) {
+ if (places_style & INDENT_BIT) Print__Spaces(2);
print (name) i; k++;
- if (k == j) return L__M(##Places, 2);
- if (k == j-1) print (SerialComma) j, (string) AND__TX;
- else print (string) COMMA__TX;
+
+ if (places_style & INDENT_BIT)
+ new_line;
+ else {
+ if (k == j)
+ return L__M(##Places, 2);
+ if (k == j-1)
+ print (SerialComma) j, (string) AND__TX;
+ else
+ print (string) COMMA__TX;
+ }
}
];
-[ Objects1Sub i j f;
+[ Objects1TallSub;
+ objects_style = NEWLINE_BIT+INDENT_BIT+FULLINV_BIT;
+ <Objects>;
+];
+
+[ Objects1WideSub;
+ objects_style = ENGLISH_BIT+FULLINV_BIT;
+ <Objects>;
+];
+
+[ Objects1Sub i j f object_count;
+ object_count = 0;
+ objectloop (i has moved) {
+ object_count++;
+ }
+ if (object_count == 0)
+ return L__M(##Objects, 2);
+
L__M(##Objects, 1);
+ if (objects_style & INDENT_BIT) print (string) COLON__TX, "^";
+ else print " ";
+
objectloop (i has moved) {
- f = 1; print (the) i; j = parent(i);
+ f++;
+ if (objects_style & INDENT_BIT) Print__Spaces(2);
+ print (the) i;
+ j = parent(i);
if (j) {
if (j == player) {
if (i has worn) L__M(##Objects, 3, j, i);
.Obj__Ptd;
- new_line;
+ if ((object_count - f) >= 1) {
+ if (objects_style & INDENT_BIT) {
+ Print__Spaces(2);
+ new_line;
+ } else {
+ if ((object_count - f) == 1) {
+ SerialComma(object_count);
+ print " ", (address) AND1__WD, " ";
+ } else if (object_count > 2)
+ print (string) COMMA__TX;
+ }
+ }
}
- if (f == 0) L__M(##Objects, 2);
+
+ if ((objects_style & INDENT_BIT) == 0)
+ print ".^";
+ else
+ print "^";
];
! ----------------------------------------------------------------------------
else
inventory_style = ENGLISH_BIT+PARTINV_BIT;
<Inv, actor>;
- inventory_style = 0;
];
[ InvTallSub;
else
inventory_style = NEWLINE_BIT+INDENT_BIT+PARTINV_BIT;
<Inv, actor>;
- inventory_style = 0;
];
[ InvSub x;
if (res >= 2) rtrue;
ks = keep_silent; keep_silent = 1; <Disrobe obj, actor>; keep_silent = ks;
if (obj has worn && obj in actor) rtrue;
- if (res == 0 && ~~keep_silent) L__M(##Drop, 3, obj);
+ if (res == 0 && ~~keep_silent) L__M(##Disrobe, 3, obj);
rfalse;
];
if (noun == actor) return L__M(##PutOn, 4, noun);
if (noun in parent(actor)) return L__M(##Drop, 1, noun);
if (noun notin actor && ~~ImplicitTake(noun)) return L__M(##Drop, 2, noun);
+ if (noun has worn && no_implicit_actions) return L__M(##Disrobe, 4, noun);
if (noun has worn && ImplicitDisrobe(noun)) return;
move noun to parent(actor);
if (AfterRoutines() || keep_silent) return;
- L__M(##Drop, 4, noun);
+ L__M(##Drop, 3, noun);
];
[ PutOnSub ancestor;
}
if (k-- == 0) flag = 1;
if (flag) break;
- if (keep_silent == 0) print (name) i, (string) COLON__TX;
+ if (keep_silent == 0) print (name) i, (string) COLON__TX, " ";
<Transfer i second, actor>;
i = j;
}
! ----------------------------------------------------------------------------
[ EnterSub ancestor j ks;
- if (noun has door || noun in compass) <<Go noun, actor>>;
+ if (noun has door || noun in Compass) {
+ if (verb_word == STAND__TX or SIT__TX or LIE__TX)
+ return L__M(##Enter, 2, noun, verb_word);
+ <<Go noun, actor>>;
+ }
+
if (actor in noun) return L__M(##Enter, 1, noun);
if (noun hasnt enterable) return L__M(##Enter, 2, noun, verb_word);
}
}
- thedir = noun.door_dir;
- if (metaclass(thedir) == Routine) thedir = RunRoutines(noun, door_dir);
+ if (noun.door_dir ~= nothing) {
+ thedir = noun.door_dir;
+ if (metaclass(thedir) == Routine)
+ thedir = RunRoutines(noun, door_dir);
+ next_loc = i.thedir;
+ } else
+ next_loc = noun;
+
+ k = metaclass(next_loc);
+
+ if (k == String) {
+ print (string) next_loc;
+ new_line; rfalse;
+ }
- next_loc = i.thedir; k = metaclass(next_loc);
- if (k == String) { print (string) next_loc; new_line; rfalse; }
if (k == Routine) {
next_loc = RunRoutines(i, thedir);
if (next_loc == 1) rtrue;
else L__M(##Go, 2);
rfalse;
}
+
if (next_loc has door) {
if (next_loc has concealed) return L__M(##Go, 2);
if (next_loc hasnt open && ImplicitOpen(next_loc)) {
LookSub(1);
];
+
+
! ----------------------------------------------------------------------------
! Describing the world. SayWhatsOn(object) does just that (producing
! no text if nothing except possibly "scenery" and "concealed" items are).
! descriptions as it goes.
! ----------------------------------------------------------------------------
+
[ SayWhatsOn descon j f;
if (descon == parent(player)) rfalse;
objectloop (j in descon)
L__M(##Look, 4, descon);
];
+
[ NotSupportingThePlayer o i;
i = parent(player);
while (i && i ~= visibility_ceiling) {
}
rtrue;
];
-! modified with the fix for L61122
-[ Locale descin text_without_ALSO text_with_ALSO
- o p num_objs must_print_ALSO;
- objectloop (o in descin) give o ~workflag;
- num_objs = 0;
- objectloop (o in descin)
- if (o hasnt concealed && NotSupportingThePlayer(o)) {
- #Ifndef MANUAL_PRONOUNS;
- PronounNotice(o);
- #Endif;
- if (o has scenery) {
- if (o has supporter && child(o)) SayWhatsOn(o);
- }
- else {
- give o workflag; num_objs++;
- p = initial;
- if ((o has door or container) && o has open && o provides when_open) {
- p = when_open; jump Prop_Chosen;
- }
- if ((o has door or container) && o hasnt open && o provides when_closed) {
- p = when_closed; jump Prop_Chosen;
- }
- if (o has switchable && o has on && o provides when_on) {
- p = when_on; jump Prop_Chosen;
- }
- if (o has switchable && o hasnt on && o provides when_off) {
- p = when_off;
- }
-
- .Prop_Chosen;
- if (o.&describe && RunRoutines(o, describe)) {
- must_print_ALSO = true;
- give o ~workflag; num_objs--;
- continue;
- }
- if (o.p && (o hasnt moved || p ~= initial)) {
- new_line;
- PrintOrRun(o, p);
- must_print_ALSO = true;
- give o ~workflag; num_objs--;
- if (o has supporter && child(o)) SayWhatsOn(o);
- }
- }
- }
- if (num_objs == 0) return 0;
+! Determine if something is casually visible. Includes things on
+! supporters or in open/transparent containers that are scenery. Static
+! objects are not included.
+[ Locale descin text_without_ALSO text_with_ALSO
+ o p num_objs must_print_ALSO x flag;
+
+ objectloop (o in descin) {
+ if (o has scenery && (o has supporter || (o has container && o has open or transparent)) && children(o) > 0) {
+ flag = 0;
+ objectloop (x in o) {
+ if (x hasnt scenery && x hasnt concealed)
+ flag++;
+ }
+ if (flag > 0) {
+ if (num_objs == 0)
+ print "^";
+ else
+ print " ";
+
+ if (o has supporter)
+ print "On ", (the) o;
+ else
+ print "In ", (the) o;
+
+ WriteListFrom(child(o), ENGLISH_BIT+TERSE_BIT+CONCEAL_BIT+ISARE_BIT);
+ print ".";
+ num_objs++;
+ }
+ }
+ }
+
+ if (num_objs > 0)
+ print "^";
- if (actor ~= player) give actor concealed;
+ objectloop (o in descin)
+ give o ~workflag;
+ num_objs = 0;
+ objectloop (o in descin) {
+ if (o hasnt concealed && NotSupportingThePlayer(o)) {
+#Ifndef MANUAL_PRONOUNS;
+ PronounNotice(o);
+#Endif;
+ if (o hasnt scenery) {
+ give o workflag;
+ num_objs++;
+ p = initial;
+ if ((o has door or container) && o has open && o provides when_open) {
+ p = when_open;
+ jump Prop_Chosen;
+ }
+ if ((o has door or container) && o hasnt open && o provides when_closed) {
+ p = when_closed;
+ jump Prop_Chosen;
+ }
+ if (o has switchable && o has on && o provides when_on) {
+ p = when_on;
+ jump Prop_Chosen;
+ }
+ if (o has switchable && o hasnt on && o provides when_off)
+ p = when_off;
+.Prop_Chosen;
+ if (o.&describe && RunRoutines(o, describe)) {
+ must_print_ALSO = true;
+ give o ~workflag;
+ num_objs--;
+ continue;
+ }
+ if (o.p && (o hasnt moved || p ~= initial)) {
+ new_line;
+ PrintOrRun(o, p);
+ must_print_ALSO = true;
+ give o ~workflag;
+ num_objs--;
+ if (o has supporter && child(o))
+ SayWhatsOn(o);
+ }
+ }
+ }
+ }
+
+ if (num_objs == 0)
+ return 0;
+ if (actor ~= player)
+ give actor concealed;
if (text_without_ALSO) {
- new_line;
- if (must_print_ALSO) print (string) text_with_ALSO, " ";
- else print (string) text_without_ALSO, " ";
- WriteListFrom(child(descin),
- ENGLISH_BIT+RECURSE_BIT+PARTINV_BIT+TERSE_BIT+CONCEAL_BIT+WORKFLAG_BIT);
- }
- else {
- if (must_print_ALSO) L__M(##Look, 5, descin);
- else L__M(##Look, 6, descin);
- }
- if (actor ~= player) give actor ~concealed;
+ new_line;
+ if (must_print_ALSO)
+ print (string) text_with_ALSO, " ";
+ else
+ print (string) text_without_ALSO, " ";
+
+ WriteListFrom(child(descin), ENGLISH_BIT+RECURSE_BIT+PARTINV_BIT+TERSE_BIT+CONCEAL_BIT+WORKFLAG_BIT);
+ } else {
+ if (must_print_ALSO)
+ L__M(##Look, 5, descin);
+ else
+ L__M(##Look, 6, descin);
+ }
+ if (actor ~= player)
+ give actor ~concealed;
return num_objs;
];
+
+
! ----------------------------------------------------------------------------
! Looking. LookSub(1) is allowed to abbreviate long descriptions, but
! LookSub(0) (which is what happens when the Look action is generated)
return L__M(##Examine, 2, noun);
}
i = PrintOrRun(noun, description);
- if (i < 2 && noun has switchable) L__M(##Examine, 3, noun);
+ if (i == 0 && noun has switchable) L__M(##Examine, 3, noun);
AfterRoutines();
];
L__M(##Lock, 5, noun);
];
-[ SwitchonSub;
+[ SwitchOnSub;
if (ObjectIsUntouchable(noun)) return;
if (noun hasnt switchable) return L__M(##SwitchOn, 1, noun);
if (noun has on) return L__M(##SwitchOn, 2, noun);
L__M(##SwitchOn, 3, noun);
];
-[ SwitchoffSub;
+[ SwitchOffSub;
if (ObjectIsUntouchable(noun)) return;
if (noun hasnt switchable) return L__M(##SwitchOff, 1, noun);
if (noun hasnt on) return L__M(##SwitchOff, 2, noun);
! ----------------------------------------------------------------------------
[ AllowPushDir i;
- if (parent(second) ~= compass) return L__M(##PushDir, 2, noun);
+ if (parent(second) ~= Compass) return L__M(##PushDir, 2, noun);
if (second == u_obj or d_obj) return L__M(##PushDir, 3, noun);
AfterRoutines(); i = noun; move i to actor;
<Go second, actor>;
[ JumpInSub;
if (noun has animate) return L__M(##JumpIn, 2, noun);
if (noun has enterable) <<Enter noun>>;
- L__M(##JumpOn, 1, noun);
+ L__M(##JumpIn, 1, noun);
];
[ JumpOnSub;
[ ThrowAtSub;
if (ObjectIsUntouchable(noun)) return;
+ if (second == nothing) return L__M(##ThrowAt, 1, noun);
if (second > 1) {
action = ##ThrownAt;
if (RunRoutines(second, before)) { action = ##ThrowAt; rtrue; }