[PLUGIN] rex_Function2

Post your completed addons to share with the community

Post » Wed Feb 22, 2012 9:56 pm

Great, hopefully it gets fixed
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Fri Feb 24, 2012 9:49 am

Update:

Fix bug about nested call.



@Geo

Ashley help me to figure that it's a plugin bug, thanks him.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Fri Feb 24, 2012 10:44 am

Super! Thanks @rexrainbow and @Ashley!
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Tue Mar 20, 2012 3:31 pm

Update:

Add version to 1.0.
Thanks for download this plugin.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Thu Mar 29, 2012 11:28 am

hi Rex

I'm not sure if I'm doing something stupid, but I guess I've stumbled upon a problem.

I was having a problem using functions on a included event sheet.
Only the first layout had the function working.
After trying some things, I noticed the Function object appeared on the "layout 1" object list - and not on the others.

If I remember correctly, the Function plugin used to work like the Mouse plugin, where you add it and it stays above all layouts, not even appearing on the layout's object list.
I tried changing it to global (another option that's different from Mouse/Touch/etc), but that didn't work. And I couldn't copy & paste it to the other layouts.

Am I doing something wrong, or is this a bug from the plugin?
Thanks a lot for your time, the Function plugin is awesome!

I made an example for you:
http://dl.dropbox.com/u/7324985/function_problem.capxgammabeam2012-03-29 11:29:07
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Thu Mar 29, 2012 12:08 pm

@gammabeam

Sorry, function plugin is not like Mouse plugin. Function plugin will be destroyed when leave layout.
You could set "Global" to "Yes" (in your test capx) to keep it alive.

Hum... it seems many users will be confused.

The advantage of non-global function is, user can use different function plugin to avoid name collision.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Thu Mar 29, 2012 12:54 pm

Hmmm I may have changed it to "global" on a messy project - It wasn't working when I tested it. Ok, I'll try it tonight and report it here.

Edit:
@rexrainbow
Tried the "Global: ON" and it worked! I must have changed something that broke it!
Thanks a lot Rex, and sorry for taking you time on a stupid matter :gammabeam2012-03-29 23:10:28
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Sun Apr 01, 2012 10:44 am

Hey @rexrainbow, me again , been using this plugin HEAVILY in all my projects, I can't imagine life without it .

Now I'm confused about something, and this is the actual ORDER of events and such. More specifically, can you clarify WHEN does the function get called if I place a "call" action?

I would expect it to be "inline", but it seems it's not.

Can you please clarify for me when does the function get called, and whether or not it does something to the "context" (i.e. picked objects etc).

Even more specifically, if I have something like:

Event button clicked:
    action 1: set variable "spriteCount" to 0
    action 2: call function "destroySprite"
subevent for each sprite:
      action 1: add 1 to spriteCount
      action 2: textObject -> set text to spriteCount
Event function called "destroySprite"
    action: sprite -> Destroy

In the click event, I am calling destroySprite which should destroy my sprites. I would expect that by the time the subevent runs, sprites are destroyed. But actually they are not, they get counted etc.

On the other hand, if I add a Wait after the function call, it seems that the objects get destroyed by the time the subevent runs.

Am I getting something wrong?

I can post simple capx if this is not clear enough.

Thanks.
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Sun Apr 01, 2012 2:14 pm

@Geo

Function plugin dose not change SOL, so that the result of SOL at "on function" is comes from engine. See this post for more detail.

--
the event system is not yet designed to allow triggers to access the calling event's SOL.
--

Briefly, SOL at "on function" is whole instances of object by default. It can not bypass calling event's SOL anymore.

One way of bypass SOL is using Instance Group to save SOL by UID. Then you can pick then by Instance Group at "on function".


Maybe @Ashely will provide an api to allow me bypass SOL to "on function".


Do I catch your problem?rexrainbow2012-04-01 14:15:39
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Sun Apr 01, 2012 9:32 pm

Thanks Rex for replying. I don't understand what this SOL is, is there documentation on it?

But anyway, I don't want the function plugin to work in a certain way, or to change this SOL thing. I just want to understand how it works.

My testing indicates that the function call is added at the end of the current event "queue", i.e. the call will be executed last, and nothing will be pre-filtered, and no filter that the function does is kept past its scope.

If that is not correct, please correct me.

Geo.
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests