Jump to content
Sign in to follow this  
jwllorens

Can remoteExecCall be used to execute unscheduled code on local machine?

Recommended Posts

I have many scripts that get, alter, and set missionNameSpace variables with getVariable and setVariable.  These variables are local to the server and are accessed dynamically by constructing the variable name for the setVariable and getVariable parameter.  Each variable represents an array with data that I need regarding a specific location, and this data is quite varied and represents different attributes of the location based on the state of the game, so I use different scripts to get the entire array, set an element, and then re-set the variable so all the other elements not pertaining to the particular script are unchanged.

 

The problem is that while I can do all the operations to determine the data that I need to set an element in the array to inside a scheduled environment, and I usually want to, I need to make sure that the "getting" and "setting" of the variable occurs back to back in the engine.

 

Otherwise, I could run into this problem:  

1) Script A gets global variable V and stores it as local variable _vA.  

2) Script A adjusts element 0 in variable _vA.

3) Script B gets global variable V and stores it as local variable _vB.  

4) Script B adjusts element 1 in variable _vB.

5) Script B sets global variable V to = _vB.

6) Script A sets global variable V to = _vA.

 

Global variable V now does not reflect changes made by script B at index 1.  There are several other ways this could play out in a scheduled environment if one thread GETS the global variable in between the GETTING and SETTING of the same variable in another thread, where basically the changes made by one script to the global variable are reverted back because another script retrieved the contents of the variable before it was changed.

 

I believe I can circumvent this by executing the the getting, adjusting (but not the computations to determine the adjustment), and setting of the global variable in an unscheduled environment to ensure that all three operations happen back to back before the same three operations in another script occur.

 

 

 

So, can I do ["param1","param2"] remoteExecCall ["myFunction",2,false]; on the server to execute a bit of code in an unscheduled environment from a scheduled one?

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  

×