How do I use multiple function parameters with text?

Just started using Construct 2? Post your questions here

Post » Tue Jun 02, 2015 9:14 am

Hi,

i'm currently trying to create a GUI for dialogue text, but some reason i'm unable to use multiple function parameters that contain text strings.
The first one works fine, but the second is just displayed as "0" (Zero).

This are my events:

Image

Many thanks in advance!
B
4
S
1
Posts: 8
Reputation: 366

Post » Tue Jun 02, 2015 11:06 am

The problem is that the parameters passed to the function used with "Wait for signal" and "Signal" ain't stored. So the when you call the function the first "Longtext" reads the parameter (1) then it waits for a signal, but as it does this the parameters for some reason is "cleared". If you replace the "Set text to function.Param(2)" with for instant "Set text to "test text 2"" then it will work.

It seems that it might be a bug as im not sure its suppose to work like that, so you can take your chances and make a bug report, but personally if I were you, I would just start creating a workaround for what you are trying to do, because it will most likely not be the last, so you might as well get used to it :)
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Tue Jun 02, 2015 12:46 pm

Wait commands do not block. They take all of the code below them, moves it to a separate thread, and calls it after the condition is met. So all local variables are lost and the function is actually returning on the first wait, so it's parameters are also gone. Just use a global in this case, or store the text on an instance variable of LongText and grab it from there instead.
ImageImageImage
B
71
S
22
G
248
Posts: 3,760
Reputation: 138,071


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests