Problem with small Condition branch

For questions about using Classic.

Post » Sat Jul 25, 2009 8:26 am

Hello! More or less brand new here.

I haven't any idea how to fix a problem I'm having; I have two conditions set-up, one for adding a large number to a text box when an object is clicked and only if doing so would not bring the total to greater than 99999 (as doing so would cause the text to be larger than the window it's being displayed in), and one for simply brining the total up to 99999 if the amount being added would exceed it.

With both Conditions in place, though, when I click the object that adds the number the value simply gets set to 99999. Oddly, if I disable either one of the conditions, the other seems to work just fine.

The cap file for the game is here

It's condition #7 and #8, under Resources, that are giving me trouble.

Any help would b appreciated.

(Technically, this particular issue wouldn't realistically be a problem in the game, but more broadly I'd like to understand what is wrong in case of a future conflict dealing with a similar circumstance)
B
1
G
3
Posts: 5
Reputation: 835

Post » Sat Jul 25, 2009 10:18 am

That's a bit messy way you've got there... I'd suggest to only have one trigger, but two subevents with separate conditions. Also, there is no point giving 99999-55555 as a value, that is a simple arithmetic operation, just give 44444.

Like this (+ is an event condition, ++ is a subevent condition, > is action):
[code:1x8m8mfm]+On left clicked on Sprite3
++ 'Amount of water' greater than 44444
> set 'Amount of water' to 99999
++ 'Amount of water' less or equal than 44444
> set 'Amount of water' to 55555 [/code:1x8m8mfm]
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Jul 25, 2009 8:49 pm

Hm. Nope, that didn't work.

Here's the cap file with your suggested changes made.

Thanks for trying to help, though.


...I think what is happening is that the first condition is triggering the other one. If that's the case, I'm not sure how to prevent that from happening.
B
1
G
3
Posts: 5
Reputation: 835

Post » Sat Jul 25, 2009 9:19 pm

Oops! I had the Conditions in the wrong order. The check for the value cap has to come first (as you had set-up).

All fixed & working as planned. Thanks a pile. :)
B
1
G
3
Posts: 5
Reputation: 835

Post » Sun Jul 26, 2009 9:55 am

Ah yes, forgot to mention that Construct processes events and conditions from top to bottom, if it changes the value in a way that it meets the next condition within the same tick, it will process that as well. :)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests