OR, IF, ELSEIF, ELSE, WHILE, etc Forum Home > Construct 2 General > How do I....? |
Post Reply
|
Page 12> |
| Author | |
Post Options
Quote Reply
Topic: OR, IF, ELSEIF, ELSE, WHILE, etcPosted: 01 Nov 2011 at 4:47pm |
|
|
I like the logic behind the codes very much =D
And figuring out some conditions, I think the best way to achieve them is using these conditionals: OR, IF, ELSEIF, ELSE, WHILE. Browsing today, one of the forum topics (Branch) did a workaround for some of them, but, I would like know if it's something I'm missing or they aren't in the events to be selected and used as well? If they aren't used in the standard, I believe the best thing is avoid workarounds and keep my logics to make the same things =] About the OR, that's something I mean is automatic, because if one of the conditions is not meat, the software will go to the next, the problem is when you want test one first and them the next one ^^ Edited by TELLES0808 - 01 Nov 2011 at 4:51pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 01 Nov 2011 at 10:08pm |
|
|
Adding an "if" condition is unnecessary as all conditions imply an "if".
"else" would be nice to have as Construct Classic has it, but it can be simply done with inverted conditions. ![]() Which is what the branch plugin does, but if you want if/else to work with picking the you'll have to resort to events: ![]() "or" can be done like traditional programming by using a local variable: ![]() Or if you want to use "or" with picking: ![]() "while" isn't really necessary as we already have the looping conditions "for" and "repeat". Edited by R0J0hound - 01 Nov 2011 at 10:09pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 01 Nov 2011 at 10:53pm |
|
|
Very nice explanation, thanks @Rojo
|
|
![]() |
|
Post Options
Quote Reply
Posted: 12 Nov 2011 at 10:03pm |
|
|
I am having problems with doing an Else. I want to toggle my layouts back and forth.
http://dl.dropbox.com/u/49284765/Else%20Change%20Layout.capx |
|
![]() |
|
Post Options
Quote Reply
Posted: 12 Nov 2011 at 10:28pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 13 Nov 2011 at 1:09am |
|
|
you rock Kyatric
|
|
![]() |
|
Post Options
Quote Reply
Posted: 25 Jan 2012 at 5:23pm |
|
|
quick question, I have a button that toggles visibility of an object, in events:
on touch end -- object is visible? ++++ make object invisible -- object is invisible? ++++ make object visible this of course loops itself through fully, because the object will be hidden by the first subevent and shown by second one. how to avoid this so it kinda breaks after making it invisible? |
|
![]() |
|
Post Options
Quote Reply
Posted: 25 Jan 2012 at 5:34pm |
|
![]() |
|
Post Options
Quote Reply
Posted: 25 Jan 2012 at 5:40pm |
|
i know, but how do you use it with visibility and others. thanks for the response, but this does not apply, or at least i don't know how to use this operator with "make visible / invisible". also I need to retain this event structure, as this is a simplified version of my real problem. |
|
![]() |
|
Post Options
Quote Reply
Posted: 25 Jan 2012 at 5:47pm |
|
|
@ranma: dld again the previous capx.
I cheated using opacity. It is a good question though, using the visible property with a conditionnal operator. I'm not sure it can be done. If it can, I'd love to know how to. For that one though, there's a trick/workaround to use a temp variable. The code you first gave would look like :
This stops the "looping" effect. Edited by Kyatric - 25 Jan 2012 at 5:49pm |
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |