Is there an easier way to handle this?

For questions about using Classic.

Post » Thu May 06, 2010 1:40 pm

[url:2lsmqy8z]https://projects.gscept.com/attachments/download/451/SpaceKeyEvents.JPG[/url:2lsmqy8z]

It's a huge mess of nested if statements at the moment. It works... but I wonder if there is some sort of easier way to accomplish the same thing? It basically opens doors when switches are thrown in the correct order, or when clues are activated in the right order.

Any ideas? Advice? or just click all the - signs again and hope for the best? :lol:
B
2
G
2
Posts: 10
Reputation: 670

Post » Thu May 06, 2010 2:36 pm

Merge conditions for same actions

Like:

+ Condition A > Action 1
+ Condition B > Action 1
+ Condition NOT C > Action 1

can be merged into

+ Condition A OR B OR NOT C > Action 1
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu May 06, 2010 3:34 pm

[quote="jaenelle":35sw9ifr]It's a huge mess of nested if statements at the moment. It works... but I wonder if there is some sort of easier way to accomplish the same thing? It basically opens doors when switches are thrown in the correct order, or when clues are activated in the right order.

Any ideas? Advice? or just click all the - signs again and hope for the best? :lol:[/quote:35sw9ifr]
That's what loops are for :)
In order to use loops effectively you need to redesign your work. Naming conventions and assigning of values should be used in a way that makes it easier to loop them. For example the first switch:
Rearrange the assigning of the values so that you constantly substract/add in a row if switchnum is 1-4 and constantly add/substract from 5-6. Name your animations in a "loopable" way (like AnimA, AnimB, ... to name a very easy and not very informative one). When the preparing is done you could do something like this:



Reducing 16 events down to 5.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests