Error recognizing object (Scope issue?)

xordevoreaux
Below, I've added an ASK event, moving such things as object1.lightsource = false inside of the ASK event.
When I had those SET commands outside of the ASK event, everything was fine. I move them into the ASK event, and now they're not recognized.
Did I break scope? I would have thought anything defined or passed to one element would be recognizable by whatever is contained by that element.

I've attached the game. There is only one walkthrough. If you run that walkthrough, and answer Yes, it bugs out, and I've stripped out all my debugging comments, but it's raising an error on object1.lightsource = false, not getting any further than that.


jaynabonne
The problem is that Quest doesn't have closures as such - that is, by the time the inner script is called by Ask, all the local variable in your main script are dead and gone. The only way I know to pass information through to the called script is to save the desired values as attributes of a global object (e.g. the game object, player object, current room, etc) and then reference those stable attributes in your nested script.

(Ask if any of that isn't clear.)

xordevoreaux
I think I understand, but geez...
Thanks again.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums