Pairing Combinable Objects

In inventory listings or something? Try to post a reduced example of the code that gives you the problem and explain what you want. This can be a tricky problem.

Hmmm, I seem to be having more problems with this variable. Here you go:

[code]A thing can be toxic tested or toxic NOT tested. A thing is usually toxic NOT tested.

A thing can be DEADLY poisonous, VERY poisonous, poisonous, Poison Tainted, or NotPoisonous. A thing is usually NotPoisonous.

A thing can be alcoholic, slightly alcoholic, or NoAlcohol. A thing is usually NoAlcohol.

Poison Visible is a truth state that varies. Poison Visible is false. [This is a global switch for the scriptwriter]

After printing the name of a thing that is poisonous:
If the thing is toxic tested or Poison Visible is true:
say " (POISON)";
Otherwise:
say “”.

After printing the plural name of a thing that is poisonous:
If the thing is toxic tested or Poison Visible is true:
say " (POISON)";
Otherwise:
say “”.

Wizard shop is a room. Crab Nut is a kind of thing. There are 5 Crab Nuts in Wizard shop. Crab Nuts are poisonous.

There is a Crab Nut in Wizard Shop. It is NotPoisonous.
[/code]

I seem to have two problems with this script. The first is that the items still stack together despite the different variables. The items themselves keep the variables, but only the topmost item on the stack prints its poison value.

Second, for some reason, if I set one thing to as ‘toxic tested’ EVERY single item in the game gets set to ‘toxic tested’. I can’t work out why as I’m not doing anything unusual or saying that every item should be tested. All I’m saying is “now the noun” and “now the thing”. :stuck_out_tongue: I hope you can help as I am just finalising the script for submission. Try compiling the script above, and then add this to the bottom to see what I mean:

Bad Berrys are a thing in Wizard shop. They are poisonous. They are toxic tested.

This is a common pitfall. What’s wrong is that these lines don’t do what you think they’re doing:

[code]If the thing is toxic tested or Poison Visible is true:

If the thing is toxic tested or Poison Visible is true:[/code]

Inform doesn’t know when you say “the thing” you mean “the thing I was just talking about.” So it interprets “the thing” as “a thing”… which means you’ve effectively got

If a thing is toxic tested or Poison Visible is true

which becomes true as soon as you set one thing to toxic tested. Try setting a temporary variable in the phrase header:

After printing the name of a poisonous thing (called the toxin): If the toxin is toxic tested or Poison Visible is true: say " (POISON)"; Otherwise: say "".

(By the way you don’t need the “otherwise” and it’s possible that I might mess some stuff up.)

As for the stacking question: Hyearrahagh. That’s difficult.

Thanks, that’s solved it. I guess I’ll just need to release the thing and see if anyone else can add anything. By the way, do you have any ideas how I might be able to overrule Inform’s built in restriction on publishing commands that start with ‘test’ as I want to use the word for my poison checker script. :stuck_out_tongue:

Hey guys, I’m struggling with some phrasing and creating definitions isn’t helping. Can anyone think of a way to say this:

If the player carries a Alchemy Vessel with a Poison Level less than 25:

I tried this but it doesn’t work:

[code]Definition: An thing is Good Clean if its Poison Level is less than 25.

If the player carries an Alchemy Vessel that is Good Clean: [/code]

Alchemy Vessel is a kind of thing. Bottle is a kind of Alchemy Vessel.

Try this:

[code]Definition: An thing is Good Clean if its Poison Level is less than 25.

If the player carries a Good Clean Alchemy Vessel:[/code]

Thanks a lot! That works now, but I’m still having problems with the flasks that aren’t clean. I tried to mirror what you wrote for the toxic ones but Inform just doesn’t seem to accept the definition. Can you think of a way to get this to trigger as well?

[code]

Definition: An thing is DEADLY poisonous if its Poison Level is greater than VERY Poisonous Rating.

if the player carries a DEADLY poisonous Alchemy Vessel:[/code]

It looks like poison level is a number but very poisonous rating isn’t. Very poisonous rating would need to be a number for that to work–either you just write “greater than 50” or you could define very poisonous rating as a number that varies or maybe write a phrase “To decide which number is very poisonous rating” if you need something more complicated.

Sorry, I should have explained a bit more. Basically Poison Level is a number attached to an object and ‘DEADLY poisonous’ is a rating the game-maker can customise to fit their game by changing it ‘when play begins’. Here are the default values:

DEADLY Poisonous Rating is a number that varies. The DEADLY Poisonous Rating is 100. VERY Poisonous Rating is a number that varies. The VERY Poisonous Rating is 75. Poisonous Rating is a number that varies. The Poisonous Rating is 50. Fairly Toxic Rating is a number that varies. The Fairly Toxic Rating is 25. Tainted Rating is a number that varies. The Tainted Rating is 10.

Each one is meant to set the minimum level of the one above it. Like so:

[code]Definition: An thing is Good Clean if its Poison Level is less than Tainted Rating. [this one is the only one that works]

Definition: An thing is Poison Tainted if its Poison Level is greater than Tainted Rating and its Poison Level is less than Fairly Toxic Rating.

Definition: A thing is Poisonous if its Poison Level is greater than Fairly Toxic Rating and its Poison Level is less than Poisonous Rating.

Definition: A thing is VERY poisonous if its Poison Level is greater than Poisonous Rating and its Poison Level is less than VERY Poisonous Rating.

Definition: An thing is DEADLY poisonous if its Poison Level is greater than VERY Poisonous Rating.[/code]

The thing I really want to say is “if the Poison Tainted of a thing is a number between Tainted Rating and Fairly Toxic Rating, it is Poison Tainted”

I think what’s probably happening is that, if you have a Poison Level that’s exactly at the Tainted Rating (or any of the other ratings), none of the definitions comes out true. It’s not Good Clean because its poison level isn’t less than Tainted Rating… and it’s not Poison Tainted because its poison level isn’t greater than Tainted Rating, either! Change all your "greater than"s to “at least” and see if that solves the problem.

By the way, if you want to write the “between” phrase you can define it yourself:

To decide whether (x - a number) is between (y - a number) and (z - a number): if x < z and x > y, yes; no.

though since this defines an exclusive between if you wanted to use this you’d have to say “if its poison level is between Tainted Rating minus 1 and Fairly Toxic Rating,” or else you’ll run into the same problem when you have something that’s exactly at one of the rating levels.

Thanks! That did it, it’s totally fixed, just sent it in to be checked and uploaded. Thanks a lot Matt, I couldn’t have made this thing without your help.

Oh dear. I’ve just come up with a problem caused by using Dynamic Objects. Here is what the extension says:

As far as I can see, a game maker can get round this by adding a hundred objects of each kind to the Hyperspace Chest, but at the moment that is the only fix I can see that is possible. Can anyone think of a way round this that doesn’t involve re-writing Dynamic Objects?

Aren’t the alchemical relations you’re using various-to-various? It seems to me as though “preserving relations” should accomplish what you want. Or is the problem that you only want to preserve some relations and not others?

Note that it’s conceptually necessary to have the restriction to the “various” side. If you have a one-to-various relation, like say one person owns various dogs, and you clone the person, the new clone can’t also own the various dogs, because then it won’t be a one-to-various relation anymore.

(But it’s not actually a terrible idea to tell the author to stick as many of those things as they need in the Hyperspace Chest, and to have a cap on the number of objects of each kind they can create–probably below 100. If you’re creating hundreds of objects dynamically I think it’s going to give you a really big hit on performance.)

If the player goes and creates a hundred bottles of salt water, it’s very likely that they’re bored, frustrated, and not doing anything useful in the context of the game.

That being the case, you might as well stop them at the tenth. (Or even the second, as I did in Hadean Lands.)

Oh damn, I forgot - it is various things to various things. I think I just panicked there when I saw that as I actually didn’t add “, preserving relations;” to it as I didn’t realise. Turns out the only relationship like that is the one that operates the hopper mechanism on the machine script. I will get the new fixed script sent in right away, just in case.