So I have an occasional issue in a stairwell where I get the following set of errors. It looks like the crying man is trying to enter the room but failing? I do have a locked door in the stairwell, so perhaps that's the source of it?
Turn 1: I enter a room and the following happens:
You side-step crying man with an axe's strike.
Error running script: Error compiling expression 'GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."': Unknown object or variable 'object'
I performed another random action to see what happened.
Crying man with an axe shambles into the area.
Error running script: Error compiling expression 'GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."': Unknown object or variable 'object'
attack crying (I tried to attack the Zed)
I can't see that.
Crying man with an axe shambles into the area.
Error running script: Error compiling expression 'GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."': Unknown object or variable 'object'
attack man
I can't see that.
A crying man with an axe enters the room.
Finally he is actually in the room and the Error ends.
Any idea what the trouble may be? I can post up the code of various aspects if there's a section you'd like to look at.
Hello.
Find this code in your game:
GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."
Then post that script here.
In order for this line of code to work correctly, this script must include three local variables: npc
, object
, and exit
.
It appears that npc
exists, since the script makes it past that to object
, which does not exist, hence an error is thrown.
Sorry, I figured out what you meant. Neither the full Error nor the GetDisplayName exists in the full code.
This is your error:
Error running script: Error compiling expression 'GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."': Unknown object or variable 'object'
Let's break it down.
Error running script:
Error compiling expression 'GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."' :
Unknown object or variable 'object'
The problem is object
is in this part of that code: Conjugate(object, "leave")
, but the object
variable has not been declared in the script.
It's like trying to tell a puppy to fetch a ball before teaching the puppy what a ball is.
That looks remarkably similar to this function, which begins on line 249 of NpcLib.aslx:
<function name="NpcLeaving" parameters="npc, exit" type="boolean">
msg(CapFirst(GetDisplayName(npc)) + " " + Conjugate(npc, "leave") + ", heading " + NiceDirection(exit, false) + ".")
</function>
Ah!
You didn't add that! (Sorry!)
It's in an old version of NpcLib.
Get this NpcLib.aslx, replace the file in your game folder with it, reload your game, and I bet that fixes it.