This was a question about how to make a command and pass it to another character, but I ran into another more pressing problems…
I can’t seem to write anymore of my parser because Inform is telling me I ran out of temporary variables… (15?)
How is that even a thing?
How did I declare temp variables, they shouldn’t be disposable at all, in fact all of them are important.
Is there some kind of declaration I should be using them to let inform know that they are not temp?
The Z-machine is limited to 15 local variables per function. This is a hard limit and you can’t do anything about it. You could re-declare some of them as global variables ("… a foo that varies"). That’s probably the easiest way to proceed if you really want to maintain Z-machine compatibility. But I don’t think that’s going to be possible, from what you’ve been saying.
In Glulx the compiler defaults to a limit of 32 local variables, but you can increase this by saying “Use MAX_LOCAL_VARIABLES of 64” or whatever.
(If you’re already in Glulx, then something else is going on and we’ll have to investigate further.)
Temporary (i.e. local) variables are variables declared using “let”. As zarf pointed out, global variables are declared using “is” combined with “that varies” if you want them to be mutable (which local variables always are, but globals aren’t without that modifier).
I think there have been multiple discussions of it here (@ intfiction) over the years. But I see that it’s actually a limit of 15 temps, enforced by the I7 compiler regardless of whether you’re compiling to Glulx or Z-code. Here’s the message I just triggered in a Glulx game:
Just be careful with using globals in phrases or rules that call themselves, because they will share them. For recursive code local variables are essential because each phrase gets its own ones and doesn’t share them.
Ok, so I’m going to kill two birds with one stone.
Now that I know a difference, I’m making my variables global that were supposed to be in the first place.
I’m only making indexed text if it actually needs to be indexed
However, it seems that I need to make all my text indexed if I’m going to me placing them in a table, but the examples in the manual say otherwise.
here’s the error:
The Japanese name (Which is now non-temp) is type “text” and the table columns (jname and ename) are also now only text. So I have type agreement, but in needs to be indexed for the system to look though it?
=== EDIT ===
Found it, (I think) as an experiment I made “English name” some text and now I get
So I actually need that indexed as I took it from the player’s command and can’t cast into another type. (demote?)