Error question
miepmiep
03 Nov 2014, 09:32Hi there,
I have question, about an error I get, that I don't understand.
My game is in Dutch, so that might complicate things a little bit, but the programming ofcourse is still the same.
The problem arises at the start of the game in the first 'real' room, where the player can move around.
There is only one way out: backwards (achteruit). If any other way is tried, the game will say "Je kan hier niet heen gaan" (you can't go that way).
However, after the player has looked under the chair (kijk onder stoel), the game suddenly gives an error if the player types in the abbrevation for steerboard (stuurboord) namely: "s". It than gives "Error running script: Error compling expression 'exit.locked'. RootExpressionElement: Cannot convert type 'Object' to expression result of 'Boolean'".
After typing in some other commands, "s" suddenly works again like it should.
I do not know how to change this and can't figure out where it comes from. Any ideas?
I include a file of the entire game, with a walkthrough. (It is a large file, that wasn't accepted, so I had to zip it, and somehow you have to include the library that is deliverde to you in the same zipfile...).
I have question, about an error I get, that I don't understand.
My game is in Dutch, so that might complicate things a little bit, but the programming ofcourse is still the same.
The problem arises at the start of the game in the first 'real' room, where the player can move around.
There is only one way out: backwards (achteruit). If any other way is tried, the game will say "Je kan hier niet heen gaan" (you can't go that way).
However, after the player has looked under the chair (kijk onder stoel), the game suddenly gives an error if the player types in the abbrevation for steerboard (stuurboord) namely: "s". It than gives "Error running script: Error compling expression 'exit.locked'. RootExpressionElement: Cannot convert type 'Object' to expression result of 'Boolean'".
After typing in some other commands, "s" suddenly works again like it should.
I do not know how to change this and can't figure out where it comes from. Any ideas?
I include a file of the entire game, with a walkthrough. (It is a large file, that wasn't accepted, so I had to zip it, and somehow you have to include the library that is deliverde to you in the same zipfile...).
The Pixie
03 Nov 2014, 09:52Can you give us stardir.aslx and wearables.aslx too? it does not work with out them.
I had a quick look though the code, and just got confused! What is the name of the first real name. Also, where in the game do you set "s" as meaning stuurboord? I saw several exits that use stuurboord, but did not spot anywhere that linked that to "s".
ETA: Thinking about it, that is probably in stardir.aslx!
I had a quick look though the code, and just got confused! What is the name of the first real name. Also, where in the game do you set "s" as meaning stuurboord? I saw several exits that use stuurboord, but did not spot anywhere that linked that to "s".
ETA: Thinking about it, that is probably in stardir.aslx!

jaynabonne
03 Nov 2014, 18:46Well a clue but no answer...
Looking through the core code, I only see two places where exit.locked is checked, one in the "lookdir" command (which is not happening here) and the other in the "go" command. That command starts out like this:
Given that it failed on the "locked" line, it seemed to be getting past the "visible" check just fine, which implied *some* object was being used. So I put in an msg to see what "exit" was - and it turned out to be "stoel"! For some reason, just referencing "stoel" in any way causes some bad bit of state to get set. (I even commented out the code that made "rood steentje" visible, and it still occurred.) As soon as you interact with some other object, then the problem goes away. I don't know why yet. It's either accidental, or Quest is remembering the last object used for some short-cut purpose which is kicking in ahead of the normal exit location code.
I'll keep looking. I'm sure there's an explanation for it. And hopefully a fix.
Looking through the core code, I only see two places where exit.locked is checked, one in the "lookdir" command (which is not happening here) and the other in the "go" command. That command starts out like this:
<command name="go" pattern="[go]" unresolved="[UnresolvedLocation]">
if (exit.visible) {
if (exit.locked) {
msg (exit.lockmessage)
}
Given that it failed on the "locked" line, it seemed to be getting past the "visible" check just fine, which implied *some* object was being used. So I put in an msg to see what "exit" was - and it turned out to be "stoel"! For some reason, just referencing "stoel" in any way causes some bad bit of state to get set. (I even commented out the code that made "rood steentje" visible, and it still occurred.) As soon as you interact with some other object, then the problem goes away. I don't know why yet. It's either accidental, or Quest is remembering the last object used for some short-cut purpose which is kicking in ahead of the normal exit location code.
I'll keep looking. I'm sure there's an explanation for it. And hopefully a fix.

jaynabonne
03 Nov 2014, 19:00Another clue: if you remove the "gender" and "article" fields, it no longer happens. I do see new code dealing with "lastobjects" in CoreParser.aslx which is referencing those fields for some reason... Unfortunately, it seems to be doing partial matches instead of full-on ones.
I can make the same problem happen with the following object:
If you add that object into a game, after you "x apple", then "s" will give the exit error.
I can make the same problem happen with the following object:
<object name="apple">
<inherit name="editor_object" />
<gender>she</gender>
</object>
If you add that object into a game, after you "x apple", then "s" will give the exit error.

jaynabonne
03 Nov 2014, 19:21Ok, a quick workaround... add this turnscript to your game:
It just nulls out game.lastobjects after each turn.
<turnscript name="LastObjectFixer">
<enabled />
<script>
game.lastobjects = null
</script>
</turnscript>
It just nulls out game.lastobjects after each turn.
miepmiep
04 Nov 2014, 23:06Wow, thanks a lot for your quick answer and fix!
It works perfectly.
It's really great how fast people get help around here.
I hope one day I can help out someone else
.
It works perfectly.
It's really great how fast people get help around here.
I hope one day I can help out someone else
