Am I doing something wrong?

Post your work in progress addons and get feedback

Post » Fri Jan 30, 2015 3:55 am

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"
Code: Select all
A Specific Sprite.Hair = True
MyPlugin.CallFunction       (at this point, my function calls back with "MyPlugin.Trigger"


Code: Select all
Conditions:
MyPlugin.Trigger    // it triggers....but.....
    >   Sprite.Hair = True  (grab the only Sprite that has a Bool that = True)
             > Action:  Perform whatever.

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: Select all
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.

THAT WORKS????!?!!!!! WHY?!?!?! NOW it see's it? Why not earlier? I don't understand. Shed some light perhaps?
B
47
S
15
G
3
Posts: 201
Reputation: 4,625

Post » Fri Jan 30, 2015 1:39 pm

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.
B
47
S
15
G
3
Posts: 201
Reputation: 4,625

Post » Sat Jan 31, 2015 11:53 pm

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.
B
103
S
35
G
16
Posts: 1,244
Reputation: 17,240

Post » Sun Feb 01, 2015 7:18 pm

Interesting... thanks.... I'll keep that in mind. :)
B
47
S
15
G
3
Posts: 201
Reputation: 4,625


Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests