Jump to content

Active conditions


TMacho
 Share

You are about to reply to a thread that has been inactive for 1955 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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 by TMacho
Link to comment
Share on other sites

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

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

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

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

 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

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

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

You are about to reply to a thread that has been inactive for 1955 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...