Emitsignal Not Working

Discussion in 'Buildbox 3.0' started by Steddyman, Sep 5, 2018.

Tags:
  1. Steddyman

    Steddyman Boxer

    Joined:
    Sep 3, 2018
    Messages:
    51
    Likes Received:
    29
    I've got an odd issue with a script I have written. It is designed to detect if the colour of the object you collide with matching the object the script is attached to. In the following screenshot you will see that in Colour Match script I output a Yes or No signal if the colour matches. In the code if I place log statements underneath the two emitSignal commands reporting if there is a match or not, that is output as expected with a match or no match.

    [​IMG]

    However, if I link these signals to another Script object which has a static log statement in, these are never output.

    [​IMG]

    I can't understand what is happening here. I thought perhaps emitSignal does not work from inside the Signal function, but I can see examples of this being done in the Draw example so it is supported.

    Any ideas? What is Buildbox support like? My experience so far isn't good.
     
  2. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @Steddyman I think you can't get in Logger's Signal Method. Because Logger script won't be initiated until Yes value sent. This can be caught only by existing running script.
     
  3. Steddyman

    Steddyman Boxer

    Joined:
    Sep 3, 2018
    Messages:
    51
    Likes Received:
    29
    Thanks for your response but I am sorry, I don't understand that. The Logger component is one I have written as you can see in the second screenshot.

    My understanding of Signal is it is fired when the linked node emits a signal using emitSignal. When that happens the Signal function on the target object is called. Is that not the case?
     
  4. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @Steddyman Sorry man. I am wrong. The issue you raised is valid. Just saw the scripting video. Even script node is not connected its instance is initiated.
     
  5. Steddyman

    Steddyman Boxer

    Joined:
    Sep 3, 2018
    Messages:
    51
    Likes Received:
    29
    Thanks Particles. I found the issue!

    It appears your custom script must have all three functions, an init, update and signal function, even if their definition is empty.

    I tried replacing my logger with an Add Point node and it worked. I then experimented with my code until I found the answer. Cool, I can carry on now.
     
  6. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    Oh Got it. That is pointed in the script video too. I thought it is not mandatory.
     
    Steddyman likes this.

Share This Page