Jump to content

llOwnerSay Help pls!


Rhemah
 Share

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

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

Recommended Posts

i want to create like five different OwnerSay, can someone give me an idea?

integer sayit = TRUE;

default
{
    touch_start(integer total_number)
    {
        if(llDetectedKey(0) == llGetOwner())
        {
            if(sayit)
            {
                llOwnerSay("First!");
                sayit = FALSE;
            }
            else if(!sayit)
            {
                llOwnerSay("Second!");
            }
        }
    }
}
// i want to like create more llOwnerSay("Third!"); to Fifth if possible

 

Link to comment
Share on other sites


Rhemah wrote:

i want to create
like
five different OwnerSay, can someone give me an idea?
integer sayit = TRUE;default{    touch_start(integer total_number)    {        if(llDetectedKey(0) == llGetOwner())        {            if(sayit)            {                llOwnerSay("First!");                sayit = FALSE;            }            else if(!sayit)            {                llOwnerSay("Second!");            }        }    }}

// i want to
like
create more llOwnerSay("Third!"); to Fifth if possible

 


Well, since you have declared an integer, use it as an integer instead of a boolean.  TRUE/FALSE are two states but that integer can contain lots of numbers so just use 1, 2, 3, 4, 5 and test for 1,2,3,4,5 instead of TRUE or FALSE.

 

  • Like 1
Link to comment
Share on other sites

The classic solution is an if else chain:

integer saywhat;default {    touch_start(integer num) {    	    	if (llDetectedKey(0) == llGetOwner()) {    		    		++saywhat;    		    		if (saywhat==1)    		{    			llOwnerSay("first");    		}    		else if (saywhat==2)    		{    			llOwnerSay("second");    		}    		else if (saywhat==3)    		{    			llOwnerSay("third");    		}		else    		    		{    			llOwnerSay("last");    		}    		    	}    }}

count up saywhat on every touch and run through the chain to find an answer.

Can become quite lengthy. Sometimes you can replace that by another solution like this:

integer saywhat;default {    touch_start(integer num) {    	    	if (llDetectedKey(0) == llGetOwner()) {    		    		list answers = ["first","second","third","last"];    		integer length = llGetListLength(answers);     		    		++saywhat;    		if (saywhat > length) saywhat=length;    		    		    		llOwnerSay(llList2String(answers,saywhat-1));    		    	}    }}

Here you only add elements to the list if you need more answers. If that is useful depends on the single case. I often use list pickers instead of if else chains if that makes sense.

 

 

 

Link to comment
Share on other sites

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

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
 Share

×
×
  • Create New...