[i7] Action for change the value of any named number to a new number?

In Inform7 an action can’t be about two variables, which is a pain as that’s what I want an action to be. Specifically, I’m trying to write a general purpose action that allows (let’s say for testing purposes) the player to set a variable to whatever number they want.

Obviously the following doesn’t work:

Adjusting is an action applying to two numbers. Understand “change [number] by [number]” as adjusting.

Carry out adjusting:
now the number is the second number.

But am I missing a way of making such an action?

1 Like

That doesn’t seem well defined to me. Consider the following:

What would that then mean, semantically? Is it a redefinition of mathematics?

If, however, you want to permit

then you could represent each exposed variable as either objects or understand tokens.

Sorry I could have been more clearer than ‘named number’. I meant only the latter case. Being able to give your foos, bars etc. new numerical variables on the fly.

I’m aware that I could literally create an object corresponding to every variable in the game, but that seems like as much work as creating a custom action for every variable in the game. Is there a more scaleable way of doing this?

Hmm. I suppose you could put the variables in a table and then have the names of variables as one column and understand by that.

You can do something like this, though with numerical values rather than boolean ones: if you set it up right, you can just say “foo is a numerical option” instead of “foo is a number that varies” and “the value of foo” instead of “foo”, which isn’t much more work.

2 Likes