Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Question about a radio script (PLEASE DON'T WRITE A SCRIPT FOR ME)

Tristan Otoole
Registered User
Join date: 10 Jan 2007
Posts: 2
01-21-2007 20:25
PLEASE DON'T WRITE A SCRIPT FOR ME!!!

Just help me out. =D

CODE

integer listenID;
integer chan = 0;
default
{
state_entry()
{

llSetText("", <1,1,1>,1);


llListenRemove(listenID);
listenID = llListen(chan, "", llGetOwner(), "");
llListenControl(listenID, FALSE);
}

touch_start(integer total_number)
{

if(llDetectedGroup(0)) return;


llListenControl(listenID, TRUE);
llSay(0, "Ready for radio url.");

llSetTimerEvent(30);
}
timer()
{

llSay(0, "Sorry your time has expired.");
llSay(0, "If you wish to change Music station agian then please click again and say the music URL you wish to change to including the 'http://' section.");

llSetTimerEvent(0.0);

llListenControl(listenID, FALSE);
}

listen(integer channel, string name, key id, string msg)
{

string station = msg;


llSay(0, "URL registered as: " + station);


llSetParcelMusicURL(station);


llSetTimerEvent(0.0);
llListenControl(listenID, FALSE);

llSetText(station, <1,1,1>,1);
}

on_rez(integer start_param)
{

llResetScript();
}
}


Okay so this is What I'm working with right now. This was an example radio script and I wanted to modify the script so that it would only ask for a URL when a person is part of a particular group. Unfortunately that hasn't been working.

What am I doing wrong?

How can I correct the mistake?

What techniques can I use to improve this script?


PLEEEEEEASE Don't write a script for me and just hand it to me. I'm eager to learn about scripting. The more I learn the less I have to bug the forum Heh.

Thanks in advanced for any help that is given to me.

Cheers!
Korneilius Worthington/Tristan Otoole
Kala Bijoux
Material Squirrel
Join date: 16 Nov 2004
Posts: 112
01-21-2007 21:21
I think you need the llSameGroup function. This line:

CODE
if(llDetectedGroup(0)) return;


Sort-of means "If the person who touched me has a group, then return". Or something like that. So basically, the function will usually just return and do nothing. I don't know what will happen if the person has no active group set.

Either way, look at this link, I think that's the function you want.
_____________________
http://materialsquirrel.blogspot.com/
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
01-21-2007 22:37
From: Tristan Otoole
I wanted to modify the script so that it would only ask for a URL when a person is part of a particular group. Unfortunately that hasn't been working.

This line:
CODE
         if(llDetectedGroup(0)) return;

essentially says "if the person who touched me is wearing the tag of the group I'm assigned to, abort." You want a ! before llDetectedGroup, so that it instead says "if the person who touched me is not wearing the tag..."
Tristan Otoole
Registered User
Join date: 10 Jan 2007
Posts: 2
01-21-2007 23:25
I also noticed at the top of the script the llGetOwner function. How can I change that part of the script so the group member can give the radio the URL instead?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-22-2007 00:28
From: Tristan Otoole
I also noticed at the top of the script the llGetOwner function. How can I change that part of the script so the group member can give the radio the URL instead?


Remove the owner specific listen as you are filtering on the group in the listen event.

CODE
listenID = llListen(chan, "", "","");