0 Favourites

[C2 109] call function after delay (with picking)

  • Little example of how to use the new function object with system wait to carry out a function after delay that also preserves picking.

    Something CC couldn't do... at least not this easily.

    Nice one Ashley.

    https://dl.dropbox.com/u/666516/callfunctionafterdelay.capx

    Also in case you were wondering, you can break the picking by just moving the call function sub event up a tier.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hmm... this is actually a bug, I didn't intend for it to work this way. 'On function' should be working with a clean slate and not involve any objects that were previously picked. If you add the condition 'Sprite: is on screen' to the 'On function' event it stops working as expected. So I'm afraid I think this will be fixed to work consistently in a future release.

  • Well that sucks.

    Then again I don't see why you couldn't use the iid in the functions parameter.

    Edit link:

    https://dl.dropbox.com/u/666516/callfunctionafterdelay.capx

    Now shows it using the iid. With a possible bug below.

    Also Ashley I may now have another bug. It seems the expression Function.Param(0) isn't working. Unless I'm using it wrong.

    Either way I guess this can now go to the bugs forum so as to not confuse people.

  • Function.Param(0) seems to be working fine here.

    I've fixed SOLs being accidentally re-used for the next build though.

  • Ok, yeah the value is being passed. Pick nth wasn't picking it up.

    Ive changed the example capx to show what I did.

    Also compare variable works.

  • Not sure if this is my error or a functional error:

    Or if it is even related to this...

    Example:

    SYSTEM - On Start of Layout

    Create TEXTBOX

    Dictionary add Key BOX1 with value TEXBOX.UID

    Create TEXTBOX

    Dictionary add Key BOX2 with value TEXBOX.UID

    Function SetBOX1

    Function SetBOX2

    Function FillBOXES

    FUNCTION FillBOXES

    TEXTBOX Pick Instance with UID Dictionary.Get("BOX1")

    TEXTBOX set text to Array.At(0,0,0)

    TEXTBOX Pick Instance with UID Dictionary.Get("BOX1")

    TEXTBOX set text to Array.At(0,1,0)

    FUNCTION SetBOX1

    Array Set value at(0,0,0) to "John"

    FUNCTION SetBOX2

    Array Set value at(0,0,0) to "Doe"

    ================================================

    The Issue:

    ================================================

    In runs through fine and fires the FillBOXES function but will NOT fire the:

    TEXTBOX Pick Instance with UID Dictionary.Get("BOX1")

    TEXTBOX set text to Array.At(0,0,0)

    TEXTBOX Pick Instance with UID Dictionary.Get("BOX1")

    TEXTBOX set text to Array.At(0,1,0)

    UNLESS I put a "Wait" on action of the Function FillBOXES like this:

    FUNCTION FillBOXES SYSTEM Wait 0.5

    TEXTBOX Pick Instance with UID Dictionary.Get("BOX1")

    TEXTBOX set text to Array.At(0,0,0)

    TEXTBOX Pick Instance with UID Dictionary.Get("BOX1")

    TEXTBOX set text to Array.At(0,1,0)

    ==================================================

    Is it me not understanding the order of events to fire or is there something else?

    Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Spriter/C2 - Spriter 2 Teaser!
1,800 322,390
tarek2's avatar
tarek2
Unread sticky
763 305,742
asikanddestroy's avatar
asikanddestroy
Unread hot topic
0 Favourites
Your C2 tests
566 243,757
thisisblogs's avatar
thisisblogs