I don’t think Inform 7 makes the distinction between “global” and “local” variables the way some systems do - specifically sometimes you want a global variable for the player’s strength or the amount of money they carry, and a local or temporary variable for, say a dice roll.
The only major difference is you don’t need to declare temporary variables ahead of time; it’s done inside a rule or declaration.
To count possessions:
let T be the number of things enclosed by the player;
say "You're carrying a total of [T in words] thing[if T is greater than one]s[end if] things.";
Report taking inventory: count possessions.
I don’t believe you can then reference “T” later because it’s only set when you evoke “count possessions” and always needs to be set during that process.
A “repeat running through” also sets a temporary variable:
Repeat with item running through wet metal things held by the player:
now item is rusty.
Don’t confuse adjectives/properties with variables - an adjective/property is usually an “is or is not” property and isn’t really variable:
A thing can be wet.
A thing can be metal.
A thing can be rusty.
In most systems variables can be boolean (true/false/null), a number, or a string. Inform allows you to specify what kind a variable can be.
Strength is a number that varies.
The suspect is a person that varies.
The leaky vessel is a container that varies.
The correct way is a direction that varies.
4:12 Values that Vary
The tricky one for me is when you want to name your own valued properties that a thing can have.
Brightness is a kind of value. The brightnesses are guttering, weak, radiant and blazing.
The lantern has a brightness. The lantern is blazing.
4:9 Using new kinds of value in properties
[Sees @zarf replying and anticipates learning what parts I got wrong
]