Jump to content

GloriaGlitter

Resident
  • Posts

    80
  • Joined

  • Last visited

Everything posted by GloriaGlitter

  1. Hi there - I was given a dump of our group members keys. For my project, I need a notecard of legacy names rather than keys. So I thought I'd write a quick script to read the notecard and output the legacy names which I'd cut and paste from the chat window to a notecard. My script correctly reads the notecard which I can see by the first llOwnerSay but the llRequestAgentData doesn't give the corresponding legacy name but some other key. I imagine I have made an error in the dataserver part of the script. Using notecard called 'keylist' with 3 keys to test: 8cdf1317-e9c2-41f6-a0e3-793f69fc76dc 5b6e2121-5847-4b84-a260-3dd37f4d0d65 2d55c505-9530-40a9-a153-ce3878b0314b this is my script: string NOTECARD = "keylist"; //Name of notecard containing group member keys key namekey; string resident; integer intLine1 = 0; default { state_entry() { namekey = llGetNotecardLine(NOTECARD, 0); } dataserver(key keyQueryId, string Data) { if (keyQueryId == namekey) { if (Data != EOF) namekey = llGetNotecardLine(NOTECARD, ++intLine1); llOwnerSay("namekey = " + (string)Data); //test to check notecard read ok resident = llRequestAgentData(Data, DATA_NAME); llOwnerSay ("Resident = " + resident); } } touch_start(integer x) { llResetScript(); } }
  2. Rachel and Molly - thanks a lot for your valuable input - I've got the scripting running lovely now
  3. Just using the script with some test full perm objects as prizes but still getting some inconsistent behaviours such as multiple resetting after the elapsed time. Is there something obvious with the timer that is causing this or another reason why it triggers multiple times every few cycles? Thanks.
  4. That is a useful observation - I will have some no-copy items in there so it would be best if I edited out that option from the script - thanks.
  5. Hi there - I am working with a 'mystery prize' script that I found in the library that I have simplified to remove unwanted options etc. The concept is that the script picks a letter at random and selects a random prize. If someone's names begins or ends with the selected letter, then they can touch the object and collect the mystery prize. The letter and prize resets after a set period of time. The script works about 90% of the time but occasionally it will reset itself twice or three times right after each other rather than once. Also, I've set the interval to be two minutes for the sake of testing but occasionally the interval is only 1 minute and at another time it might be 3 minutes. I think perhaps that there is a conflict with the timer. Once I get this part working properly, I will try to to add in some extra code to display the amount of time left before the next reset so that avatars can decide whether to stay for the next reset. Grateful for any suggestions as to why the script appears not to be consistent. This is the script: integer use_channel_output = 1; //do we want to shout on channels when someone wins a prize? integer channel = -999; //the channel we will shout on IF we are shouting on channels integer use_notify_owner = 1; //do we want to tell our owner when we give out prizes? integer time_reset_minutes = 2; //how often do we need to reset and pick new random credentials? //------------------------------------------------------------------------------ dotouch(key id) //function for when someone touches this prim { integer winner = 0; //we currently do not have a winner string out = "\n"; //text output for user if(llToUpper(llGetSubString(llKey2Name(id),0,0))==name || llToUpper(llGetSubString(llKey2Name(id),-1,-1))==name) { //if the person who touched this prim has a first name that starts with the random letter or a last name that ends with the random letter we have a winner winner = 1; }else { out += "your name does not start with or end with "+name+"\n"; } if(winner == 1)//if we have a winner { llSay(0,"CONGRATZ!!!!!!!!!!! YOU WIN");//tell the world payout(id);//give out the prize if(1==1)state get_rand;//refresh our credentials }else//if not tell the user they didnt win and why { llSay(0,"Sorry but"+out); } } dorandletter()//function to pick a random character { integer purely_random = 0; integer i = 0; do{ llSetText("PICKING A RANDOM LETTER....\n["+llGetSubString(charmap,purely_random,purely_random)+"]",<1,1,1>,1); purely_random = llFloor(llFrand(llStringLength(charmap))); i++; }while(i < 100); name = llGetSubString(charmap,purely_random,purely_random); } dorandominventory()//function to pick a random inventory item to give out. { integer purely_random = 0; integer i = 0; do{ purely_random = llFloor(llFrand(llGetInventoryNumber(INVENTORY_ALL))); string n = llGetInventoryName(INVENTORY_ALL,purely_random); if(n!=llGetScriptName() && n!="_config") { llSetText("PICKING A RANDOM ITEM \n["+n+"]",<1,1,1>,1); item = n; } i++; }while(i < 100); } string name;//the letter we have picked at random string item;//the random inventory item we are giving away string charmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";//list of characters in the form of a string. random_contains()//fetch all our randomness { dorandletter();//get the letter dorandominventory();//grab an item string sep = "\n"; string line1 = "If your Name Starts OR Ends with the Letter "+name; string line4 = "Touch me for the Mystery Prize inside."; string out; out += line1+sep; out += line4+sep; //create the text and float it llSetText(out,<1,1,1>,1); } payout(key id)//function to give out the item to the winner. { llGiveInventory(id,item);//give the item to the winner llSleep(3.0);//take a short break llParticleSystem([]);//kill the particles if(use_channel_output == 1)//if we are allowed to talk on channels do that now { llSay(channel,"MYSTERY_PAYOUT|"+(string)id); } if(use_notify_owner)//if we are allowed to tell our owner about the winner do that now { llInstantMessage(llGetOwner(),"gave "+item+" to "+llKey2Name(id)); } } default { on_rez(integer sp) { llResetScript(); } changed(integer c) { if(c & CHANGED_INVENTORY) { llResetScript(); } } state_entry() { llSetText("CONFIGURING MYSTERY SYSTEM...",<1,1,1>,1); state get_rand; } } state get_rand { on_rez(integer sp) { llResetScript(); } changed(integer c) { if(c & CHANGED_INVENTORY) { llResetScript(); } } state_entry() { random_contains(); state running; } } state running { on_rez(integer sp) { llResetScript(); } changed(integer c) { if(c & CHANGED_INVENTORY) { llResetScript(); } } state_entry() { llResetTime(); llSetTimerEvent(1.0); llSay(0, "**reset**"); //for debug so I can check how often the timer is reset } timer() { float time = llGetTime(); if((integer)time % (60*time_reset_minutes) == 0) { state get_rand; } } touch_start(integer total_number) { dotouch(llDetectedKey(0)); } }
  6. Pity such a function not available but thanks for considering the question
  7. This is my project - I'm making a TP board for a store elevator - if you click on say 'Floor 3' button then you go to floor 3. Just thought it would be neat to glow the button as the mouse hovered over it so the user could be sure of clicking the right button.
  8. Is it possible to detect when a user's mouse points at a prim? I want to be able to change the texture of a prim when a mouse points at it. I couldn't find a detection event for this but It should be possible since the cursor changes shape when pointing at an object with a sit pose in it for instance. Thanks.
  9. Removing the close_menu function and calls to it rather than putting in a listener, looks like it might have solved the problem - an object relating to a resident who came online lit up within a minute now. I'll place the amended script now in all the objects and monitor this. Thanks both.
  10. Thanks Rolig. So, the open and close menu routines are for when someone clicks the object to view the relevant resident's profile - is the close_menu routine in the http_response section superfluous and can I get rid of it and could that help with my problem? edit - just saw reply from Nova as I posted this. Thanks Nova, will look at the menu part.
  11. I have a script that will display the profile picture of a resident on a prim. The object also has a linked prim below that will display a texture depending whether the resident is online or not and if online will set both linked prims to bright. I've used some open source script which I've amended to suit my purpose. Here is a picture of two of these objects- https://gyazo.com/4cecd0bcd757d662c9eccb55952d4659 My question relates to the time it can take to update the status from offline to online and vice versa - sometimes it can take up to 10 minutes to update but if I manually reset the script then it is pretty much instantaneous. Is there something I could do to my script such as changing the timer time or something else to speed this up or this slowness due to having many copies of this object, each for a different resident? Here is the script: key user_key = "5b6e2121-5847-4b84-a260-3dd37f4d0d65"; // Gloria string url = "http://world.secondlife.com/resident/"; key blank = "d21944ec-cd6d-91de-2701-4080dc90ceb7"; //UID of silhouette image string name; key toucher; string status; string mainMenuDialog; list mainMenuButtons = []; integer dialogChannel; integer dialogHandle; string profile_key_prefix = "<meta name=\"imageid\" content=\""; string profile_img_prefix = "<img alt=\"profile image\" src=\"http://secondlife.com/app/image/"; integer profile_key_prefix_length; // calculated from profile_key_prefix in state_entry() integer profile_img_prefix_length; // calculated from profile_img_prefix in state_entry() open_menu(key inputKey, string inputString, list inputList) { dialogChannel = (integer)llFrand(DEBUG_CHANNEL)*-1; dialogHandle = llListen(dialogChannel, "", inputKey, ""); llDialog(inputKey, inputString, inputList, dialogChannel); llSetTimerEvent(60.0); } close_menu() { llSetTimerEvent(0.0);// you can use 0 as well to save memory llListenRemove(dialogHandle); } string strReplace(string str, string search, string replace){ return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); } default { state_entry() { profile_key_prefix_length = llStringLength(profile_key_prefix); profile_img_prefix_length = llStringLength(profile_img_prefix); llSetText("", <1,0,0>, 1.0); llSetTexture(blank, ALL_SIDES); llRequestAgentData( user_key, DATA_NAME); } dataserver(key queryid, string data) { name = data; name=llToUpper(name); name = strReplace(name, "RESIDENT",""); llSetObjectName("--- " + name + " ---"); state show; } } state show { state_entry() { llSetTimerEvent(10); } timer() { llHTTPRequest( url + (string)user_key,[HTTP_METHOD,"GET"],""); llRequestAgentData( user_key, DATA_ONLINE); close_menu(); } on_rez(integer start_param) { llSetText("", <1,0,0>, 1.0); llSetTexture(blank, ALL_SIDES); } http_response(key request_id,integer status, list metadata, string body) { string profile_pic; integer s1 = llSubStringIndex(body, profile_key_prefix); integer s1l = profile_key_prefix_length; if(s1 == -1) { // second try s1 = llSubStringIndex(body, profile_img_prefix); s1l = profile_img_prefix_length; } if (s1 == -1) { // still no match? profile_pic = blank; } else { profile_pic = llGetSubString(body,s1 + s1l, s1 + s1l + 35); if (profile_pic == (string)NULL_KEY) { profile_pic = blank; } } llSetTexture(profile_pic, ALL_SIDES); } dataserver(key queryid, string data) { if ( data == "1" ) { llSetLinkTexture(2,"0c636dfb-74fa-b375-d145-fde043b5e1d1",ALL_SIDES); llSetLinkPrimitiveParamsFast(2,[ PRIM_FULLBRIGHT, ALL_SIDES, TRUE ]); llSetLinkPrimitiveParamsFast(1,[ PRIM_FULLBRIGHT, ALL_SIDES, TRUE ]); } else if (data == "0") { llSetLinkTexture(2,"18a4e4ac-4126-60e6-17f8-d3cbc320dbd0",ALL_SIDES); llSetLinkPrimitiveParamsFast(2,[ PRIM_FULLBRIGHT, ALL_SIDES,FALSE ]); llSetLinkPrimitiveParamsFast(1,[ PRIM_FULLBRIGHT, ALL_SIDES,FALSE ]); } } touch_start(integer num_detected) { toucher = llDetectedKey(0); close_menu(); mainMenuDialog = "\nClick link to open profile and/or send IM to secondlife:///app/agent/" + (string)user_key + "/about"; open_menu(toucher, mainMenuDialog, mainMenuButtons); } }
  12. Hi there - I am writing a simple dialog menu that just has two buttons - one to display a link to a persons profile page and the other to send them an IM message. Where I'm tripping up is that the listener listens to the menu button label - in this case 'Send IM'. This opens up a textbox for the user to type their message - somehow within this listen event, I then need to listen to the typed message and then send that to the target avatar. Here is my script - getting a syntax error on the listen within the listen: ---------------------- string mainMenuDialog; list mainMenuButtons = ["Profile", "Send IM"]; string subMenu_01_Dialog; list subMenu_01_Buttons = []; key user_key="2d55c505-9530-40a9-a153-ce3878b0314b"; integer dialogChannel; integer dialogHandle; key toucher; open_menu(key inputKey, string inputString, list inputList) { dialogChannel = (integer)llFrand(DEBUG_CHANNEL)*-1; dialogHandle = llListen(dialogChannel, "", inputKey, ""); llDialog(inputKey, inputString, inputList, dialogChannel); llSetTimerEvent(60.0); } close_menu() { llSetTimerEvent(0.0);// you can use 0 as well to save memory llListenRemove(dialogHandle); } default { touch_start(integer total_number) { string name = llDetectedName(0); toucher = llDetectedKey(0); // Ensure any outstanding listener is removed before creating a new one close_menu(); mainMenuDialog = "\nProfile and Send IM for secondlife:///app/agent/" + (string)user_key + "/about"; open_menu(toucher, mainMenuDialog, mainMenuButtons); } listen(integer channel, string name, key toucher, string message) { if(channel != dialogChannel) return; close_menu(); if(message == "Profile") { subMenu_01_Dialog = "\nFor profile, click link: secondlife:///app/agent/" + (string)user_key + "/about"; open_menu (toucher, subMenu_01_Dialog, subMenu_01_Buttons); } else if(message == "Send IM") { llTextBox(toucher, "Write your message and click 'Submit' (max 512 chars", channel); } listen(integer channel, string name, key toucher, string IMmessage) { llInstantMessage (user_key, "Message from: " + name + " - '" + IMmessage + "'"); } } timer() { close_menu(); llWhisper(0, "Disabling Menu"); } }
  13. I have made a pirates treasure chest. I have the base and the lid as two separate prims. The lid opens and closes nicely. Ideally I'd like to link the lid to the base so that if I move the chest, both parts move together and secondly so that you can click anywhere on the chest for the lid to open rather than just clicking on the lid. When I tried linking the prims the whole chest turned over when I clicked it.
  14. Pleased to say that with KT's input this script is working perfectly now - thanks to all
  15. So, I have successfully put some sitting animations into a chair and adjusted the positions to how I wanted them. The only issue I have now is that the helper object when put into my chair object deleted the chair texture - I don't have this texture in my inventory as it was part of the chair that I got from elsewhere - how can I stop the helper from deleting the texture?
  16. This is my first attempt at using AVsitter. I downloaded the files from github and created the scripts as directed. I have followed the instructions to create a box and put in the following files: [AV]sitA + [AV]sitB scripts [AV]adjuster script [AV]helper object AVpos notecard Plus 2 sit animations The next instructions is: 'Sit on your furniture, and the menu will appear' When I try and sit on this box, I am thrown off and get error message: "Do not sit on the helper with AVsitter2 unless you have enabled the old helper mode. Move the helper while sitting on the furniture. Please see instructions at http://avsitter.com" So I guess my first question at this stage is - how do I enable the old helper mode? UPDATE - I realised my error - I put the helper script in the box and not the helper object - doh! I would have deleted this post but could only see how to edit it.
  17. Thanks KT, very useful - now only those admins that are online get notified of the comings and goings at the place where this script is running. I just had to declare some variables as global so that the dataserver knew of them But, I may have broken something when I patched your code in since those online get an initial list of agents in the area and this list is repeatedly sent each time instead of those that have arrived or departed. Grateful for a once over to see where I might have made an error in incorporating this new piece of code: ----------------------- list im_recipients =["5b6e2121-5847-4b84-a260-3dd37f4d0d65","2d55c505-9530-40a9-a153-ce3878b0314b"]; // a list of the keys of the people who will get IMed - Gloria, Estella float timer_interval = 30.0; // how often to scan the area list previous_visitors; // a list of the people who were in the area for the last scan, a global value to preserve it between scans list current_visitors ; //made this into global variable string data; integer status; string test; key status_request_id; key im_recipient; string im_message; integer status_request_count; default { state_entry () { im_recipients += llGetOwner (); // add yourself on the messaging list. // llSetTimerEvent (timer_interval); // start the timer (and wait for it to trigger) llSensorRepeat("", "", AGENT, 100, PI, 20); //addded SensorRepeat } dataserver (key id, string data) { if (id == status_request_id) { if ((integer) data) llInstantMessage (im_recipient, im_message); // if the recipient is online send the IM if (status_request_count) // any more recipients? { im_recipient = llList2Key (im_recipients, --status_request_count); // if so, get their key status_request_id = llRequestAgentData (im_recipient, DATA_ONLINE); // and find out if they're online } } } sensor(integer num) { integer i; current_visitors=[]; for (i=0; i<num; i++) { if(llDetectedKey(0) != NULL_KEY) { current_visitors = current_visitors +llDetectedKey(i) ; } } list arrivals; list departures; integer count = llGetListLength (current_visitors); while (count) // for each current visitor (if any), working backwards through the list (beacuse it's easier) { key visitor = llList2Key (current_visitors, --count); // decrement the counter (to convert it to a list index, and also set it up for the while loop test next iteration) and get the visitor's key if (llListFindList (previous_visitors, [visitor]) == -1) // are they in the list of people who were here last time? { arrivals += llGetDisplayName (visitor); // if not, add their name to the list of new arrivals } } count = llGetListLength (previous_visitors); while (count) // for each visitor who was here last time { key visitor = llList2Key (previous_visitors, --count); if (llListFindList (current_visitors, [visitor]) == -1) // are they still here? { departures += llGetDisplayName (visitor); // if not, add their name to the list of departures } } // string im_message; moved declaration to global because of reference in dataserver if (arrivals) im_message += "Arrivals: " + llList2CSV (arrivals) + "\n"; // if there are any new arrivals, add their names, seperated by commas, to the IM message if (departures) im_message += "Departures: " + llList2CSV (departures); // if there are any departures, add their names to the message if (im_message) // is there anything to report? { status_request_count = llGetListLength (im_recipients); // how many recipients? im_recipient = llList2Key (im_recipients, --status_request_count); // for the first one, get their key status_request_id = llRequestAgentData (im_recipient, DATA_ONLINE); // and find out if they're online } previous_visitors = current_visitors; // save the list of current visitors for next time; } }
  18. Before I rework the script to be more efficient as has been suggested, I've been trying to incorporate a dataserver event so that I only send the IMs of who has arrived and left to the list of sub-admins only if they are on online, so that their emails are not full of messages about arrivals and departures. My idea is that my online sub-admins will know who is coming and going and can interact with the visitors if required. I am still working on the original posted script to get this bit right before proceeding further but I have a type mismatch in llRequestAgentData which I cant figure out. -------------------------- list im_recipients =["5b6e2121-5847-4b84-a260-3dd37f4d0d65","2d55c505-9530-40a9-a153-ce3878b0314b"]; // a list of the keys of the people who will get IMed - Gloria, Estella list previous_visitors; // a list of the people who were in the area for the last scan, a global value to preserve it between scans list current_visitors ; //made this into global variable string data; integer status; key owner_key; string test; default { state_entry () { owner_key = llGetOwner (); im_recipients += owner_key; // add yourself on the messaging list. llSetTimerEvent (timer_interval); // start the timer (and wait for it to trigger) llSensorRepeat("", "", AGENT, 100, PI, 20); //addded SensorRepeat } dataserver(key queryid, string data) { if ((string)status == queryid) test = data; } sensor(integer num) { integer i; current_visitors=[]; for (i=0; i<num; i++) { if(llDetectedKey(0) != NULL_KEY) { current_visitors = current_visitors +llDetectedKey(i) ; } } list arrivals; list departures; // list current_visitors = llGetAgentList (AGENT_LIST_PARCEL, []); // get the list of who's here now - commented out while testing sensor integer count = llGetListLength (current_visitors); while (count) // for each current visitor (if any), working backwards through the list (beacuse it's easier) { key visitor = llList2Key (current_visitors, --count); // decrement the counter (to convert it to a list index, and also set it up for the while loop test next iteration) and get the visitor's key if (llListFindList (previous_visitors, [visitor]) == -1) // are they in the list of people who were here last time? { arrivals += llGetDisplayName (visitor); // if not, add their name to the list of new arrivals } } count = llGetListLength (previous_visitors); while (count) // for each visitor who was here last time { key visitor = llList2Key (previous_visitors, --count); if (llListFindList (current_visitors, [visitor]) == -1) // are they still here? { departures += llGetDisplayName (visitor); // if not, add their name to the list of departures } } string im_message; if (arrivals) im_message += "Arrivals: " + llList2CSV (arrivals); // if there are any new arrivals, add their names, seperated by commas, to the IM message if (departures) im_message += "Departures: " + llList2CSV (departures); // if there are any departures, add their names to the message if (im_message) // is there anything to report? { count = llGetListLength (im_recipients); while (count) // for each im recipient { key recipient = llList2Key (im_recipients, --count); // only send IM if recipient is online status = llRequestAgentData(recipient, DATA_ONLINE); if (test == 1) llInstantMessage (recipient, im_message); // note that this function imposes a 2 second delay on the script and is subject to throttling } } previous_visitors = current_visitors; // save the list of current visitors for next time; }
  19. Thanks for the useful info - I'll work through it as I do need to fix the issue of the missing name for a leaver from the area. If using the avatars legacy name rather than display name would help solve this then I dont mind that. Regarding the IMs to email, I was looking into using a dataserver event to only send the IMs to my list of admins only if they are online at the time - thought I could combine this with the loop that sends the im to each admin on the list.
  20. It seems the 'Departures with no name' happens when an avatar logs out while in the area as opposed to when they leave the area but remain logged in such as when teleporting somewhere else
  21. So I have changed the llGetAgentList to a sensor to limit the range to 100 mtrs. Changes I've made to the script above is to: made list current_visitors a global variable added llSensorRepeat to the state-entry added sensor event to build the current_visitor list commented out the llGetAgentList This almost works but it occasionally misses a departing visitor - shows the text 'Departures' but with no name so I think I have a small error. I have just posted the top part of the script where I made the changes list im_recipients = []; // a list of the keys of the people who will get IMed float timer_interval = 30.0; // how often to scan the area list previous_visitors; // a list of the people who were in the area for the last scan, a global value to preserve it between scans list current_visitors ; //made this into global variable default { state_entry () { im_recipients += llGetOwner (); // add yourself on the messaging list. llSetTimerEvent (timer_interval); // start the timer (and wait for it to trigger) llSensorRepeat("", "", AGENT, 100, PI, 20); //addded SensorRepeat } sensor(integer num) { integer i; current_visitors=[]; for (i=0; i<num; i++) { if(llDetectedKey(0) != NULL_KEY) { current_visitors = current_visitors +llDetectedKey(i) ; } } } timer () { list arrivals; list departures; // list current_visitors = llGetAgentList (AGENT_LIST_PARCEL, []); // get the list of who's here now - commented out while testing sensor integer count = llGetListLength (current_visitors); while (count) // for each current visitor (if any), working backwards through the list (beacuse it's easier) { key visitor = llList2Key (current_visitors, --count); // decrement the counter (to convert it to a list index, and also set it up for the while loop test next iteration) and get the visitor's key
  22. Thanks KT - this is just what I was looking for and it works perfectly. Just one I'd like to change is to limit the llGetAgentList scope to an area defined by a range rather than the whole parcel. I think this means I need to use llSensor to build the list of agents rather llGetAgentList. llSensor only returns a single id though so do I need a loop of some sort to build this list? Thanks.
  23. I've been looking on MP to purchase a script that will send an IM to a list of admin avatars whenever a visitor arrives in an area and leaves the area. I did find a free script that purported to do this but it didnt work so I tried hacking it to get it working but wasn't able to fix it. I did try contacting creator for assistance but since it was free, understandably I couldn't expect any help. Also since this was someone else's script and was about 290 lines long, I didnt think it fair to post it here for others to help me fix this. So I have tried starting from scratch looking for snippets of code in the wiki and this forum that I could cobble together. So far, I have a script that scans the area for visitors and sends an IM to my list of admins. Thing is it is sending the full list each cycle of the sensor. I'm trying to find a snippet that can maintain a list of visitors so that I only send an IM to my admins of when someone arrives and later leaves. I dont need any information about the time they arrived or how long they were there - just that they came and left. If anyone can point me in the right direction I'd be very grateful.
×
×
  • Create New...