# llOwnerSay Help pls!

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```

##### 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.

##### Share on other sites

still learning thank you!

:matte-motes-kiss:

##### 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.

##### Share on other sites

Another way of doing the list-picker is

`integer counter;integer max;list answers =  ["first","second","third","last"];default{	state_entry()	{		max = llGetListLength(answers);	}	touch_start(integer total_number)	{		llOwnerSay(llList2String(answers,counter%max));		++counter;	}}`

##### Share on other sites

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

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.