how to get a variable from an Non-threaded child script to Threaded child script

Typically: "How do I... ", "How can I... " questions
Post Reply
Darkb1ue
Posts: 1
Joined: 28 Jul 2022, 08:57

how to get a variable from an Non-threaded child script to Threaded child script

Post by Darkb1ue »

Hello,

I need to get a Self-defined variable to make some conditional judgments in a Threaded child script. The promble is that the variable is in a Non-threaded child script. How can I get the variable between these two child script?

Sincerely,
Darkb1ue

fferri
Posts: 1217
Joined: 09 Sep 2013, 19:28

Re: how to get a variable from an Non-threaded child script to Threaded child script

Post by fferri »

There are many possibilities:
  • you can set a signal in one script (e.g. with sim.setStringSignal, and other signal functions) in one script, and read (or wait for) the signal value in the other thread (sim.getStringSignal, etc...)
  • you can write data to a custom data block (sim.writeCustomDataBlock) to read it from another script
  • you can use sim.callScriptFunction to call the function of another script
  • you can use sim.broadcastMsg to send an event that can be delivered to the sysCall_msg callback
  • other ways mentioned in Messaging/interfaces/connectivity

Post Reply