TMacho Posted May 30, 2017 Share Posted May 30, 2017 (edited) Hello everyone, i don't know if it is possible to active 2 conditions or if it exist other ways to do it.. I did create a example bellow: integer firstclick=0; integer secoundclick=0; default { touch_start(integer total_number) { firstclick = firstclick + 1; secoundclick = secoundclick + 1; if (firstclick == 3) { llOwnerSay("First click"); } else if (secoundclick == 5) { llOwnerSay("Secound click") } else if (firstclick + secoundclick) // this is were i don't know how to do active both clicks (conditions). { llOwnerSay( "firstclick and secoundclick are active"); } } } Edited May 30, 2017 by TMacho Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 30, 2017 Share Posted May 30, 2017 I'm a bit unclear about what you are trying to do. As written, you are touching one object, incrementing both firstclick and secondclick each time. Your first if test will only be TRUE when you click three times. The second test will only be TRUE when you click 5 times. The third test will always be TRUE after you have clicked the object once, but it will only give the message "firstclick and secoundclick are active" if you have not clicked 3 or 5 times. Is that what you intended? Exactly what do you mean by "active" in this example? Link to comment Share on other sites More sharing options...
TMacho Posted May 30, 2017 Author Share Posted May 30, 2017 I wanted the third test to be activated, only when the first test and second test were activated, if the first and second test were not activated, the third test would not be activated. I was wanting the message "firstclick and secoundclick are active" when i would click 3 and 5 times. Is that possible ? Sorry I'm not native English is a bit hard to explain sometimes. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 31, 2017 Share Posted May 31, 2017 Not the way you have just explained it. You either click 3 times or you click 5 times. You can't click 3 times and 5 times at the same time. 3 != 5 . I suspect you're thinking about something very different, but I don't see it yet. And I still have no idea what you mean by "active". Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 31, 2017 Share Posted May 31, 2017 Yeah, it's kinda a strange example, I guess. However, maybe this is something you are looking for? Note it's if not else if if you want to trigger the both "active" condition the moment you clicked for the fith time. if (firstclick >= 3 && secondclick >= 5) { // do stuff } Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 31, 2017 Share Posted May 31, 2017 Notice, though, that if Arton's example is what you are looking for, you don't need the full test. When secondclick >= 5, you know that firstclick must also be > 3. Therefore, your entire script collapses to integer firstclick=0; integer secoundclick=0; default { touch_start(integer total_number) { firstclick = firstclick + 1; secoundclick = secoundclick + 1; if (firstclick == 3) // Will only trigger on click 3 { llOwnerSay("First click"); } else if (secoundclick == 5) // Will only trigger on click 5 { llOwnerSay("Second click"); } if (secoundclick >= 5) // Will trigger on every click after 4 { llOwnerSay( "firstclick and secoundclick are active"); } } } Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 31, 2017 Share Posted May 31, 2017 Right! Actually I skipped to mention that, because I guess the OP is going to do something very different than what the example script shows. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 31, 2017 Share Posted May 31, 2017 I was actually wondering whether he was thinking of clicking on two different objects (buttons?) -- one for "firstclick" things and one for "secondclick" things. It's a little hard to guess without knowing at least what he means by "active". Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 31, 2017 Share Posted May 31, 2017 Yes indeed. It's probably just some sort of language barrier at play. As a non native english speaker myself, I probably don't take such terms too literally. Link to comment Share on other sites More sharing options...
Berksey Posted May 31, 2017 Share Posted May 31, 2017 ...Or how to tell first click from second click with the touch event? I'm baffled... I'm used to simply setting integers to TRUE or FALSE, and using that to decide what happens on the next click(s)... Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 31, 2017 Share Posted May 31, 2017 I suspect the OP has tried to give an analogy for what he or she is trying to do. That's what usually turns out to be the case when people say they're trying to do something pretty incomprehensible, I find. The original example seems to mean something like "Say 'First Click' after three touches, and then say 'Second Click' after a further five touches (i.e. after eight touches in all), and then do something different for all subsequent touches (e.g. 'You've touched me enough times now. Let someone else have a turn')". If that's the case, I don't see why it needs two separate variables. ++firstClick; if(firstClick == 3){ llOwnerSay("First click"); } else if (firstClick == 8){ llOwnerSay("Second click"); } else if (firstClick > 8){ llOwnerSay("firstclick and secondclick are active"); } But, as Rolig suggests, there's probably two buttons or something invovled. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now