Jump to content

Set Permissions Based on Position


PsyberMind
 Share

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

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

Recommended Posts

It's a real simple script... I got it off the wiki, doesn't do a whole lot right now.. Keep in mind I'm still learning LSL

 

integer DEDICATION_CHANNEL = 98;list requests = []; default{     touch_start(integer total_number)    {        if(llDetectedKey(0) != llGetOwner())            jump user;        if(llGetListLength(requests) == 0) {            llOwnerSay("No dedications are currently lined up.");            return;        }        llOwnerSay("----------------- BEGIN REQUESTS ------------------");        integer itra;        for(itra=0; itra<llGetListLength(requests); itra+=3) {            llOwnerSay(llList2String(requests, itra) + " requested the song: " + llList2String(requests, itra+1));            llOwnerSay("With the dedication: " + llList2String(requests, itra+2));            if(itra+3<llGetListLength(requests)-1)                llOwnerSay("-------------------------------------------------------");        }        llOwnerSay("------------------ END REQUESTS -------------------");        return;@user;        integer comHandle = llListen(DEDICATION_CHANNEL, "", llDetectedKey(0), "");        llInstantMessage(llDetectedKey(0), "To request the song \"That's Life - Frank Sinatra\" with the dedication \"For my friend Lydia, I love you!\", you would type into the main chat:\n\n/" + (string)DEDICATION_CHANNEL + " That's life - Frank Sinatra%For my friend Lydia, I love you!\n\nThe forward-slash and the number after the slash are important.");    }     listen( integer channel, string name, key id, string message )    {        if(channel != DEDICATION_CHANNEL) return;         requests +=  (list)name + llList2List(llParseString2List(message, ["%"], [""]), 0, 0) + llList2List(llParseString2List(message, ["%"], [""]), 1, 1);        llInstantMessage(id, "Thank you! Your dedication has been stored and will be played at the DJ's convenience.");    }}

 

Link to comment
Share on other sites

Um.... You said YOU created a script?  If you got this one off "the wiki", let someone else take the blame.  It's not a well-written script at all. There's no need for the jump commands or the returns.  Simple ordering of the choices would have done the job.  Also, the script opens a new instance of comChannel each time a guest touches it, but it never closes them. That adds lag to the sim and may eventually hit the cap of 65 open listens.  There's also no way to remove things from the requests list once the DJ has played them, so the list can get unwieldy.

I don't usually like to make massive corrections in someone else's script, but I can't just repeat the simple answer I gave you earlier.  Here's an improved version of the script (still not the best, but it takes care of a lot of the problems and inserts your DJ into the permission list):

integer DEDICATION_CHANNEL = 98;key DJ = "a822ff2b-ff02-461d-b45d-dcd10a2de0c2"; //Put the DJ's REAL UUID in the quotes hereinteger comHandle;list requests = [];default{	touch_start(integer total_number)	{		key Av = llDetectedKey(0);		if((Av == llGetOwner())||(Av == DJ)) // Here's the answer to your question, BTW		{			if(llGetListLength(requests) == 0)			{				llRegionSayTo(Av,0,"No dedications are currently lined up.");			}			else			{				llRegionSayTo(Av,0,"----------------- BEGIN REQUESTS ------------------");				integer itra;				for(itra=0; itra<llGetListLength(requests); itra+=3)				{					llRegionSayTo(Av,0,llList2String(requests, itra) + " requested the song: " + llList2String(requests, itra+1));					llRegionSayTo(Av,0,"With the dedication: " + llList2String(requests, itra+2));					if(itra+3<llGetListLength(requests)-1)						llRegionSayTo(Av,0,"-------------------------------------------------------");				}				llRegionSayTo(Av,0,"------------------ END REQUESTS -------------------");			}		}		else		{			comHandle = llListen(DEDICATION_CHANNEL, "", Av, "");			llRegionSayTo(Av,0, "To request the song \"That's Life - Frank Sinatra\" with the dedication \"For my friend Lydia, I love you!\",you would type into the main chat:\n\n/" + (string)DEDICATION_CHANNEL + " That's life - Frank Sinatra%For my friend Lydia, I love you!\n\nThe forward-slash and the number after the slash are important.");		}	}	listen( integer channel, string name, key id, string message )	{		llListenRemove(comHandle);		requests +=  (list)name + llList2List(llParseString2List(message, ["%"], [""]), 0, 0) + llList2List(llParseString2List(message, ["%"], [""]), 1, 1);		llRegionSayTo(id,0, "Thank you! Your dedication has been stored and will be played at the DJ's convenience.");	}}

 

 

Link to comment
Share on other sites

I just re-read my post and realized my hands got in the way of my brain.. I meant to say I created an object that has script attached to it.. My apologies.

 

Thank you, this helps tremendously, and gives me a great jumping off point to expand on it.

 

Ok.. So what I want to do is basically as a learning experience, and to expand on the object.. If someone touches the object, it gets their user name. If they are a DJ, it lists the requests, if not, it plays the instructions for making a request.. SO.. that being said.. I'm looking at a moderate IF/ELSE statement..

 

get av name

IF av name = DJ

play request list

ELSE

play instructions

 

Keeping in mind my lack of experience with LSL, but I do have a decent knowledge of other scripting languages, just gotta get the nuances of LSL, will that logic work?

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4521 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...