Releases: johanberntsson/PunyInform
Releases · johanberntsson/PunyInform
v5.3.1
Important to note when upgrading:
- Nothing
Optimizations:
- Don't force a scope update when calling a property routine if the property value is 0 or NULL. This should save a lot of scope updates for games without OPTIONAL_MANUAL_SCOPE where there's often no user code to run in a turn.
Bugfixes:
- Fixed: add_to_scope didn't work properly.
v5.3
Important to note when upgrading:
- Nothing
Changes in functionality:
- InScope is now always consulted when deciding whether to recalculate scope or reuse the cached scope copy.
- The variable scope_reason is now supported, and can be checked in InScope (but not in add_to_scope!). TALKING_REASON is not supported - PARSING_REASON is used instead.
Bugfixes:
- Disambiguation of a complex noun phrase where a parse_name didn't consume all words failed without a response.
- Improved grammar for 'remove' when removing clothing.
- action and action_to_be are now set to NULL when game starts, instead of 0, which means action ##Take.
- action_to_be is updated when the player types a direction.
v5.2
Important to note when upgrading:
- If you've been setting cs_parse_name_id to assign an ID for a cheap scenery object, stop doing this, Instead, give it an ID using the new mechanism for assigning an ID to any cheap scenery object, e.g.
cheap_scenery 100 CS_PARSE_NAME [; if(NextWord() == 'air') rtrue; rfalse; ] "Airy!",
to give it the ID 100. The valid range is 100-500.
Changes in functionality:
- Added option to assign an ID to a cheap scenery object.
- New global in cheap scenery: cs_match_id. Can be used to check ID of matched cheap scenery object in location before-routines etc.
- New procedure in cheap scenery: CSPerformAction(action, ID, second) - Works like
<action noun second>;
but for a cheap scenery object. Give second as -(object) to flip the order, so the cheap scenery object gets to be second. - Global cs_parse_name_id in cheap scenery extension has been removed. Instead of assigning this in parse_name routines, give the object an ID in the cheap scenery list.
- ext_menu ends with
<<Look>>;
but this can now be skipped by defining the constant M_NO_LOOK. - Enter action has a new message: MSG_ENTER_HELD, which is used when trying to enter something which is (possibly indirectly) held by the player.
Optimizations:
- Saved 34 bytes in cheap scenery extension.
Bugfixes:
- Fixed parser bug: If all matched objects had concealed, and 2+ objects matched, the parser would ask a disambiguation question.
- Quote boxes weren't centered on screen in z5+ games, like they should.
- Parse buffer is emptied when leaving a menu in ext_menu in z3, so ending it with "q" can never be misunderstood as the player trying to quit the game.
- Fixed bug in cheap scenery: If an entry using CS_PARSE_NAME starts with CS_THEM, the object was still considered an IT-object if it had a parse_name routine and it didn't set parser_action = ##PluralFound.
v5.1
Important to note when upgrading:
- Action routines can return a message to be printed (new), or set globals to have after routines run (older change). For this reason, avoid calling action routines directly, i.e. instead of doing
LookSub();
, do<Look>;
. - If you define any entry point routines (apart from
Initialise
), you now have to define them before including puny.h. Up to now, you were adviced to do just this, but you could often get away with defining them later in the source code.
Changes in functionality:
- Let action routines return a message# to be printed, and have PerformPreparedAction print this, saving 344 bytes.
- Ifdefs instead of stubs for entry point routines, saving up to 178 bytes, and adding performance.
- Moved NotifyOff-, NotifyOn- and Oops-messages to messages.h.
- TenSpaces array is now private (_TenSpaces) and resides in static memory.
- Made FastSpaces routine tolerate negative argument.
Optimizations:
- Updated abbreviations, saving 108 bytes for a minimal game using the built-in abbreviations.
- Created internal parser routine _ObjInMultipleObjects, reducing logic duplication and saving 48 bytes in z3 and 64 bytes in z5.
- Created routine _CheckForAndObject in parser, to save 18 bytes.
- Saved 6 bytes in z3 and 20 bytes in z5 in _ParseToken, while improving performance.
- Saved 12 bytes in z5 in NumberWord (used by OPTIONAL_ALLOW_WRITTEN_NUMBERS), while improving performance.
- Made StartDaemon faster and 15 bytes shorter for z5.
- Made StopDaemon faster and a few bytes shorter for z5.
- Saved 15 bytes in _ParsePattern for z5.
- Optimized routines _CopyInputArray and _CopyParseArray for z5.
- Made resetting of task_done array in main shorter and faster in z5.
- Made quote box extension faster and smaller in z5, by using FastSpaces routine.
Bugfixes:
- Fixed bug in CSTEST action in cheap scenery, which said a reaction string or routine was expected after a CS_PARSE_NAME + routine, when there was in fact no problem.
- Fixed parser bug which gave a strange message for "get blue book and all books but blue."
v5.0.1
Important to note when upgrading:
- Nothing
Changes in functionality:
- Modified library_of_horror.inf to use the recently added cheap scenery option to mark some objects or words as "them"-words.
Optimizations:
- Optimized library_of_horror.inf to produce a smaller Z-code file.
Bugfixes
- Cheap scenery would match adjectives without a noun following them.
v5.0
Important to note when upgrading:
- If you use talk menu: Split up your talk_array into one array per actor. End each array with TM_END. Instead of giving each actor a talk_start property, give them a talk_array property, with the name of their own talk array as the value.
- If you use talk_menu, remove any calls to InitTalk(), as they are no longer needed.
- If you use talk menu and have replaced the TMPrintLine routine, copy the latest version from ext_talk_menu.h and modify it to your liking.
- Cheap scenery entries that use the standard form of adjective + noun will now match any combination of these words, e.g. noun adjective noun. Re-test your cheap scenery objects.
- Cheap scenery now matches the object that matches the highest number of words in player input, rather than the first object that matches any word. Re-test your cheap scenery objects.
Changes in functionality:
- Change in talk menu: Split up talk_array into one array per actor. End each array with TM_END. Instead of giving each actor a talk_start property, give them a talk_array property, with their own talk array as the value.
- Change in talk menu: The user definable routine TMPRintLine takes different arguments than before, the code has changed, and it now prints quote marks around lines by default.
- Change in talk menu: Routines _TMCallOrPrint, _SetTopic, ActivateTopic, InActivateTopic, GetTopicStatus, RunTalk and TalkSub have been altered. The signature (how you call them) of the public routines has not changed, except for TMPrintLine (which users typically don't call).
- Change in talk menu: Routine InitTalk has been removed.
- Change in talk menu: The debug action TalkSetup has been removed, along with the grammar to activate it.
- Updated howto/talk_menu.inf to reflect the changes in talk menu.
- Changed the standard adjective + noun form for cheap scenery entries to match any combination of these words.
- Changed cheap scenery so the longest match ( = matching the highest number of consecutive words in player input) is used, rather than the first match. In case of a tie, the first match of this length is used.
- Changed cheap scenery so "them" will refer to the cheap scenery object if a plural word was used, e.g. "x shelves", or if entry begins with CS_THEM, or if it has a parse_name routine which sets parser_action = ##PluralFound.
- New cheap scenery feature: CS_MAYBE_ADD_LIST [function] [object] [propery] adds the list if the function returns true.
- New debug verb for cheap scenery: 'cstest'. Checks the integrity of all cheap_scenery arrays in the game.
- Improved error printing in cheap scenery: The property name is now printed as well (useful when including extra lists of cheap scenery, not necessarily stored in the cheap_scenery property).
- New function in flags extension: AnyFlagIsSet(flag1, flag2, flag3) - returns true if any of two or three flags are set.
- New function in flags extension: AnyFlagIsClear(flag1, flag2, flag3) - returns true if any of two or three flags are clear.
Optimizations:
- Optimized word matching in cheap scenery extension for z5.
- Optimized the cheap scenery extension for code size.
- Made flags functions FlagIsSet and FlagIsClear slightly shorter.
Bugfixes:
- Improved _PatternLength to count preposition alternatives correctly.
- Bugfix: You could refer to the cheap scenery object with "it" even after moving to a new room, e.g. "x window. e. open it"
v4.7
Important to note when upgrading:
- If you have code to check that your game is built with the intended library version, there is now a new constant you may want to consider: PUNYINFORM_PATCH_VERSION. It is normally zero, but e.g if the version is v4.6.3, PUNYINFORM_PATCH_VERSION is 3.
- MoveFloatingObjects has been changed to look at
location
rather thanreal_location
when deciding if an object should be present, and if it should be present it is indeed movedlocation
rather thanreal_location
. This may change the behaviour of your floating objects if you're using darkness in your game.
New/changed functionality:
- New file: howto/adjectives.inf, with a class to add adjectives and many synonyms to objects in all Z-code versions.
- In addition to the PUNYINFORM_MAJOR_VERSION and PUNYINFORM_MINOR_VERSION constants, there is now a third version constant for PunyInform: PUNYINFORM_PATCH_VERSION. It is normally 0, but if we need to make a patch release between major/minor releases, we set this to a number > 0. If it's 0, it is not printed in the banner.
- The default message in the cheap scenery extension can now be changed by setting CS_DEFAULT_MSG to a string before including the extension. This is mainly to support extensions that need to replace it.
- Moved two more messages from parser.h to messages.h, so they can be customized: MSG_PARSER_NO_IT and MSG_PARSER_CANT_SEE_IT.
- Changed MoveFloatingObjects to use location rather than real_location, i.e. floating objects can also exist in the thedark location (like in I6lib).
- Added functionality in MoveFloatingObjects to accept a class ID in a found_in array, i.e. if location belongs to this class, the object is present (like in I6lib).
- Added functionality in MoveFloatingObjects to accept a regular object in a found_in array, and if this object's parent is location, the floating object should also be present (like in I6lib).
- Changed MoveFloatingObjects to only move an object to location if it's not already there, in order not to disturb the order of the objects more than necessary (like in I6lib).
- Added functionality in MoveFloatingObjects so a floating object that is held by the player is no longer considered to be floating (like in I6lib).
Optimizations:
- Optimized IndirectlyContains function for speed.
Bugfixes:
- Added an optional call to ChooseObjectsFinal when a noun token matches a list of indistinguishable objects. If ChooseObjectsFinal reduces this to a single match, then it is accepted. In effect this means that we pick and use one random item from a set of indistinguishable objects.
- Improved pattern matching so that shorter patterns are preferred, which provides better responses when using OPTIONAL_GUESS_MISSING_NOUN (issue 112)
v.4.6.1
v4.6
Important to note when upgrading:
Nothing.
New/changed functionality:
- Cleaned up support for coloured text.
- _ReadPlayerInput() now supports two arguments: p_no_prompt (not new) stops the routine from printing a prompt, and p_no_statusline (new) stops the routine from printing the statusline under z5 (It's safe to call it with this parameter even under z3 though).
- The YesOrNo() routine no longer causes the statusline to be redrawn.
- New library routine for z5: ClearScreen(window); where window can be WIN_ALL (default), WIN_MAIN or WIN_STATUS. Also sets colours if clr_on is set to true.
- New library routine: ChangeFgColour(colour); Changes the foreground colour variable clr_fg and, if clr_on is true, instructs the interpreter to change the foreground colour accordingly. For z3, this routine exists but does nothing.
- Added chapter on colours to manual
- Added an example of how to implement colours in a game, see file howto/colours.inf
- Runtime errors now include the error number + text message when RUNTIME_ERRORS is set to 2. This should make it easier to refer to the error, and find it in the documentation.
- Consolidated runtime error messages in extensions, making builds with RUNTIME_ERRORS smaller, and the error messages adhere to the same form.
- Changed so check if maximum # of timers/daemons is about to be exceeded is performed even when RUNTIME_ERRORS is 0, to avoid array overrun.
- Added appendix on runtime errors to manual
Bugfixes:
- Fixed bug where time_left wasn't set correctly and runtime error check to see if timer object provides time_left wasn't performed if timer was set to 0.
- In DEBUG mode, the flags extension would print a warning about using flag 0, but treat it as an error and abort the operation.
v4.5
Important to note when upgrading:
- If you're using cheap scenery, an you have a test like
if(word1==1)
orif(word1==CS_NO_ADJ)
inSceneryReply
(whereword1
is your name for the first parameter), you need to change this toif(word1==0)
instead, to make it keep working as before.
Changes in functionality:
- An R is added after the library version in the banner if RUNTIME_ERRORS > 0.
- You can now specify up to 9 adjectives + 9 nouns for a cheap scenery object, by entering 10*adjectives+nouns and then the words, e.g.
23 'small' 'green 'ant' 'insect' 'animal' "It's so small!"
. SceneryReply
gets the first adjective and the first noun for the matched cheap scenery object as parametersword1
andword2
.- Breaks backward compatibility: A cheap scenery object having the value
CS_NO_ADJ
( =1 ) as its first value, would getword1
= 1 whenSceneryReply
was called. It will now getword1
= 0, to make the behaviour coherent with when the first value is 2-9 (object has multiple nouns but no adjectives). - New cheap scenery routines, meant to be used in
SceneryReply
:CSHasAdjective(x)
returns true ifx
is one the adjectives for the last matched cheap scenery object.CSHasNoun(x)
does the same thing for nouns.CSHasWord(x)
returns true ifx
is either an adjective or noun for the object. Programmers can use values 200-600 as markers to trigger certain behaviours inSceneryReply
. - talk_menu now allows a topic to have multiple IDs
- talk_menu functions can now match multiple topics. For maximum performance, authors can turn this off at any time with
talk_menu_multi_mode = false;
. When reading the current status of a topic, the status of the first matching topic will be returned. - talk_menu will no longer consider it an error if it tries to activate a topic and it turns out the topic is stale. Not finding a topic is still an error.
- Made DEBUG REACTIVE command return a lot less false positives (i.e. locations which provide an exit that's an alias of one of the reactive properties, like
react_before
. - New talk menu routine:
TMPrintLine
, prints a line spoken by the player or an NPC. Author can define their own version before including talk menu. - talk menu: Author can add a string or routine before and/or after the player's line, to convey non-verbal events and reactions. Add one of the following constants just after the topic:
TM_ADD_BEFORE
,TM_ADD_AFTER
,TM_ADD_BEFORE_AND_AFTER
, then add the strings/routines before and/or after the player's line. - talk_menu: A string can now be used as an effect of a topic.
- talk_menu: To mute a line by the player or an NPC, replace it with
TM_NO_LINE
. - Example games for cheap scenery and talk menu in howto-folder have been updated.
Optimizations:
- The library doesn't try to run
location.each_turn
if it doesn't exist.
Bugfixes:
- Fixed talk_menu bug: activating a relative topic# would also set the flag with that number.
- Fixed talk_menu bug where talk menu could behave erratically for games larger than half the allowed size for the Z-code version.
- Fixed
_FixIncompleteSentenceOrComplain
bug when completing sentences that match patterns that include thetopic
token