Jump to content

GloriaGlitter

Resident
  • Posts

    80
  • Joined

  • Last visited

Everything posted by GloriaGlitter

  1. I'm trying to make a reminder system so I need to calculate the number of seconds between now and a future date/time so I can then use that result in a timer event which can then send the reminder at the appropriate time. llGetUnixTime will give me the number of seconds from 00:00 hours, Jan 1, 1970 till now. Is there a way I can do another llGetUnixTime based on a future date/time and so all I have to do is to take the difference between these two results to get the number of seconds between now and a future date/time?
  2. Thanks Anna - knew it was something like that but couldn't put my finger it - thanks for the explanation too. Thanks Mollymews for the loop tidy up.
  3. I know I'm making a fundamental error here but I cant see what I'm doing wrong. I have written a little bit of script to learn about some list functions. As there was a repeat of a chunk of code I thought I'd make it into a function (displaylist) and just call the function twice but it is not picking up the variables even though I made them global. I know I'm being a chump here by missing something obvious. Code without the function which works fine: list my_list; integer i; integer end; default { touch_start(integer total_number) { list my_list = [ "1023:1000", "Reminder 1", llGetOwner(), "0712:1800", "Reminder 2", llGetOwner(), "0123:1153", "Reminder 3", llGetOwner(), "0123:0000", "Reminder 4", llGetOwner() ]; i = 0; end = llGetListLength(my_list); for (; i<end; ++i) { llOwnerSay(llList2String(my_list,i) + ", "+ llList2String(my_list,i+1) + ", "+ llList2String(my_list,i+2) ); i=i+2; } my_list = llListSort(my_list, 3, TRUE) ; llOwnerSay("------------------"); i = 0; end = llGetListLength(my_list); for (; i<end; ++i) { llOwnerSay(llList2String(my_list,i) + ", "+ llList2String(my_list,i+1) + ", "+ llList2String(my_list,i+2) ); i=i+2; } } } Code with function displaylist() list my_list; integer i; integer end; displaylist() { i = 0; end = llGetListLength(my_list); for (; i<end; ++i) { llOwnerSay(llList2String(my_list,i) + ", "+ llList2String(my_list,i+1) + ", "+ llList2String(my_list,i+2) ); i=i+2; } } default { touch_start(integer total_number) { list my_list = [ "1023:1000", "Reminder 1", llGetOwner(), "0712:1800", "Reminder 2", llGetOwner(), "0123:1153", "Reminder 3", llGetOwner(), "0123:0000", "Reminder 4", llGetOwner() ]; displaylist(); my_list = llListSort(my_list, 3, TRUE) ; llOwnerSay("------------------"); displaylist(); } }
  4. Hi Qie - thanks for your input. I think the +/- 10 degree steps only kick in when the rotation position goes past the end points i.e. more than 45 or less than -45 in order to bring the object position back into range. It seems to work quite well - my low prim mesh receptionist almost looks like an animesh model. It does look like the 'home grown' localrot is a bit of an overkill and I'll have a go at simplifying it as you suggest - on the other hand why fix it if it isnt broke
  5. As an experiment, I tried changing these lines in the original code: if(z > 360) { z -= 360;} else if(z < 0) { z += 360;} to if(z > 45) { z -= 10;} else if(z <-45) { z += 10;} So far it seems to work ok - is this a possible solution to my original question?
  6. Hi Qie - thanks for your replies. Just working with your ETA1, it does rotate +/- 45 degrees but the incremental steps are too big at the moment and so the object moves too fast through the rotational changes. I was looking for much smaller steps (like in the pigeon script above) as if the avatar object was just shuffling around. Yes, re your ETA2 you're right about the tiny x and y values as I wanted the avatar object to slightly tilt back and forth as it rotated enhancing the shuffling impression. At this stage I was going to apply it to the whole object but once I can get this working I might try to have a separate head and body as you suggested.
  7. Hi all - I have a script that was originally used to give realistic movement to a pigeon. I have a mesh receptionist avatar object (not animesh) that I've put this script into so that there is a little bit of movement for her rather than her just standing static. So with this script she can rotate 360 degrees which means sometimes she has her back to visitors. I have been trying to adjust this script so that she only turns in say a 90 degree arc (i.e 45 degrees either way of facing forward). Is it worth trying to edit this script or start from scratch. I am not too bad at scripting in general but find it hard getting my head around rotation functions. Thanks rotation temp; integer delay = 72; integer count = 0; integer switch = TRUE; float rnd = 1; float z; setLocalRot(rotation rot) { rotation localRot = llGetLocalRot(); rotation parentRot = llGetRot(); localRot.s = -localRot.s; parentRot = localRot * parentRot; //Order of ops important here. parentRot.s = -parentRot.s; llSetRot(rot * parentRot); } default { state_entry() { z = 0; llSetRot(llEuler2Rot(<0,0,z>*DEG_TO_RAD)); //setLocalRot(llEuler2Rot(<0,0,0>*DEG_TO_RAD)); llSetTimerEvent(0.0); llSetTimerEvent(0.7); } timer() { if(switch) { rnd += -rnd; switch = FALSE; } else { rnd = (llFrand(2) - 1); switch = TRUE; } float x = rnd; float y = rnd; z += (llFrand(20) - 10); if(z > 360) { z -= 360;} else if(z < 0) { z += 360;} setLocalRot(llEuler2Rot(<x,y,z>*DEG_TO_RAD)); // float t = llFrand(5.0) + 3; // llSetTimerEvent(t); } on_rez(integer start_param) { llResetScript(); } touch_start(integer total_number) { llResetScript(); } }
  8. Thanks Lucia - I did actually file a bug report yesterday (bug 228888) after posting here first since it didnt seem others had the same experience as me. This was first time I filed a bug report and was surprised to get a very quick response with a request to pass copies of my notecards inworld to a Linden. Will post back here what the solution is.
  9. So I've tested this further to see if the LMs were corrupted or not. I tested one list against another - both seeded with the LMs from my inventory but tested with an alt that didn't have any of these LMs in their inventory. The success/failures are blocked together rather than randomly spread throughout the notecard. These two lists are in alphabetical order and the LMs correspond with each other - in first list the 1st 20 LMs failed to open, next 30 were ok, next 20 failed, next 40 were ok. In second list some of those that successfully opened in first list failed and vice versa - first 30 opened ok, next 90 failed. Same results in Firestorm and SL viewer. Any ideas?
  10. I have a fashion brand franchise store in SL. In that store I have over 160 vendors over 4 levels. The outfits are for multiple mesh bodies (9 in total including Maitreya, Belleza, Slink, etc) but not every outfit is available for every mesh body. So to assist customers to locate which outfits are suitable for their mesh, I made an interactive catalog hud. When you click the hud it opens a menu where you select what mesh body you are. The next menu allows you to select for your mesh, how you want the list sorted - by name, color, price or outfit type. Once you make a selection, you are offered the relevant notecard. The notecard has five columns. The first column is a clickable texture which has the name of the outfit, then outfit type (dress, coat, swimsuit, etc), then color, then price and finally a LM that takes you direct to the relevant vendor. When I tested this it worked like a dream and a few I shared it with thought it was extremely helpful concept - saves them spending ages trying to find stuff in a store. This took a couple of weeks to collect and organise the data in the notecards - the hardest thing was trying to make the columns in the notecards reasonably straight. For 9 mesh bodies and 4 different sorted lists = 36 notecards plus collecting 160 textures and making 160 LMs. So I was about to give away this store catalog hud to all those in my various groups until a few people that were testing it for me said there were problems. The problem I'm experiencing is that not all the LMs open as they should. For instance a LM in one notecard might not open but it might work in another - once it worked in another, then it would work in the first one which failed originally. Trying the hud at a different time, different LMs refuse to open. I searched the forums and found some posts from 2014/15 that mentioned this as being an SL glitch but no posts more recent on this subject so you would think this issue might have been solved. I got a clue from one of those posts that said that if a LM was already in your inventory then it should open ok from within a notecard which probably explains why a) I as creator had no trouble testing my hud as all the LMs came from my inventory in the first place and b) if a user did manage to open a LM in a second notecard after it didn't work in the first one they tried, why it then opens ok when they go back to the first notecard - since clicking a LM in a notecard puts it into your inventory. The forum posts also indicated that it was not to do with how many LMs one has in a notecard as this can happen even if you have just one LM. If anyone would like to look at this hud to see this problem first hand, I have made it available to collect inworld at http://maps.secondlife.com/secondlife/Dragon Mountain/32/207/28 As it currently stands, I cant send my hud out to anyone which is a pity after so much effort went into it. I would be interested to know if anyone has had this problem and if there is a fix for it or are there something wrong with my LMs to explain why some work and some dont - as far as I'm aware all are full perm and every one works (at least for me). Thanks
  11. KT - 'touch_end' did the trick thanks. Made the other edit you suggested as well. Thanks again for fast reply.
  12. So I tried putting the detach command in run-time section but it still needed two clicks to detach. default { touch_start(integer n) { llRequestPermissions(llGetOwner(), PERMISSION_ATTACH); } run_time_permissions(integer permission) { if(permission) { llDetachFromAvatar(); } } }
  13. Hello there - I found this thread when I was looking for a 'detach hud' script. I have made a hud and have added a close button at top right. In that prim, I have put a very simple script to detach the hud when touched. I read that I have to have the llRequestPermmissions which assumes the permission is given since the avatar attached the hud before the llDetachFromAvatar will work. So everything works fine except that an avatar has to click the close button twice before it detaches. I think I need to make a slight adjustment to my script so that the button only needs to be clicked once to detach - grateful for advice. Thanks.. This is my little script: default { touch_start(integer total_number) { llRequestPermissions( llDetectedKey(0), PERMISSION_ATTACH ); llDetachFromAvatar( ); } }
  14. Thank you for your confirmations - I'll stick with a message to the user to widen their notecard window.
  15. The script I'm currently working on is essentially a notecard giver. The data in the notecard is basically lines of a table. The notecard when it is displayed to the recipient is narrower than the line of data which wraps around making it look a bit unintelligible until the recipient pulls the window wider. I could put a line of text at the top of the notecard asking the user to pull it wider but Is it possible with LSL to amend the notecard window width?
  16. Thanks Molly and Rachel - Ok, I got it now - instead of objects think of notecards. So I could have 8 notecards inside my object, each notecard title being the name of one of my top level menu buttons and within each notecard the 8 relevant landmarks. I've got something now that I can get my teeth into. Thanks
  17. Hi Molly - thanks for replying to my questions. My existing menu script itself works ok for me and I could move my variables from the script to be read in from a notecard or reorganise them into lists as you suggest. But what I wanted to achieve though, is to make this process even easier for anyone I share my script with who will want use their own landmarks rather than mine by them simply dragging their landmarks from their inventory into an object. I wanted to save them the bother of editing the script or notecard. Ideally I'd like to have a single object which will contain x number of objects (which I will call sub-objects), each of which will hold the landmarks for a particular category (e.g. beaches, stores, etc). These sub-objects themselves would be called 'Beaches', 'Stores', etc so that my script would read the sub-object name to create the top level menu buttons. The next level buttons would be created by processing the landmarks contained within each sub-object. This concept though requires my script to be able to 'open' these sub-objects to be able to process the landmarks contained within them. So my question was more about whether I can access the contents of objects contained in the inventory of a main object where my script would sit rather than about how to build a menu structure. I have a feeling that this might not be possible.
  18. I have written a script for Landmark management. When you touch the object (can look like a signpost for instance), a dialog menu opens offering 8 categories e.g. Beaches, Clubs, Stores, etc. For each category there are 8 sub menus with buttons for 8 beach names, 8 club names, etc. When the sub menu button is clicked another dialog opens displaying a link (showing just the shortened place name instead of the whole url) to the selected place profile from where the user can read about the place and teleport there if desired. I have written the script so that all the data is in variables e.g. string menu1 = "Beaches"; string menu1but1 = "Dusk Point"; string menu1but1url1 = "Tropical%20Seas/70/226/21"; string menu1but2 = "Secret Beach"; string menu1but1url2 = "Opelessence/156/95/21"; etc. The rest of the script builds the menus and links as described above. This all works perfectly well. But I was thinking about what happens when I give the script to another person to use for their own landmarks. All they need to do is to replace my variables with their own landmark information. I realised this was 64 place names, 64 urls and 8 category names - 136 variables plus a lot of manual cutting and pasting to get the region information. So I thought how can I make this simpler for my next owner of this script - could I just get them to place all their landmarks into the signpost object? So my idea was that they create 8 objects (lets call them sub-objects) and place 8 landmarks into each and place these 8 sub-objects into my main object. A sub-object name would be "Beaches" for instance which would be used for the category button name and they would also rename the 8 contained landmarks to a shorter name to be used for displaying on the place menu buttons and also for the place profile link. This would require much less effort for the new script owner. So first I tackled the process of taking a Landmark and extracting the url information to create my link to the place profile - this works fine. Having cracked that for one landmark, my next task to accomplish was going to be reading all 8 landmarks within the sub-object and extracting the data to assign to my variables. If I could get that to work then I would repeat this for all 8 sub-objects. This is when I realised that I needed to be able to process objects within objects and wondered if there was a way to do this as I hadn't seen any script examples that did this - maybe it is not possible within LSL and I would have to go back to the drawing board. Worst case is that I leave my script as it is and the script owner changes all the variables but it would be more elegant if I could get them to use their existing landmarks in the way I described above. So, is it possible to process items such as landmarks that are contained within objects which themselves are within an object? I am half expecting a one-word answer to my question (smiles) but if my idea is not feasible would there be an alternative elegant solution or is my existing script the best way anyway - "if it is not broken don't try and fix it"?
  19. So I think I solved this now by simply selecting another random item after each giveaway and discarding and picking another it if the name of the old one (less last 3 characters) matches the new one (less last 3 characters). So far so good Thanks all.
  20. Thanks Mollymews - that worked a treat - what I've learnt from this is that the variables are associated with the object running the script rather than the individual toucher. But this has now revealed that I've got a bigger problem that might need a bit of a rethink. In one of my mystery gift vendors the gifts are no-copy. There are eight different dress designs of which I have been given about 50 copies of each by the designer. So these are numbered dressA1, dressA2, dressA3.........dressA50, dressB1, dressB2, .....etc. Suppose the next random gift is dressA20 which Person1 collects. Person2 comes along within the time period and clicks the vendor - the vendor wants to give dressA20 but it is not there any more and so an error is displayed in the debug window. The easiest solution would be to try and persuade the designer to give me the items full perm but failing that, I think I have to rewrite part of the script so that the vendor gives a random item each touch from the items left but that a particular toucher is prevented from collecting another gift until the time is reset. Also, to prevent the same item being given twice in a row, I'll try to match the previous item name to the next item name by comparing the item names minus the last 3 characters.
  21. Thanks Mollymews for quick reply - I'll work on this in the morning when I get back on my PC - one thought though, a person is allowed to collect the next gift after the 5 minutes has passed, it is just that they are not allowed to collect the same gift more than once within the 5 minutes - will this amendment stop them collecting more than one gift in total?
  22. So I've been running my script in my mystery prize giver about a week now - I've modified it a bit since so for instance it advises me when the no-copy prizes are running low and if the next mystery prize is the same as the previous random one then it selects another. Also, a person can only collect a gift once in every time period e.g. every 5 minutes, and if they try again within the time period, they will get a message saying 'sorry you have already collected 'item'..... I thought it had been running well but I have discovered a problem today that I do not know how to fix - which is that if person A has collected the gift and then person B comes along and clicks on the vendor, person B gets the message saying sorry you have already collected the gift when it was person A that got it. I had assumed that the variable 'received' which gets set to 'y' after a gift has been given would only relate to the person that touched the object and not the next toucher. This seems to be the bit that is going wrong - the script seems to remember the variable value from the previous toucher - any advice on how to fix this would be appreciated - I'll post my complete code below so you might be able to spot my issue - thanks in advance for any suggestions: // mystery prize script string group_id="82d18b8d-82e9-d5fa-5b3b-57d6abfaf34a"; integer time_reset_seconds = 300; //how often do we need to reset and pick new random item float time; string item;//the random inventory item we are giving away float t1=1; float t2=1; float t3=1; vector color =<1,1,1>; string received="n"; string olditem; integer objectcount; //------------------------------------------------------------------------------ integer rand(integer min, integer max) { return min + (integer)(llFrand(max - min + 1)); } string FormatDecimal(float number, integer precision) { float roundingValue = llPow(10, -precision)*0.5; float rounded; if (number < 0) rounded = number - roundingValue; else rounded = number + roundingValue; if (precision < 1) // Rounding integer value { integer intRounding = (integer)llPow(10, -precision); rounded = (integer)rounded/intRounding*intRounding; precision = -1; // Don't truncate integer value } string strNumber = (string)rounded; return llGetSubString(strNumber, 0, llSubStringIndex(strNumber, ".") + precision); } countobjects() { objectcount= llGetInventoryNumber( INVENTORY_OBJECT ); } dorandominventory()//function to pick a random inventory item to give out. { integer purely_random = 0; integer i = 0; countobjects(); if (objectcount==0) return; do{ purely_random = llFloor(llFrand(llGetInventoryNumber(INVENTORY_ALL))); string n = llGetInventoryName(INVENTORY_ALL,purely_random); if(n!=llGetScriptName() ) { // llSetText("PICKING A RANDOM ITEM \n["+n+"]",color,1); item = n; } i++; }while(i < 100); // llOwnerSay(item); if (objectcount==1) return; if (item==olditem) { // llOwnerSay("duplicate"); dorandominventory(); } } random_contains()//fetch all our randomness { t1= rand(0, 2); t1=t1/2; t2= rand(0, 2); t2=t2/2; t3= rand(0, 2); t3=t3/2; color=<t1,t2,t3>; if (t1 == 0 && t2 == 0 && t3 == 0) random_contains(); // since the initial texture is a white ? on black background, the color changer has effect of just changing the color of the ? - therefore I dont want a black ? on a black background llSetColor(color,4); dorandominventory();//grab an item } default { state_entry() { llSetTexture("75514350-0a83-9207-a6ce-9e4d174b10b9",4);//question mark texture llResetTime(); time = llGetTime(); llSetTimerEvent(1.0); random_contains(); } on_rez(integer sp) { llResetScript(); } touch_start(integer total_number) { key target = llDetectedKey(0); string Name = llKey2Name(target); float time_left = (time_reset_seconds-(llGetTime()-time))/60; countobjects(); if (objectcount==0) { llRegionSayTo(target, 0, "Sorry "+Name+", but the Mystery Gift Vendor is empty - the Owner has been informed."); return; } if (llDetectedGroup(0) ) { if (received =="y") { llRegionSayTo(target, 0, "Sorry "+Name+", you have already collected a '"+item+"'. The next random gift will be available to collect in "+FormatDecimal(time_left, 2) +" minutes (when the ? in the middle of the picture changes color)."); } else { llRegionSayTo(target, 0,"Congatulations "+Name+ ", you have received a '"+item+"'. The next random gift will be available to collect in "+FormatDecimal(time_left, 2) +" minutes (when the ? in the middle of the picture changes color)."); llGiveInventory(target,item);//give the item received = "y"; countobjects(); if (objectcount<10) llOwnerSay("Mystery Gift Giver has "+(string)objectcount+" items left"); } } else { llRegionSayTo(target, 0, "Sorry "+Name+", you are showing the wrong active group! To get the mystery gift, either change the active group tag if you are already a member of secondlife:///app/group/" + group_id + "/about group, or click the link to join the group or click the Group Joiner, which is on the wall here or by the reception desk."); } } timer() { if (llGetTime()-time>time_reset_seconds) { time = llGetTime(); olditem=item; random_contains(); received = "n"; } } }
  23. Good point Wulfie. In this case I had a one -off need to convert a list of about 2000 avatar keys into their legacy names. If someone does change their legacy name will their key also change?
  24. Thanks Ruthven for quick response. This still gives me a data event key instead of the legacy name - this was the output in the chat window I got just now with the amended code: namekey = 8cdf1317-e9c2-41f6-a0e3-793f69fc76dc Resident = 1091b48e-18c3-86f5-a92a-79dad7035e21 namekey = 5b6e2121-5847-4b84-a260-3dd37f4d0d65 Resident = 1c4dcdc1-bd7c-e70d-318d-3c63d5829477 namekey = 2d55c505-9530-40a9-a153-ce3878b0314b Resident = cc86f9c6-8227-9fd5-65f7-cb9fb434e7b6 End of notecard Any ideas?
×
×
  • Create New...