Jump to content
Sign in to follow this  
profcupcake

Generic Error in expression, no idea the cause

Recommended Posts

So this is annoying me, and I've decided to see if anyone else has any ideas about this.

The following line is throwing "generic error in expression"...

waitUntil {!isNil {_this getVariable "CUPMOVE_recordedArray"}};

I have looked over everything I could think that would be relevant to it, and come up with nothing. As far as I can see, this code should be working, but it throws "generic error" when it runs.

Does anyone know what could be up here?

Share this post


Link to post
Share on other sites

There's nothing wrong with your syntax there.

Tested in debug editor:

0 = player spawn {waitUntil {!isNil {_this getVariable "CUPMOVE_recordedArray"}}}

runs fine.

I would say the error is _this

What is _this? What are you feeding into this line of code?

Share this post


Link to post
Share on other sites

_this is a unit, which in this context will have been taken from an array and passed to the function by an earlier function.

At the start of the mission, these arrays are constructed by adding all of the units to the relevant arrays.

It's a messy workaround for the fact that units are switched to different sides after certain events (death, friendly fire, etc.).

Share this post


Link to post
Share on other sites

Cool, well without seeing it though I couldn't guess as to what's wrong.

I'd start my search there though (in the array the unit is selected from).

Share this post


Link to post
Share on other sites

I believe this error comes from trying to use waitUntil in an unscheduled environment. I seem to remember this issue causing the "generic" error. Try using spawn

Share this post


Link to post
Share on other sites
I believe this error comes from trying to use waitUntil in an unscheduled environment. I seem to remember this issue causing the "generic" error. Try using spawn

So does the engine refuse from executing waitUntil command in unscheduled environment essentially to prevent it from falling into deadlock? (My apologies for hijacking the thread :p)

Share this post


Link to post
Share on other sites

That's correct. I think the term is "suspension not allowed in this context" or "suspension not allowed in unscheduled environment".

I've definitely seen it in the rpt before.

EDIT:

This bit of code in the debug window can trip the error:

player addEventHandler ["fired", {waitUntil {1>2}}];

Generates:

22:19:37 Suspending not allowed in this context
22:19:37 Error in expression <waitUntil {1>2}>
22:19:37   Error position: <>2}>
22:19:37   Error Generic error in expression

Don't forget to fire your gun!

Edited by Das Attorney

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×