I have a loop that calls a function when certain criteria are met. In my game, once a screw is "unscrewed" a function is called. However, for some reason the function isn't being executed the first time it's called in the loop.
Attach a Capx
Description of Capx
This is a big project. The issue occurs in the function "addItemToInventory" (look at group "funclib"). The first time the function "checkFasteners" is called inside this function, it does not execute. I tested this by setting up a test var in the function and at the point the function is called. The test var near the call to the function changes, but the test var within the function "checkFasteners" does not until the function has already been called once inside the funtion "addItemToInventory".
Steps to Reproduce Bug
- Step 1: Walk up to the door control (WASD) and press "R".
- Step 2: Click on the screw driver and unscrew each of the screws in the face plate by clicking and holding the tip of the screw driver to the screw.
- Step 3: The var "test" changes when you remove a screw and which calls the "checkFasteners" function and test2 changes when that function is actually executed. You'll see that test2 only increments after the second screw (and all subsequent screws) are removed.
The function is not executed the first time it's called.
The function "checkFasteners" should execute each time it's called.
- Chrome: YES
- FireFox: YES
- Internet Explorer: NA
Operating System and Service Pack
Win 7, SP1
Construct 2 Version ID