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

Get help using Construct 2

Post » Thu May 22, 2014 4:23 pm

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?"
Last edited by klkitchens on Fri May 23, 2014 3:19 am, edited 1 time in total.
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Thu May 22, 2014 4:58 pm

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 ^^"').
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Thu May 22, 2014 4:59 pm

Good tip... and yep, it's in the same event sheet. And I confirmed the spelling was the same too...
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Thu May 22, 2014 5:03 pm

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
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Thu May 22, 2014 6:26 pm

Aphrodite wrote: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!
B
22
S
4
G
1
Posts: 100
Reputation: 2,150


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests