Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do I get a say command to wait a few seconds

Kurt Ludd
"The Gesture maker"
Join date: 27 Sep 2005
Posts: 229
01-11-2008 07:00
How do I get a ||say command to wait 2 sec before executing the next ||say?


or any set interval...the timer function doesn't look like it would work.

llMinEventDelay looks like it might work but not sure or llSleep



thanks in advance for any help...
_____________________
Kurt Ludd
"The Gesture Maker" with 4000+ Gestures
Try a FREE 12 Gesture HUD at http://slurl.com/secondlife/Malra/15/57/66
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
01-11-2008 07:03
The llSetTimerEvent() command should work.

Or, if you use llInstantMessage, that delays 2 seconds automatically.
Alicia Sautereau
if (!social) hide;
Join date: 20 Feb 2007
Posts: 3,125
01-11-2008 08:47
default
{
state_entry()
{
llSetTimerEvent(2.0);
}

timer()
{
llSay(0, "2 seconds have passed";);
}
}
_____________________
Okiphia Anatine
Okiphia Rayna
Join date: 22 Nov 2007
Posts: 454
01-11-2008 08:48
From: Kurt Ludd
How do I get a ||say command to wait 2 sec before executing the next ||say?


or any set interval...the timer function doesn't look like it would work.

llMinEventDelay looks like it might work but not sure or llSleep



thanks in advance for any help...


CODE

default
{
touch_start(integer number)
{
llSay(0, "In two seconds I'll say 'Hi'");
llSetTimerEvent(2);
}
timer()
{
llSay(0, "Hi");
llResetScript();
}
}


Would cause a script to warn its going to say hi, then pause two seconds and say hi... so I think the timer event would work fine for you!
_____________________
In-world, I am Okiphia Rayna. This account is an alt, and is the only account I currently have with payment info on-file due to some account cracking that took place. This is a security measure at present, and I may return to the forums as Okiphia Rayna at a later date.

If you need to reach me, IM Okiphia Rayna, not Okiphia Anatine
Kurt Ludd
"The Gesture maker"
Join date: 27 Sep 2005
Posts: 229
ty for the advice But?
01-11-2008 09:00
ok I got the event timer to work on waiting for one say...but when I try and put 2 or three together...like for a counting down chat...it wont go to the next say and wait 2 sec then next say and then so on...


but I am headed in the right direction LOL
_____________________
Kurt Ludd
"The Gesture Maker" with 4000+ Gestures
Try a FREE 12 Gesture HUD at http://slurl.com/secondlife/Malra/15/57/66
Alicia Sautereau
if (!social) hide;
Join date: 20 Feb 2007
Posts: 3,125
01-11-2008 09:08
will use okiphia`s example for the sake of no loop

integer countdown;

default
{
touch_start(integer number)
{
countdown = 5;
llSay(0, "Starting count down from"+ (string)countdown);
llSetTimerEvent(1);
}
timer()
{
if (countdown > 0)
{
llSay(0, (string)countdown);
countdown--;
} else {
llSay(0, "Resetting";);
llResetScript();
}
}
}

just using 1 sec timer for the example :)

edit: hard to know exatly what you want but you can control what it says with using a simple check, just define what you want it to say at each state
_____________________
Okiphia Anatine
Okiphia Rayna
Join date: 22 Nov 2007
Posts: 454
01-11-2008 09:20
From: Alicia Sautereau
will use okiphia`s example for the sake of no loop

integer countdown;

default
{
touch_start(integer number)
{
countdown = 5;
llSay(0, "Starting count down from"+ (string)countdown);
llSetTimerEvent(1);
}
timer()
{
if (countdown > 0)
{
llSay(0, (string)countdown);
countdown--;
} else {
llSay(0, "Resetting";);
llResetScript();
}
}
}

just using 1 sec timer for the example :)

edit: hard to know exatly what you want but you can control what it says with using a simple check, just define what you want it to say at each state

Took me a bit to figure out what exactly that was doing lol. must be early... anyway

Alicia did a perfect countdown for what you're doing it seems, but can't be sure... well ... she did a good no-state change, no loop countdown anyway.

You can't use a timer, then another time unfortunately, because it is an event... it would just be odd. You'd have two sections that were
timer()
as an event, and they would conflict...

So you have to do workarounds to that.

Also, though not generally recomended, you can use llSleep to pause before doing anything. With short pauses it doesn't hurt much, but longer pauses will queue up weverything and be not so happy... you could do it, but Alicia's method is a bit better.
_____________________
In-world, I am Okiphia Rayna. This account is an alt, and is the only account I currently have with payment info on-file due to some account cracking that took place. This is a security measure at present, and I may return to the forums as Okiphia Rayna at a later date.

If you need to reach me, IM Okiphia Rayna, not Okiphia Anatine
Kurt Ludd
"The Gesture maker"
Join date: 27 Sep 2005
Posts: 229
ty Alicia and Okiphia
01-11-2008 09:31
Alicias will work fine for what I need ty


Still dont quite get why the other didnt work


This was the simple start of what I had


default
{
touch_start(integer num)

{llSetTimerEvent(5.0);

}
timer()
{
llSay(0, "One";);
}
timer()
{


llSay(0, "Two";);

}
}
I assumed it would wait 5 sec between the timers to do the says based on reading the wiki LOL
_____________________
Kurt Ludd
"The Gesture Maker" with 4000+ Gestures
Try a FREE 12 Gesture HUD at http://slurl.com/secondlife/Malra/15/57/66
Alicia Sautereau
if (!social) hide;
Join date: 20 Feb 2007
Posts: 3,125
01-11-2008 09:34
that is because there are 2 timers in the same state, only 1 allowed per state

gimme a minute to fiddle around with something :)
_____________________
Kurt Ludd
"The Gesture maker"
Join date: 27 Sep 2005
Posts: 229
Sure TY Alicia
01-11-2008 09:51
Thanks Alicia...its appreciated :)
_____________________
Kurt Ludd
"The Gesture Maker" with 4000+ Gestures
Try a FREE 12 Gesture HUD at http://slurl.com/secondlife/Malra/15/57/66
Okiphia Anatine
Okiphia Rayna
Join date: 22 Nov 2007
Posts: 454
01-11-2008 09:52
From: Kurt Ludd
Alicias will work fine for what I need ty


Still dont quite get why the other didnt work


This was the simple start of what I had


default
{
touch_start(integer num)

{llSetTimerEvent(5.0);

}
timer()
{
llSay(0, "One";);
}
timer()
{


llSay(0, "Two";);

}
}
I assumed it would wait 5 sec between the timers to do the says based on reading the wiki LOL

If you look, you have two events called
timer()
with no way to differentiate. This makes it so when one timer runs out.. it tries to do both at oncve, which goes haywire. States are not done in order, they are jumped to. You could have a timer event listed much later in the script, and it would still be executed the same.
_____________________
In-world, I am Okiphia Rayna. This account is an alt, and is the only account I currently have with payment info on-file due to some account cracking that took place. This is a security measure at present, and I may return to the forums as Okiphia Rayna at a later date.

If you need to reach me, IM Okiphia Rayna, not Okiphia Anatine
Alicia Sautereau
if (!social) hide;
Join date: 20 Feb 2007
Posts: 3,125
01-11-2008 09:52
integer countdown = 5;
list countdown_list = ["zero", "one", "two", "three", "four", "five"];

default
{
touch_start(integer number)
{
llSay(0, "Starting count down from "+ llList2String(countdown_list, countdown));
llSetTimerEvent(1);
}

timer()
{
if (countdown > 0)
{
llSay(0, llList2String(countdown_list, countdown) );
countdown--;
} else {
llSay(0, "Resetting";);
llResetScript();
}
}
}


if you lookup the llList2String function on the wiki (http://www.lslwiki.net/lslwiki/wakka.php?wakka=lllist2string), you can see that i made a list with the numbers as text
calling the corrosponding list entry on countdown to get the text version

when countdown = 5, llList2String(countdown_list, 5 (as countdown is 5 at this time)
when countdown = 4, llList2String(countdown_list, 4 (as countdown is 4 at this time)

have added a "zero" to the list because list entries start at "0", so if you disect the list to numbers you get:

myString = [0, 1, 2, 3, 4, 5]

so without "zero", you would get:

list countdown_list = ["one", "two", "three", "four", "five"];

countdown = 5
llList2String(countdown_list, countdown)

will return empty as countdown 5 is actually 6th entry in the list
you could simple add a minus in it to save a few bits in memory as the list is smaller

llList2String(countdown_list, (countdown - 1))

this would make countdown 5 call for list entry 4, added the () to it to make it clear something else is happening in that line


edit: with the "zero" in the list, you can use it aswell with changing "if (countdown > 0)" to "if (countdown >= 0)" and remove the llSay(0, "Resetting";); from } else { so after it says "0", the script resets with no message
_____________________
Kurt Ludd
"The Gesture maker"
Join date: 27 Sep 2005
Posts: 229
Wow Alicia
01-11-2008 10:01
Thankyou very much


I am still a novice at this scripting :)


Ty again for the excellent help...:))
_____________________
Kurt Ludd
"The Gesture Maker" with 4000+ Gestures
Try a FREE 12 Gesture HUD at http://slurl.com/secondlife/Malra/15/57/66
Alicia Sautereau
if (!social) hide;
Join date: 20 Feb 2007
Posts: 3,125
01-11-2008 10:09
From: Kurt Ludd
Thankyou very much


I am still a novice at this scripting :)


Ty again for the excellent help...:))

yw :)

i`d really recommend bookmarking the wiki to lookup things you want to use but give errors on tries :)
also there are a good amount of example scripts in the examples and library wich can show how others do stuff that you want to do but have no clue on how to do it ;)

https://wiki.secondlife.com/wiki/LSL_Portal
http://lslwiki.net/lslwiki/wakka.php?wakka=HomePage

also here in the library forum there are tons of scripts to look trough
_____________________