intfiction.org

The Interactive Fiction Community Forum
It is currently Thu Feb 22, 2018 11:29 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: So how do I do this now?
PostPosted: Mon Apr 17, 2017 12:26 pm 
Offline

Joined: Mon Mar 28, 2011 9:05 pm
Posts: 40
I took a long break and now I keep banging my head against things that got changed - including "change." I'm not interested in going back to an older version. That's just not how I roll.
Anyway, this no longer works:
Code:
Before reading a command while action memory is true: now the previous action is the last action; now %1 is false; continue the action.

to decide if continuing the action: if the the previous action is the acting action begin; yes; otherwise; no; end if.

to capture the action: now %1 is the current action.

To treat action as success:
   follow the post-action bookkeeping rulebook.


This was in an old extension by someone else, and I'm just trying to recreate some of the behavior it provided. In this case, tracking prior actions while ignoring certain specific actions (like looking). An alternative solution would be welcome.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 12:42 pm 
Online

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5561
What is the error?


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 12:59 pm 
Offline

Joined: Mon Mar 28, 2011 9:05 pm
Posts: 40
Problem. In the sentence 'now %1 is false' , I was expecting to read a condition, but instead found some text that I couldn't understand - '%1 is false'.

I'm fairly sure that none of that old code will work as expected in any case. The solution I'm looking for is less "make %1 work" and more "do what this old code used to do." I know Inform handles repeated actions, but I don't get how to track what the previous action was or ignore specific actions to track.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 3:57 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5216
Location: Burlington, VT
What extension is this? It seems to me like there's probably been some kind of problem in copy-pasting or something, because "%1" shouldn't be both a stored action and something that can be set to false. In any case, I'm not quite sure what the code is supposed to do.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 5:55 pm 
Offline

Joined: Mon Mar 28, 2011 9:05 pm
Posts: 40
That's how it appears in the extension. It was apparently valid 4 years ago. I'm not trying to use the extension though, only the "selective action memory" behavior from it. But valid or not, the whole block of code will do nothing.
Let me reiterate: I have no interest in fixing the extension or even this section of code. I only want to do with the current Inform what the extension did - selectively track prior commands.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 6:16 pm 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2556
Location: The Midwest
So what exactly is your goal? You want to be able to refer to "the previous action", but have a specific fixed list of actions be excluded?

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 6:23 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5216
Location: Burlington, VT
OK, but I don't feel like I have enough information to properly help you here. I don't know exactly what you mean by "selectively track prior commands," and without seeing more code from the extension I don't know what the code you quoted is doing; for instance, I don't know what the "post-action bookkeeping rulebook" does. If you told me what the extension was then I might be able to find it and see what it is doing.

Usually updates for the latest Inform aren't very cumbersome if they don't involve I6 inclusions, but the code you've posted isn't enough to work with. There are several things there that must have been declared as variables elsewhere in the code, but I don't have that code, so I can't compile it to see what might be going wrong.

I guess I'll say again that the %1s look like data corruption, and that the first %1 in that code almost certainly should be "action memory," while the second %1 should maybe be "last action" or "previous action." But without access to the rest of the code I don't know what it should be.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 6:46 pm 
Offline

Joined: Sun Oct 11, 2015 5:09 pm
Posts: 297
jwideman wrote:

This was in an old extension by someone else, and I'm just trying to recreate some of the behavior it provided. In this case, tracking prior actions while ignoring certain specific actions (like looking). An alternative solution would be welcome.


Code:
Test Chamber is a room. 

Gordon is a person in the test chamber. The bucket is an open container in the test chamber. Gordon carries a gun. A flute is in the bucket.

Looking is ignorable.
Examining something is ignorable.
Waiting is ignorable.

The previous action is an action that varies.

The last every turn rule:
   if the current action is not ignorable, now the previous action is the current action.
   
Every turn:
   say "Previous action: [previous action]."
   
Test me with "get flute / examine flute / give flute to gordon / look / wait / put the flute in the bucket / wait".


Here's a version if you want to remember more than one action at a time:

Code:
Test Chamber is a room. 

Gordon is a person in the test chamber. The bucket is an open container in the test chamber. Gordon carries a gun. A flute is in the bucket.

Looking is ignorable.
Examining something is ignorable.
Waiting is ignorable.

The previous actions queue is a list of actions that varies.

The last every turn rule:
   if the current action is not ignorable:
      add the current action at entry 1 in the previous actions queue;
   [presumably this would get cumbersome if you kept extending the list indefinitely, so we'll cut this one off at 10 entries]
   if the number of entries in the previous actions queue is greater than 10:
      truncate the previous actions queue to 10 entries.
   
Every turn:
   say "Previous actions: [previous actions queue]."
   
Test me with "get flute / examine flute / give flute to gordon / look / wait / put the flute in the bucket / get the bucket / drop the bucket / jump / listen / smell / ask Gordon about the gun / attack Gordon / wait".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 17, 2017 7:49 pm 
Offline

Joined: Mon Mar 28, 2011 9:05 pm
Posts: 40
Thanks, mikegentry! That first solution is quite elegant compared to the old code and exactly what I was looking for, but that second solution adds possibilities I hadn't even considered.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed May 10, 2017 3:06 pm 
Offline

Joined: Mon Mar 28, 2011 9:05 pm
Posts: 40
It looks like I've hit a snag with this. The actions are getting recorded, no problem there. But when I try to test if the previous action is the current action (for repeating the action) it acts like it's the first time doing that action.
Here's the code I'm using to see if it repeats:
Code:
To decide whether continuing the action:
   If the number of entries in the previous actions queue is at least 1:
      If entry 1 of the previous actions queue is the current action:
         Decide yes;
   Decide no;   


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 10 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