Table Trouble: Order of doing things

if you only ever care about the reverse order, just store it that way to begin with, e.g.,

carry out trying a shoe on: if the noun is not listed in worn-list, add the noun at entry 1 in worn-list

(The not listed in test should have been in my original, too.)

2 Likes

Oh, have I screwed this up. This list thing looks even harder than the table, which was almost working before I royally effed it up. I gave a really simple example of shoes because I thought this whole thing would be easier, but it turns out that was a bad choice and I have made a mess of the question. Shocker.

So I’m trying to apply this to my real scenario, which is much more complicated than shoes, and of course I’m already running into problems.

First:
I need the memory to apply to a value (remember book-peeping those book numbers?), not a thing. The text of those booknumbers is what needs remembering-- well, not the text itself. A placeholder with a number that the player can choose to read the text. And Inform doesn’t want me to let a value have a text. I have ideas about this, but they’re all ridiculously convoluted, like creating invisible objects every time the player reads something to tag a memory to.

If I had known how complex this would be, I wouldn’t have created a simplistic shoe example. Apologies.

Values can have texts. But you can’t understand non-objects by property, only objects. (And if you want to understand by relation, both sides have to be objects.)

lab is a room.

has-text is a kind of value. a has-text has a text called description.
has-been is a has-text. "So yesterday.".

[ the below probably has nothing to do with what you want, but I didn't know that when I wrote it... ]
Demo is a kind of object. a demo has a text called description.

demo1 is a demo.  "desc1".
demo2 is a demo.  "desc2".

understand the description property as describing a demo.

pondering is an action applying to one visible thing.

understand "ponder [any demo]" as pondering.

carry out pondering: say "[description of the noun] -> [the noun]".

test me with "ponder desc2 / ponder desc1"
2 Likes

Yet when I stick a text to booknumber (which is a value) like this (has-text is a kind of value. a has-text has a text called description.), Inform says no:

this is a kind of value which is not allowed to have properties of its own, because this would be impossible to store in any sensible way.

Maybe I should go back to the table?

Edit: Maybe it’s because the booknumber has an example that specifies it and it won’t allow any more things to be stuck to it?

1 Like

Light dawns. Specified kinds of value can’t have properties. They can be in relations, though.


weight is a kind of value.
9# specifies a weight.

foo relates one text to one weight.
the verb to describe means the foo relation.

14# is described by "one stone".

describing is an action applying to one weight.
understand "describe [weight]" as describing.

carry out describing:
  if a text relates to the weight understood by the foo relation,
      say the text that relates to the weight understood by the foo relation;
   else say the weight understood.

test me with "describe 5# / describe 14#"

This works in both 9.3/6M62 and 10.1, but 10.1 fixes a bunch of relation bugs that 9.3/6M62 had, so I wouldn’t be shocked if you came across one.

2 Likes

I had a feeling this was going to end up with relations…

1 Like

Oh, hell no. This just gets worse by the second. I’m going to sleep on it and decide whether to shelve this game or completely rethink its structure.

Thanks for the efforts, but writing this has become extremely unfun and I wish I’d never started it.

1 Like

Just change

(wearorder minus newvalue minus 1)

to

(wearorder minus 1)

and it should be in ascending order. You’ll also need to replace the 1 with +/- 7/8/9 so that he fudge works like last time.

Hope this helps.

1 Like

Urk. Do not deprive us of one of your games.

2 Likes

I had a couple of good ideas. No relation, not even a specified kind of value. One somewhat complicated after reading a command rule.

lab is a room.

a citation is a kind of thing.
a citation can be fake.
a citation has a text called the memory.
fake-citation is a fake citation.
E-17-5 is a citation. description is "al-azif". memory is "mind-shattering".
B-29-33 is a citation. description is "da bomb.". memory is "explosive".
understand "examine [any citation]" as examining.

To say dashless (c - citation): let t be the substituted form of "[c]";
  replace the regular expression "-" in t with " ";
  say t;

first carry out examining the fake-citation:
  say "There is nothing of interest there.";
  stop the action;

recollections is a list of citations variable.

carry out examining a citation (called cite):
  if cite is not listed in recollections, add cite at entry 1 in recollections.

pondering is an action applying to nothing.
understand "ponder" as pondering.

check pondering when recollections is empty: instead say "You haven't found anything yet.".

carry out pondering:
  repeat with c running through recollections begin;
    say "[dashless c]: [memory of c].";
  end repeat;

after reading a command:
  let t be the substituted form of "[the player's command]" in lower case;
  if t matches the regular expression "(<a-e>)\s+(\d+)\s+(\d+)" begin;
   let sub1 be the text matching subexpression 1 in upper case;
   let sub2 be the text matching subexpression 2;
   let sub3 be the text matching subexpression 3;
   let cite be the substituted form of "[sub1]-[sub2]-[sub3]";
	let found be the fake-citation;
   repeat with c running through the citations begin;
      if "[c]" is cite begin;
        now found is c;
        break;
       end if;
    end repeat;
    if found is the fake-citation, replace the regular expression "<a-e>\s+\d+\s+\d+" in t with "fake-citation"; 
    else replace the regular expression "<a-e>\s+\d+\s+\d+" in t with "[sub1 in lower case]-[sub2]-[sub3]";
    change the text of the player's command to t;
 end if;

test me with "x a 45 22 / ponder / x b 29 33 / ponder / x c 3 4 / x e 17 5 / ponder"
1 Like

Thank you so much for all your help. I just can’t get it working. I’ve spent hours fiddling with every variable in this and it just isn’t happening. My code is way too huge, with pieces of this scattered everywhere, to even try posting any of it. C’est la vie.

It’s just too complex. Maybe tomorrow I’ll see if I can figure out how to rewrite all of this and spread all the code out appropriately to the many, many places that control unlocking a memory, but looking through it, I kind of doubt I can figure that out, and I’m honestly not sure if this game is worth it. It’s not amazing. It was mostly an exercise in tracking information, but it turns out I loathe tracking information and it’s not a fun exercise.