Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llListen question

Ruboneout Shoreman
Registered User
Join date: 29 Jul 2009
Posts: 38
09-03-2009 17:30
I have a script that is similiar to the one I'm going to type below

integer channel;
default
{
state_entry()
{
channel = llRound(llFrand(100));
llListen(channel,"",llGetOwner(),"";);
}

touch_start(integer i)
{
llSetTimerEvent(10);
}

timer()
{
channel = llRound(llFrand(100));
llSay(0,"the new channel is " + (string)channel);
llSetTimerEvent(0);
}


That is pretty much a part of my script and I was wondering what I am doing wrong. The first number generated will work and I can get responses from my script for that. However when the timer goes off the new number will not work. When ever I type on that channel I do not get a response.
Thanks for your help.
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
09-03-2009 17:42
From: Ruboneout Shoreman
I have a script that is similiar to the one I'm going to type below

integer channel;
default
{
state_entry()
{
channel = llRound(llFrand(100));
llListen(channel,"",llGetOwner(),"";);
}

touch_start(integer i)
{
llSetTimerEvent(10);
}

timer()
{
channel = llRound(llFrand(100));
llSay(0,"the new channel is " + (string)channel);
llSetTimerEvent(0);
}


That is pretty much a part of my script and I was wondering what I am doing wrong. The first number generated will work and I can get responses from my script for that. However when the timer goes off the new number will not work. When ever I type on that channel I do not get a response.
Thanks for your help.



You are still listening on the first channel. Add a new Listen after you create a new channel in your timer.

:-)
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-03-2009 17:54
Something like this...

CODE

integer channel;
integer handle;

default
{
state_entry()
{
channel = llRound(llFrand(100));
handle = llListen(channel,"",llGetOwner(),"");
}

touch_start(integer i)
{
llSetTimerEvent(10);
}

timer()
{
llListenRemove (handle);
channel = llRound(llFrand(100));
llSay(0,"the new channel is " + (string)channel);
handle = llListen(channel,"",llGetOwner(),"");
llSetTimerEvent(0);
}
}
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ruboneout Shoreman
Registered User
Join date: 29 Jul 2009
Posts: 38
09-03-2009 17:54
Thank you! as you can tell. I am not good at scripting at all but I'm trying to learn
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-03-2009 21:43
Unless you have a real need for all of those channels, you should also make provision in your script for removing their handles once you no longer have need for them. A clean sim is happy sim. :)
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Raster Teazle
Registered User
Join date: 13 Sep 2005
Posts: 114
09-04-2009 00:18
As Rolig has mentioned and Sindy has implemented to your script you should always grab the handle on a listen that you open then use that handle to close the listen after it is no longer needed. Too many open listens in a sim will cause enough lag to slow everything down as the sim will still process the listens even if they are not used.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
09-04-2009 00:27
They will also crash your script, I think, if it has more than 65 listens open at once.