Issues combining NPC library (Search:player) movement with Mr. Pixie's Zombie Apocalypse

Laraqua
05 Apr 2018, 03:44

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.


K.V.
05 Apr 2018, 04:10

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.


Laraqua
05 Apr 2018, 04:16

Post what script, sorry?


K.V.
05 Apr 2018, 04:19

Post what script, sorry?

No problem.

I'm referring to the script you added to the game which contains that bit of code.

GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."

Laraqua
05 Apr 2018, 04:20

Sorry, I figured out what you meant. Neither the full Error nor the GetDisplayName exists in the full code.


K.V.
05 Apr 2018, 04:23

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.


K.V.
05 Apr 2018, 04:25

This exact line of code exists somewhere: GetDisplayName(npc) + " " + Conjugate(object, "leave") + ", heading " + exit.alias + "."

It's either in your game or in a library. If it's in NpcLib, you do not have the most recent version of NpcLib.


K.V.
05 Apr 2018, 04:27

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>

K.V.
05 Apr 2018, 04:30

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.


Laraqua
05 Apr 2018, 07:31

Ahh, thanks! :)