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

0 favourites
  • 6 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • 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.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)