[PLUGIN] rex_Function2

Post your completed addons to share with the community

Post » Fri May 11, 2012 3:26 pm

Update:

Remove jQuery call. Hope it could be run at new exporter.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Sun May 13, 2012 5:54 pm

Wonderful Plug-in Rex.
I needed a way to create quick prototypes for educational games. I liked C2 but it was missing a few "normal" things. However with the "Function" plug-in as well as other plug-ins that you and many of the other geniuses on this site have created, I am finding C2 to be a worthy environment for my needs. Hope to have some games on-line soon.
B
8
S
2
G
2
Posts: 3
Reputation: 1,893

Post » Wed Jun 13, 2012 3:51 am

There already has a property named "Debug mode". It could popup alert window when
- call an inexistent function name
- get an inexistent parameter name
- get an inexistent return name
- overwrite an existed javascript function

Remember turn "Debug mode" off when publishing.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Tue Jun 26, 2012 10:21 pm

This is a Gem, specially the integration with the event system, Thanks!!!
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Wed Jun 27, 2012 4:14 am

@juantar

Thanks.
Although "injecting javascript function" is rare to be used I guess.rexrainbow2012-06-27 04:14:38
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Fri Jul 27, 2012 4:42 pm

This plugin is very useful indeed. But is there any more compact way to do a function call like this:

Example: "fuFunction" returns 2 parameters
- Set parameter [0] to someVar
- Call "fuFunction"
- Function.Ret(1) (returns the second parameter)

May be writing everything in one line, like this:
- Call "fuFunction",someVar,(1)
B
42
S
11
G
4
Posts: 505
Reputation: 7,267

Post » Sat Jul 28, 2012 12:54 am

@xoros

There are two way to put return value
1. use "action:Set a return value", it could put return value in a hash table, so that it could return more then one value.
2. use "action:Set result", it only return one value. This action is used for the "expression:Call" mostly, since expression only could return one value,


The "action:Execute commands" could execute more then one function call by passing a string.

See first post of this thread for more detail.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Wed Aug 01, 2012 2:13 pm

One more noob question:

Example:
-> a function was called on mouse click
-> there's a timer sub-event inside a function which should start counting on function call

The problem is, the timer counts only one tick. I think it has something to do with construct event structure (mouse click is considered as main event, which sort of "overrides" sub events). Is there any possibility to let the timer count inside this function by calling it with mouse click?
B
42
S
11
G
4
Posts: 505
Reputation: 7,267

Post » Wed Aug 01, 2012 2:25 pm

@xoros: The mouse click is a trigger, so it happens only for one tick.
What you should do rather than using a function here is making a group, disable it by default, and enable it on the mouse click.
Stuff will happen as long as the group is enabled, if you use like a blank sub event (that will execute every tick) and also a test to disable the group when you want its action on the game to be done.Kyatric2012-08-01 14:26:32
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Aug 01, 2012 2:29 pm

Yes, group is a solution. Basically groups are like very simple functions.
B
42
S
11
G
4
Posts: 505
Reputation: 7,267

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests