PunyInform v3.6 released

As for the thinking - do you need the thinking subjects to be present in the location?

Have you looked at the implementation of the What verb in Library of Horror, which allows you to type “what is a grue” etc? Sounds like that is just about what you need.

1 Like

I have encountered a limit in PunyInform 1.8 (perhaps all versions?), which may be well known, I don’t know… I wasn’t aware of it though.

It seems as if the maximum number of visible objects must not be above 30, as this will give:
“[Puny error: 3]”
(maybe the actual limit is 32 as that may include the player and the location?)

I noticed, that if I close a box with an object inside, so only 30 objects are visible, the error goes away.

I don’t know where to look up these error codes. If this is a known limitation, could you please let me know where such limitations are described?
Thanks :slight_smile:

My applied inf-file:

!% -~S
!% $OMIT_UNUSED_ROUTINES=1
! The very first lines of the main source code file for a game can contain compiler options, like the two lines above.
! -~S disables strict error checking. This is otherwise used in z5 and z8 games by default. While useful for debugging,
! it adds ~10 KB to the story file size and it makes the game slower.
! $OMIT_UNUSED_ROUTINES=1 makes the compiler remove all routines which aren’t used. This can save some space.

Constant Story “Minimal”;
Constant Headline “^A sample game which uses PunyInform.^”;

! Uncomment ONE of the two following lines, to show either time or score/turns
! Leaving both commented out makes the library bigger.
!Constant STATUSLINE_TIME; Statusline time;
Constant STATUSLINE_SCORE; Statusline score;

! Uncomment to add optional features to PunyLib
!Constant DEBUG;
!Constant CUSTOM_ABBREVIATIONS;
!Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS;
!Constant OPTIONAL_EXTENDED_METAVERBS;
!Constant OPTIONAL_EXTENDED_VERBSET;
!Constant OPTIONAL_PRINT_SCENERY_CONTENTS;
!Constant OPTIONAL_FULL_SCORE;
!Constant OPTIONAL_FULL_DIRECTIONS;
!Constant OPTIONAL_SHIP_DIRECTIONS;
!Constant OPTIONAL_GUESS_MISSING_NOUN;
!Constant OPTIONAL_MANUAL_SCOPE;
!Constant RUNTIME_ERRORS = 0;

! Define any library constants you need here, like MAX_SCORE, AMUSING_PROVIDED,
! MAX_CARRIED, SACK_OBJECT, etc.

Constant INITIAL_LOCATION_VALUE = Library;

Include “globals.h”;

! Define your own global variables here, if any

! Define the entry point routines you need here, like Amusing, DarkToDark etc.

! Uncomment to add PunyLib extensions
!Include “ext_menu.h”;
!Include “ext_flags.h”;
!Include “ext_quote_box.h”;
!Include “ext_cheap_scenery.h”;

Include “puny.h”;

! Uncomment to add PunyLib extensions
!Include “ext_waittime.h”;

Object Library “The Library”
with
description “You are in a library.”,
has light;

Object -> Hammer “hammer”
with
name ‘hammer’; !1

Object -> dust “dust”
with
name ‘dust’; !2

Object -> chisel “chisel”
with
name ‘chisel’; !3

Object -> gold “gold”
with
name ‘gold’; !4

Object -> chest “chest”
with
name ‘chest’; !5

Object -> sword “sword”
with
name ‘sword’; !6

Object -> plate “plate”
with
name ‘plate’; !7

Object -> shaver “shaver”
with
name ‘shaver’; !8

Object -> pen “pen”
with
name ‘pen’; !9

Object -> paper “paper”
with
name ‘paper’; !10

Object -> table “table”
with
name ‘table’; !11

Object -> phone “phone”
with
name ‘phone’; !12

Object -> crab “crab”
with
name ‘crab’; !13

Object -> donkey “donkey”
with
name ‘donkey’; !14

Object -> mamba “mamba”
with
name ‘mamba’; !15

Object -> snake “snake”
with
name ‘snake’; !16

Object -> bottle “bottle”
with
name ‘bottle’; !17

Object -> cap “cap”
with
name ‘cap’; !18

Object -> hat “hat”
with
name ‘hat’; !19

Object -> monkey “monkey”
with
name ‘monkey’; !20

Object -> saw “saw”
with
name ‘saw’; !21

Object -> pin “pin”
with
name ‘pin’; !22

Object -> diamond “diamond”
with
name ‘diamond’; !23

Object -> sapphire “sapphire”
with
name ‘sapphire’; !24

Object -> shoe “shoe”
with
name ‘shoe’; !25

Object -> underwear “underwear”
with
name ‘underwear’; !26

Object -> bible “bible”
with
name ‘bible’; !27

Object -> pill “pill”
with
name ‘pill’; !28

Object -> pocket “pocket”
with
name ‘pocket’; !29

Object -> key “key”
with
name ‘key’; !30

Object -> Box “box” !31
with
name ‘box’,
inside_description “It feels so nice, standing in the box.”,
description “The box looks heavy.”,
has container open openable enterable;

[Initialise;
print “^^And so the story begins…^^”;
move Hammer to Box;
];

If you have runtime errors enabled (value of 2, i think), it will probably say “scope is full” indeed. There should be a MAX_SCOPE (or MAX_SCOPE_SIZE?) defined in globals.h to 32. Define your own before globals.h and you should be good!

1 Like

Thanks, just what I needed :slight_smile:

1 Like

I see you got help, great!

Note 1: Check out https://github.com/johanberntsson/PunyInform/wiki/Manual#customizing-the-library

Note 2: If you compile in DEBUG mode, RUNTIME_ERRORS defaults to 2, giving you as much information as possible about what goes wrong. Without DEBUG, it defaults to 1, giving you numeric error codes. Once you have tested your game properly and are ready to release it, you can choose to set RUNTIME_ERRORS to 0. This is like 1, only it removes several checks for runtime errors, making games slightly faster and smaller. For the problem you showed us above, RUNTIME_ERRORS = 0 would have meant that the scope would just have been quietly truncated - the last items would not have been included.

Note 3: The error codes are defined near the end of the file lib/messages.h in the PunyInform distribution.

1 Like

@fredrik I’m not shure if you noticed the discussion over in this thread. But the script by @mulehollandaise could be useful if you’re targeting 8-bit machines as I imagine many users of PunyInform are.

1 Like

I think he already knows about it :smiley: That script is one of the reasons why I was able to fit so much stuff in “Tristam Island” - another reason is PunyInform’s efficiency, and Fredrik’s expertise in optimizing I6 code to produce efficient low-level code! I really ought to write that up…

4 Likes

Whenever @mulehollandaise feels it’s ready for a public release, we’d like to point PunyInform users in that direction.

It’s not really that helpful for authors just starting out with PunyInform, but it’s of great value to authors whose game is nearing completion and they’re starting to hit their head against the 128 KB limit of the Z3 format. Perhaps we should provide a chapter of tips for authors who are finishing up their games for release. Including this script and things like “Make sure you turn off DEBUG”, “Set RUNTIME_ERRORS to 0 or 1” and maybe even “Get betatesters for your game”.

6 Likes

Version 1.9 of the text adventure library PunyInform is out! It has some new features and numerous bugfixes.

Among the news:

  • You can disable the handling of darkness, to make the library a little smaller and faster
  • You can choose the order of execution for timers/daemons.
  • “open box” tells the player what’s in the box.

Full release notes and downloads on the Github page: https://github.com/johanberntsson/PunyInform/releases

Since the games produced are standard Z-code games (version 3, 5 or 8), they can be played on anything from a Commodore PET to a Palm Pilot, or of course a modern computer! The screenshot shows the demo game Library of Horror (full source included with PunyInform) being played on a Commodore 128 (emulated by Vice). Once you have compiled a game using PunyInform, buildning disk images for C64, C128 and Plus/4 takes only a few seconds using Ozmoo Online ( http://microheaven.com/ozmooonline ).

7 Likes

When I catch the action Go, shouldn’t noun contain the value of FAKE_E_OBJ? And where does this value 5 come from?

The Room1
You are in room1. Room2 is to the east.

> e
Before: Go:
(name) noun = east
noun = 5
FAKE_E_OBJ = 10003

Code
!% -~S
!% $OMIT_UNUSED_ROUTINES=1
Constant STATUSLINE_SCORE; Statusline score;
Constant OPTIONAL_NO_DARKNESS;
Constant INITIAL_LOCATION_VALUE = room1;
Include "globals.h"; Include "puny.h";

Object room1 "The Room1"
   with
      description "You are in room1. Room2 is to the east.",
      Before [;
         Go:
            print "Before: Go:^";
            print "(name) noun = ", (name) noun, "^";
            print "noun = ", noun, "^";
            print "FAKE_E_OBJ = ", FAKE_E_OBJ, "^^"; 
      ],
      e_to room2;

Object room2 "The Room2"
   with
      description "You are in room2. Room2 is to the west.",
      w_to room1;

[ Initialise; ];

Noun should be Directions and selected_direction should be e_to. It’s usually enough to just check selected_direction, since it’s zero if a direction wasn’t specified.

The value 5 is the object# for the Directions object.

Typically:

before [;
	Go:
		if(selected_direction == u_to)
			"We don't go upstairs anymore. Not since the accident.";
],

The only time you use the fake direction objects is when you issue an action in code, like:

<<Go FAKE_E_OBJ>>;

Oh yes, thank you. It’s in the documentation at Direction Handling. I’ll have to read it one day instead of going back to DM4 every time!

Indeed, the direction handling is arguably the biggest difference between PunyInform and the standard library.

1 Like

Pretty please, ask questions about PunyInform issues in separate threads - one thread per question. Let this be a thread about relaeases only, like the headline suggests.

And if you are pretty sure you have encountered a bug, or you have a suggestion on something you think we should implement, please file it in our issue tracker on Github: Issues · johanberntsson/PunyInform · GitHub

Thanks!

3 Likes

PunyInform v2.0 is out! Some news:

  • Optional Undo support (z5+)
  • A simpler way to define doors, which also saves space if you use it for more than three doors
  • One more free property for games using full directions
  • ‘scored’ attribute is now separate from FullScore - you can now use the scored attribute, the FullScore verb, both or none.
  • Improved FullScore summary, reporting points added in code as “noteworthy actions” (customizable)
  • Added a Game Author’s Guide as PDF

Also, I have written a second tutorial on PunyInform (it links to the first as well): https://vintageisthenewold.com/punyinform-coding-2-objects-and-actions/

7 Likes

PunyInform v2.1 is out.

Some news:

  • Games are faster, especially when many objects are in scope
  • You can allow some creatures to be picked up, by adding a DisallowTakeAnimate routine where you return false for all takable creatures.

Details and downloads at Releases · johanberntsson/PunyInform · GitHub

image

5 Likes

PunyInform v2.2 is out! Some news:

  • Define NO_SCORE for a game without scorekeeping. The value of the constant will be shown as the score on the statusline in a z3 game with the “score” type statusline.
  • before-routines are not run for meta actions like Save
  • Parser responds better to bad input

As usual, read the release notes before upgrading!

(Releases · johanberntsson/PunyInform · GitHub)

2 Likes

Thanks !

Done the usual initial work (first and foremost, getting rid of that awkward DummyRoutine in testbench.inf, master copy in if/lib/inf6/puny/, documentation copied in if/doc/lib/inf6/puny/punyxx, examples in if/src/inf6/exa/puny/punyxx, now browsing the docs and examples… there’s already two notes:

in the author’s guide, is surprising that after correctly pointing to diff(1) at page 3, isn’t noticed that a work cut for tail(1) (yes, pun intentional) should be pointed at page 5-6…

The comment explaining the compiler options in minimal.inf and testbench.inf perhaps should be separated from said options by one or two blank lines for an improved visibility, compiler options beginning also with !

(minor, peevish, point, I can’t figure the usefulness of DummyRoutine; IMVHO without all those scores of identical lines testbench.inf is another excellent example, hence the excising Dummyroutine became my the customary first thing to do on a new Puny release…)

as you can see, only minor, if not merely taste-related, issues…

Thanks and
Best regards from Italy,
dott. Piergiorgio.

3 Likes

Thanks for the input! The huge DummyRoutine was added to make sure code that decided if a property value was a routine address, a string address or neither was working correctly when strings and/or routines were partially or completely above the $8000 mark, meaning they can be interpreted as negative numbers. The issues we had around this were sorted out a long time ago, so it’s definitely time to remove that routine.

Added some newlines in source too. Good idea.

1 Like

Great release as ususal, together with the latest Ozmoo, the performance is mind-blowing on a stock Commodore 64. :heartbeat:

1 Like