[PLUGIN] rex_Function2

  • EyeHawk

    You might need use "families" feature. It is available in standard version.

  • Hi Rex, thanks actually that answered another question I had.

    In my original case though, I have two sets of rules like so:

    <img src="http://www.learnrec.com/ForumImages/PotblockActions.jpg" border="0" /><img src="http://www.learnrec.com/ForumImages/TomatoblockActions.jpg" border="0" />

    Both rules are identical, but the objects involved are different.

    It would be cool if I could turn the actions into a function, and then pass it either [TomatoBlock & TomatoCross] OR [PotBlock & PotCross].

    I can't use families in this case as the tomato actions would affect the pot objects and vice versa.

    I don't suppose there's a plugin that does this?

  • EyeHawk

    "I can't use families in this case as the tomato actions would affect the pot objects and vice versa."

    You might use a private variable in these sprite instances to indicate which sprite type belonged.

    Or put function name in private variable as it's handler name, so that you could change handler dynamically.

  • Aha, I think that may do the trick! I'll use the private variable technique. Thanks again Rex

  • Update:

    Remove jQuery call. Hope it could be run at new exporter.

  • 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.

  • 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.

  • This is a Gem, specially the integration with the event system, Thanks!!!

  • juantar

    Thanks.

    Although "injecting javascript function" is rare to be used I guess.

  • 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)
  • 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.

    <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/screen3.png" border="0" />

    See first post of this thread for more detail.

  • 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?

  • 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.

  • Yes, group is a solution. Basically groups are like very simple functions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I�ve never thought of using groups to execute an action for a limited amount of time. Thanks.

    I�m having troubles wrapping my mind around the function/timeline/worksheet plugin and haven�t found anything in the tutorial section.

    I think I�m missing some amazing functionalities, isn�t there anyone interested in doing a tutorial for these plugins?

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