[SOLVED] Getting Loop to run on a button press?

  • I've got my main code working and now I want to work on some end-game scoring functions, so needless to say I don't want to have to "play" the game each time I want to test/tweak something. So I added a button to the layout for debugging purposes that basically "solves" the whole game for me (placing eggs in their respective baskets) so I can get right to scoring animations, etc...

    The button is called "FIllCorrect" and I have the following code:

    Conditions:

    FillCorrect - On Clicked

    System - Pick All Eggs

    System - For Each Egg

    Action:

    GameFunctions - Call "DEBUG_PlaceEggInBasket (Egg.UID)"

    which calls...

    Conditions:

    GameFunctions - On "DEBUG_PlaceEggInBasket"

    System - Pick Eggs by evaluating Eggs.UID = GameFunctions.Param(0)

    System - Pick Basket by evaluating Basket.UID = Eggs.BasketUID

    Actions:

    GameFunctions - Call "Egg_SelectEgg" (Eggs.UID)

    GameFunctions - Call "Egg_PlaceInBasket" (Eggs.UID, Basket.UID)

    GameFunctions - Call "Egg_DeselectCurrentEgg"(Eggs.UID)

    (these three functions are working, they are functions called when the user actually manually places the eggs, etc..., I'm just calling them (or trying to) automatically)

    The problem is I'm getting this message:

    "[Construct 2] Function object: called function 'DEBUG_PlaceEggInBasket', but no event was triggered. Is the function call spelt incorrectly or no longer used?"

  • Did you included the event sheet containing the function and the one containing the call? (Not saying you are dumb, but more than half the time, it is the issue it seems.. I do that a lot too ^^"').

  • Good tip... and yep, it's in the same event sheet. And I confirmed the spelling was the same too...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can we have a screenshot of the concerned events then?

    Also:

    "System - Pick Eggs by evaluating Eggs.UID = GameFunctions.Param(0)

    System - Pick Basket by evaluating Basket.UID = Eggs.BasketUID"

    you can do :

    Eggs - Pick by Unique ID : GameFunction.Param(0)

    Basket - Pick by Unique ID : Eggs.BasketID

  • Can we have a screenshot of the concerned events then?

    Also:

    "System - Pick Eggs by evaluating Eggs.UID = GameFunctions.Param(0)

    System - Pick Basket by evaluating Basket.UID = Eggs.BasketUID"

    you can do :

    Eggs - Pick by Unique ID : GameFunction.Param(0)

    Basket - Pick by Unique ID : Eggs.BasketID

    Solved it... the method was getting called just fine, but it was not finding the Basket (I was checking my own variable incorrectly) so it resulted in nothing getting fired thus the error.

    To debug, I reduced the event to a basic call with no params, then slowly added pieces back in... and voila...realized my mistake.

    THANKS!

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