intfiction.org

The Interactive Fiction Community Forum
It is currently Thu Dec 13, 2018 9:22 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Oct 09, 2018 3:47 pm 
Offline

Joined: Sun Feb 17, 2008 3:51 pm
Posts: 300
Hey gang,
Haven’t been around for a while so if this has been covered, just point me in the direction and I’ll be on my way. (I did check here and the bug tracker first but didn’t see it.)
I’m having trouble getting a rule and/or rulebook to return a list of numbers. This is a minimal example:
Code:
Lab is a room. 

The set rules is a number based rulebook producing a list of numbers.

A set rule for a number (called n) (this is the default set rule):
   let x be {1, 2};
   add n to x;
   say "[x].";
   rule succeeds with result x.
   
Instead of jumping:
   let y be 20;
   let z be the list of numbers produced by the set rules for y;
   say "Boo!";
   say "[z].".
When compiling to Glulx, I get this:
Quote:
>jump
1, 2 and 20.
Then the interpreter freezes and I get this error message:
Glulxe fatal error: Memory access out of range (-7FFFFFD2)
This happens when using either the “… produced by… rule” or “follow… rule” syntaxes:
Code:
Instead of jumping:
   let y be 20;
   follow the set rules for y;
   say "Boo!";
   say "[y].".
Obviously, the above example doesn't actually pass the results back, but it does at least run the rule. When I compile to zcode I get the expected outputs in both cases. This is surely a bug, but I'm not sure where. TIA

_________________
Skinny Mike


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Oct 09, 2018 10:13 pm 
Online

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5836
It looks like a bug in the code that marshals complex data structures (like lists) when routines are called. I don't have much clue about that stuff, I'm afraid. You should file it.

If you can rewrite your code to use a global list variable ("Set-result is a list of numbers that varies"), rather than having the rulebook return the list, that should avoid the bug.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Oct 11, 2018 10:20 am 
Offline

Joined: Sun Feb 17, 2008 3:51 pm
Posts: 300
Hey Andrew,
Thank you for checking on this. I've filed a report here.
I had already tried using a global variable before I saw your post and it works just swimmingly for my purposes. It's just a little clunkier - looking. Thanks again.

_________________
Skinny Mike


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Erik Temple and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group