Wait for signal question

Get help using Construct 3!

Post » Fri May 26, 2017 6:59 pm

I have a 'Wait for Signal' action inside a function. When I trigger the signal and return to the function I want to go to another layout which is defined by a parameter that was passed to that function. However, when I return after the signal the parameter seemingly is null. Before the 'Wait for Signal' the parameter is correct.

I've tried storing the parameter in a local var too, but it gets set back to its default value when the signal is triggered.

I tested this by placing a string variable before the 'Wait for...' and then after it.

Is this to be expected? Do I really need to store the parameter to a global variable?

Screenshot of the even: [img][IMG]http://i1070.photobucket.com/albums/u490/EricThomasGames/Capture_zpsbnefgh2o.png[/img][/img]
B
9
S
1
G
2
Posts: 30
Reputation: 1,970

Post » Sat May 27, 2017 5:01 am

I think it's to be expected. A "wait" only saves the picked objects as far as I'm aware. Parameters aren't saved and I'm pretty sure local variables aren't either. One solution would be to right before the wait you create an object and save all the relevant info in it, then destroy it after the wait since we only need it saved temporarily.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Sat May 27, 2017 3:40 pm

As you suggested, eochranek, you need to save the parameter in a variable. But as you noticed, the variable is not kept either. The solution is to make the variable static (it's a checkbox when you create/edit the variable)

Image
B
18
S
5
Posts: 80
Reputation: 1,338

Post » Sun May 28, 2017 1:36 pm

Thank you narFsnw! Setting to static was what I needed.
B
9
S
1
G
2
Posts: 30
Reputation: 1,970


Return to How do I...?

Who is online

Users browsing this forum: angelo, PSyCHoHaMSTeRza and 2 guests