having a problem with if statement

Get help using Construct 2

Post » Tue Dec 06, 2011 10:58 am

hiya,

okay heres the deal i am trying to set up a toggle for music and some other options and the only way i can figure out how to do this is to set up flag variables which set the option to on or off



but when i do this it just seems to culminate in another layer of music on top of the existing layer/s of music. It seems to discount the fact that the variable music has been changed.
morpheous2011-12-06 22:13:59
B
12
S
1
G
2
Posts: 18
Reputation: 1,726

Post » Tue Dec 06, 2011 11:06 am

Create a local variable under event 2 (name "hasChanged" for example, number)
Event 3 add an action set hasChanged to 1
Event 4 and 5 add a condition "hasChanged = 1"
Event 4 and 5 add an action "hasChanged = 0"

It will allow to prevent the "automatic switching" since it will execute event 5 only if "hasChanged = 1", that is to say that music = 0 AND event4 wasn't executed yet, since hasChanged is still = 1
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Dec 06, 2011 11:32 am

thanks for the response i am a bit of a noob at this and i am trying to understand what you are saying here. Now so you are saying create another test variable which i use in conjunction with my global variable music?
B
12
S
1
G
2
Posts: 18
Reputation: 1,726

Post » Tue Dec 06, 2011 11:47 am

Yes that's it exactly.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Dec 06, 2011 12:08 pm

okie dokie so this is what i have, must be close eh? sorry bout this but am still trying to learn this structure, it doesn't seem to want to behave like a simple if..then..else sort of scenario

morpheous2011-12-06 22:14:24
B
12
S
1
G
2
Posts: 18
Reputation: 1,726

Post » Tue Dec 06, 2011 12:22 pm

lol okay i've fixed the problem, thanks for your help!
B
12
S
1
G
2
Posts: 18
Reputation: 1,726

Post » Tue Dec 06, 2011 1:46 pm

@morpheous,

what was the fix? so we don't have to chase the oracle down for the answer.
B
50
S
17
G
15
Posts: 1,029
Reputation: 26,289

Post » Tue Dec 06, 2011 2:11 pm

This manual article is useful in solving the current situation.

To correct morpheous' last screenshot :

Event4 and 5 must be mixed into a single event of 2 conditions.
Same for 6 and 7.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Dec 06, 2011 10:15 pm

Yep sure thing, here it is

morpheous2011-12-06 22:15:26
B
12
S
1
G
2
Posts: 18
Reputation: 1,726


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests