Why does code work outside a function.

Get help using Construct 2

Post » Wed Feb 11, 2015 2:57 am

I'm working on an RPG/Management game, and when you go to the Hiring page to hire a group of adventurers I call 3 functions On Layout Start.

On the Hiring Events page the GenerateRoster function runs successfully, the GenerateCards function runs successfully, but when I call the PopulateCards function to tie the array to the UI, nothing happens. If I pull the code outside the function, it runs successfully.

What gives?
(I've attached the .capx file, the code can be found on the Hiring Events page)
You do not have the required permissions to view the files attached to this post.
B
25
S
4
G
2
Posts: 11
Reputation: 1,630

Post » Wed Feb 11, 2015 4:01 am

A "system | wait 0 seconds" after the call to GenerateCards fixes it. The objects you created aren't available until the next tick (except to subevents).
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 11, 2015 4:20 am

Thank you, codah! You're the best.
B
25
S
4
G
2
Posts: 11
Reputation: 1,630

Post » Wed Feb 11, 2015 4:27 am

lorddon wrote:Thank you, codah! You're the best.


lol no problem
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 11, 2015 10:18 am

codah best nope he is GEM and Star
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Post » Wed Feb 11, 2015 11:55 am

Lordshiva1948 wrote:codah best nope he is GEM and Star


:lol: Lordshiva1948 almost 20,000 rep :)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: NN81, tarek2 and 22 guests