Hawiian Shirt help button
This is/will be a button someone can press to get the attention of THS who are currently online.
This bit goes in the ROOT PRIM. It sends a linked message to the other linked prims to do something fun (be it colour changing, or movement etc). It checks to see who is online from the list of helpteamkeys. It IMs everyone on the list (if you aren't online it should go to some catchall email address somewhere that you don't need to worry about), if no one is online it will say no one is online. You can get the UUIDs from w-hat.com/name2key. Can play with the timings etc. Would be nicer if it only IMed the online people, but havent quite figured out how to do that yet.
//help button v2 30/1/08 //made by olly (adapted from dans first version) //this uses the list of uuids in helpteamkeys to find out who is online and then sends an IM to EVERYONE asking for help/assistance. //it sends a message to ALL LINKED prims so they can be activated to do what ever you want. This must be in the ROOT prim. //User variables list helpteamkeys = ["d959f6a1-8516-4ee4-b60f-dac4368d3811"]; //faji bing string helpmessage = ""; vector untouched_prim_colour = <0,1,0>; //green vector touched_prim_colour = <1,0,0>; //red //System variables // list of keys used for matching queryid in data server events list keylist = []; vector objectRestPos; // at rest position of object vector objectPos; // keeps track of current position string whois; //who pressed the button. integer no_of_data_server_events=0; integer online=0; default { state_entry() { llSetColor(untouched_prim_colour, ALL_SIDES ); } touch_start(integer total_number) { whois = llDetectedName(0); llSay(0, "Hello "+whois+". You have pressed the Hawiian shirts help button."); state try_IM; } } state try_IM { state_entry() { llMessageLinked(LINK_ALL_OTHERS,0,"pressed",""); llSetColor(touched_prim_colour, ALL_SIDES ); helpmessage = whois + " is in need of help/advice at " + (string)llGetPos(); integer i; for (i=0; i<llGetListLength(helpteamkeys); i++) //find out who is online { keylist += llRequestAgentData(llList2String(helpteamkeys,i), DATA_ONLINE); llInstantMessage(llList2String(helpteamkeys,0),helpmessage); //send an IM to everyone } } dataserver(key queryid, string data) //if online then IM them. { if ((integer)data == 1) { //Someone is online online=1; } else { //No one is online } no_of_data_server_events++; if(no_of_data_server_events==llGetListLength(helpteamkeys)) { state report_back; } } } state report_back { state_entry() { if(online==1) { llSay(0, "I have sent an IM to the hawiian shirts that are online. Hopefully someone will come soon."); } else { llSay(0, "No one from The Hawiian Shirts is online right now. If it is urgent then try the staff button"); } llSleep(5); llResetScript(); } }
This goes in something that you want to change when the button is pressed.
vector untouched_prim_colour = <0,1,0>; //green vector touched_prim_colour = <1,0,0>; //red default { state_entry() { llSetColor(untouched_prim_colour, ALL_SIDES ); } link_message(integer source, integer num, string str, key id) { llSetTimerEvent(5); llSetColor(touched_prim_colour, ALL_SIDES ); } timer() { llResetScript(); } }