Am I doing something wrong?

0 favourites
  • 4 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • Ok, so I made this plugin... and today ran into a weird situation that hasn't happened on any other of my projects with this plugin. So I have a trigger that is called, when you perform a certain action. When this trigger from within the action is called, it does, but funny things happen. Here's an example:

    Lets assume a Sprite has an instance bool "hair"

    A Specific Sprite.Hair = True
    MyPlugin.CallFunction       (at this point, my function calls back with "MyPlugin.Trigger"
    [/code:3jfna26x]
    
    [code:3jfna26x]Conditions:
    MyPlugin.Trigger    // it triggers....but.....
        >   Sprite.Hair = True  (grab the only Sprite that has a Bool that = True)
                 > Action:  Perform whatever.[/code:3jfna26x]
    DOESN'T WORK... It doesn't SEE any Sprite.Hair as = true... even though it's there!!! 
    
    Now.... if I leave it as this, it doesn't work.... but only with this one function, no matter how many times I try renaming it, moving it around in edittime, or whatever.   It's very odd... HOWEVER... if I change my conditions to this:
    
    [code:3jfna26x]Conditions:
    MyPlugin.Trigger     ->  Wait [b]0[/b] serconds,  then Call Function "Wierd"
    
    On function "Wierd"
     >    Sprite.Hair = True  (grab the only Sprite that has a Bool that = True)
    
    Action:  Perform whatever.[/code:3jfna26x]
    THAT WORKS????!?!!!!!  WHY?!?!?!  NOW it see's it? Why not earlier?  I don't understand.  Shed some light perhaps?
  • Is it possible that a Boolean takes longer to set than an integer, so that it needs that little bit of extra time to retrieve the information? I'll test that theory tonight... but it honestly makes no sense.

  • because doing a Wait makes it happen at the end of the sheet.

    it has to do with scope and order of when things happen. If you are modifying a sprite's variable, you need to reference it in the same section, or below it if you want it to happen in the same tick, otherwise it won't get updated until the next tick.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Interesting... thanks.... I'll keep that in mind.

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