Jump to content

[Resolved] Random unexpected script failure with Traders (AI_SLOT)


He-Man

Recommended Posts

Hi,

I have noticed a random error while interaction with the Traders.

The Message is:

Spoiler

Error in expression <ursorTarget getVariable['AI_SLOT', -1]) != -1))} else {false};>
 0:41:53   Error position: <!= -1))} else {false};>
 0:41:53   Error Allgemeiner Fehler in Ausdruck

I also got this message on a self written script, that checks all Trader inventory.

Anybody an Idea, why  ... getVariable['AI_SLOT', -1]) != -1... sometimes give an Error?

It happens only on some Traders and not every restart the same Trader!.

If I check the AI_Slot by hand (with console), it push me back a valid value.

 

For my own script, I have fixed it by checking the variable AI_Items.

But I'm wondering about this problem...

Link to comment
Share on other sites

Error Allgemeiner Fehler in Ausdruck
Error General error in expression

This is usually caused by a type mismatch. For example if you use

(cursorTarget getVariable['AI_SLOT', -1]) != -1

and if AI_SLOT returns a string at any point you would get this error since you are checking against a number -1. The easy way to prevent the error would be to use isEqualTo 

!((cursorTarget getVariable['AI_SLOT', -1]) isEqualTo -1)

But then again it may not be intended that you are mixing strings and numbers for the AI_SLOT variable so you might want to check that also.

Link to comment
Share on other sites

Okay thanks, but I never set the AI_Slot in my Scripts. I only read the slot out.

It must come from the Epoch codes.

And you are right. The Trader with the "problem" returns "16" and another Trader returns 5 (without the "").

 

I have checked the Epoch codes for AI_SLOT, but can find nothing, that can cause this :(

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...