Using rules outside an action to effect an actor

I’m currently working on an alchemical system which I would like to work by defining effects to certain ingredients, then when the ingredients are consumed, or turned into a potion and then consumed the stored effects of the ingredients or potion would then effect the actor.

Here is an example of what I would like to happen which does not work:

Code
"Alchemy"

Laboratory is a room. 

A person has a number called strength.

An ingredient is a kind of thing. Some kinds of ingredients are defined by the table of alchemy ingredients.

Table of Alchemy Ingredients
Name			Effect
Eye of Newt	Eye of Newt Rule

This is the Eye of Newt Rule:
	increase the strength of the actor by 5.

Instead of jumping:
	follow the Eye of Newt Rule.

It makes sense to me this doesn’t work since the rule has no way of knowing who the actor is however I’m wondering if there is some way to do this where I can communicate who the actor is to the rule once it’s called in the action.

I would prefer to have some sort of design like this as opposed to just creating actions for the consumption of each ingredient and potion so that as I make more ingredients, and thus potion possibilities this system of storing effects doesn’t require me to specify every possible potion. As well I think storing the effects in a table such as having an attribute and value column such as:

Table of Alchemical Ingredients
Name     Attribute    Effect
Eye of Newt  Strength  5

Would not be ideal since if I wanted to have potions which don’t alter attributes but other aspects of an actor such as invisibility potion, that would require more workarounds for different cases.

I’m unsure if there is a good way to do this but I wanted to ask since I’ve been having trouble thinking of a good way to start tackling this problem, thanks in advance for any suggestions or solutions that might help get me on the right track.

So far I haven’t been able to get it to work with a table, but here goes:

"Alchemy"

Laboratory is a room. 

A person has a number called strength.

An ingredient is a kind of thing. [Some kinds of ingredients are defined by the table of alchemy ingredients.] Eye of Newt is an ingredient.

[Table of Alchemy Ingredients
Name	
Eye of Newt	]

effecting something is an activity on ingredients.

For effecting Eye of Newt (this is the Eye of Newt Rule):
	increase the strength of the alchemy target by 5.

Alchemy target is a person that varies;

Instead of jumping:
	now the alchemy target is the player;
	carry out the effecting activity with eye of newt;

Instead of an actor jumping:
	now the alchemy target is the actor;
	carry out the effecting activity with eye of newt;
1 Like

Thanks I’ll give this a try, if you’re on Inform 10 that’s why the table doesn’t work.

Hmm, no I’m on 9.3. Something about the carry out statement doesn’t like the objects defined by a table.

1 Like

Weird, but true: you can refer to the actor globally as the person asked or the person reaching. Or you can define your own synonym.

The executant is an object that varies.
The executant variable translates into I6 as "actor".

You probably want Some ingredients are defined [...] there, unless Eye of Newt is intended to be a subkind and you would be creating things like: The yellow eye is an eye of newt.

1 Like

I want them to be kinds so that the player can get multiple of each ingredient either to make multiple potions, or use one ingredient multiple times in the same potion. Also I’ll try out the I6 synonym. Is the “the person reaching” specific to the taking action, or all non-asking actions? And if so could I also refer to for example the person eating, or the person drinking?

“The person reaching” is a global variable which, for deeply-buried but consistent reasons, means exactly the same thing as “the actor”. Except you can use it in more places.

(There is no “person eating” or “person drinking” variable.)

2 Likes

The correct verb would be affecting, not effecting. I know, this is one of the trickiest bits in the English language, and lots of people get it wrong. I’m not criticizing you! I’m just inserting an editorial correction in the margin.

1 Like

I think the intent here is the verb “effect” meaning “to enact or bring about”, as in “to effect a change”.

1 Like