Question about Wait/Signal

From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • Hello! I'm having trouble understanding this interaction between Wait for Signal and Wait X Seconds.

    I'm trying to send one signal per second using "Wait 1 second", but it sends 60 signals per second instead.

    I'm likely overlooking something obvious - any insight is appreciated!

  • Because you have no conditions on the left you're saying to add 1 to seconds 'every tick' which yes is about 60 times a second. Even though you are waiting for 1 second you are running it 60 times a second. You probably want to use every 1 seconds on the left and then call the signal action on the right.

  • But shouldn't all the code under "wait for signal" only happen once the signal happens?

    To me, this code says:

    -At the start of the layout, wait one second, then send the signal.

    -Whenever there's a signal, add one to the variable, display the variable, then wait one second and send the signal again.

    So the variable should only be updated once per second, because the signal only appears once every second.

  • No you are waiting 1 second, then sending the signal 'every tick'(the last action), in your mind it is sending the signal once but you never asked it to do that because you didn't define any condition on the left. I don't think this is the best use of wait for signal. It should be every 1 seconds - send signal.

  • First - I really appreciate your help with this!

    I realize a big part of my problem is "Wait for signal" logically should be a condition (e.g. "On signal [tag]"), but it's an action.

    I see what you mean about conditions. But why does the signal get sent every tick? I asked the program to wait 1 second, then send 1 signal. Why are 60 signals sent?

    I've reduced the CAPX down to this simple form to demonstrate the question:

  • I don't know how many other ways there are to explain this. Wait for signal is commonly used in a list of actions, so you have already run the event and in the middle of the event you stop and wait until you get the signal from elsewhere, then you continue with the current event. What you have here is an 'every tick' event that is waiting for a signal before it runs. Then it runs every tick. In my opinion it's being used in the wrong way and doesn't need to be like that.

  • By that logic, wouldn't the signal event just run forever? If it's every tick, why stop after 1 second?

    I think we're focusing on the wrong part of this. I'm not worried about the signal part - it's the wait command that seems to be causing problems.

    The CAPX says, "On the start of this layout, wait 1 second, send a signal."

    Every other Construct command in a "Start of layout" trigger runs only once. I updated the CAPX to show that.

    But for whatever reason, in this CAPX, sending a signal after a wait command runs X times - sending X signals - where X is the amount of ticks we waited before the send action.

    Don't you think that's weird?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It is running forever but queuing on the wait. So it's doing this : send the signal every tick so 60 times > wait 1 second > send the signal every tick so 60 times

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)