This is my first post here. I’m a long time programmer and IF player who’s just starting to learn Inform 7. At times it can be incredibly frustrating compared to other languages and IDEs but it also SO MUCH FUN. I’ve been stuck on this issue for a week. I’ve thrown all my debugging techniques at it but to no avail.
I successfully used action variables with entering and exiting and taking. When I extend the exact same technique for inserting and giving it throws a runtime error that makes no sense to me.
[i]>[3] put rock in bucket
*** Run-time problem P10: Since Rock is not allowed the property “test_variable”, it is against the rules to try to use it.
[/i]
For some reason the setting code doesn’t see that the variable exists. If I create a global variable with the same name, things work. This tells me it’s some kind of scoping problem, like the action variable isn’t getting created in the correct rulebook or something…
Here’s the sample story to demonstrate the problem:
Example Location is a room.
North room is north of example location.
Rock is a thing in Example Location.
Bucket is a enterable container in Example Location.
[THIS DOES WORK]
The exiting action has a container called thing exited.
Setting action variables for exiting:
now thing exited is the holder of the actor.
Report exiting when thing exited is the bucket:
say “you just left [thing exited].”
[THIS DOESN’T WORK]
The inserting into action has some text called test_variable.
Setting action variables for inserting into:
now test_variable is “testing”.
report inserting into when test_variable is “testing”:
say “here”.
Test me with “enter bucket / exit / put rock in bucket”.