script communication

Typically: "How do I... ", "How can I... " questions
sampits
Posts: 10
Joined: 11 Feb 2020, 11:15

script communication

Ive been working with two script one move a conveyer depending on the proximity sensor state and for that i used the syscall_sensing() function.
Now i want to go there with my robot but i can seem to be able to communicate between the scripts since the sensordetection variable doesnt work outside of the function syscall_sensing or so i think.
Any ideas on how i can call that function on the robot script?

coppelia
Posts: 7597
Joined: 14 Dec 2012, 00:25

Re: script communication

Hello,

you have many different ways to share information between scripts or the outside world. Signals are probably the easiest.

Cheers

sampits
Posts: 10
Joined: 11 Feb 2020, 11:15

Re: script communication

now i have a different problem, when i pass a 0 to the conveyer it runs and when i pass a 1 it stops, even tough it works, when i am in 0 it doesnt change to 1 and when i am in 1 it doesnt change to 0 its weird to explain but what im trying to say is that once it is in a a state it doesnt change to other.(doesnt update the state)
 teste=sim.getFloatSignal("ok") if teste==0 then beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0.05) else if teste==1 then beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0) end end 

sampits
Posts: 10
Joined: 11 Feb 2020, 11:15

Re: script communication

coppelia wrote:
11 Feb 2020, 15:02
Hello,

you have many different ways to share information between scripts or the outside world. Signals are probably the easiest.

Cheers
now i have a different problem, when i pass a 0 to the conveyer it runs and when i pass a 1 it stops, even tough it works, when i am in 0 it doesnt change to 1 and when i am in 1 it doesnt change to 0 its weird to explain but what im trying to say is that once it is in a a state it doesnt change to other.(doesnt update the state)
teste=sim.getFloatSignal("ok") if teste==0 then beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0.05) else if teste==1 then beltVelocity=sim.setFloatSignal("conveyorBeltVelocity",0) end end