User:Icktoofay Kamachi/Insane Titler

From Second Life Wiki
< User:Icktoofay Kamachi
Revision as of 18:47, 20 January 2009 by Icktoofay Kamachi (talk | contribs) (Slightly changed header.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

This is a simple script that allows others (however, not you) to change your title. (or rather, text floating above your head) There are some other scripts like this that are not free, so I decided to make an open source one. To use this, create a prim, resize it to your preferred size, add this script to it, put a transparent texture on it, and attach to your head. Please don't sell this. (if you want though you can give it away as a freebie as long as it's fullperms)

insaneTitler.lsl

<lsl>// Copyright (c) 2009 icktoofay Kamachi. Some rights reserved. // Licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0/us/

string getFirstName(string name) { return llList2String(llParseString2List(name,[" "],[" "]),0); }

key owner; vector color=<0,1,0>; float alpha=1; string text="There's no title yet!"; integer chan=74; float changeTime=300; float changeRandomness=900; float changeTimeout=45;

default { state_entry() { llSetObjectName("Insane Titler"); llSetText("",<1,1,1>,1); owner=llGetOwner(); state waiting; } } state waiting { state_entry() { llSetText(text,color,alpha); llSetTimerEvent(changeTime+llFrand(changeRandomness)); } on_rez(integer param) { if(llGetAttached()==0) { llResetScript(); } } attach(key id) { if(id!=NULL_KEY) { if(llGetOwner()!=owner) { llResetScript(); } } } timer() { llSetTimerEvent(0); state changeit; } } state changeit { state_entry() { llSay(0,getFirstName(llKey2Name(owner))+" needs a new title! To set it, anyone may say /"+(string)chan+" [title]. "+getFirstName(llKey2Name(owner))+" is unable to change it."); llListen(chan,"",NULL_KEY,""); llSetTimerEvent(changeTimeout); } state_exit() { llSetTimerEvent(0); } on_rez(integer param) { if(llGetAttached()==0) { llResetScript(); } } attach(key id) { if(id!=NULL_KEY) { if(llGetOwner()!=owner) { llResetScript(); } } } listen(integer channel,string name,key id,string message) { if(id!=owner) { if(llGetOwnerKey(id)==id) { text=message; string ofn=getFirstName(llKey2Name(owner)); llSay(0,getFirstName(name)+" has set a new title for "+ofn+"! "+ofn+" will have to live with this title until the next chance for it to be changed."); state waiting; } }else{ llOwnerSay("You can't change your own title, "+getFirstName(llKey2Name(owner))+"!"); } } timer() { string ofn=getFirstName(llKey2Name(owner)); llSay(0,"Nobody cares about "+ofn+", so I guess they'll have to stick with that title for now."); state waiting; } } </lsl>