Jump to content

Emilee Edenflower

  • Posts

  • Joined

  • Last visited


2 Neutral
  1. Thanks, that worked now! I'm more of a PHP coder so it didn't even occur to me to cast them as floats if they were already integers, as this calculation works fine in PHP (I checked to make before I posted the OP to make sure my maths was correct!). Anyway, this now gives the right result: integer percentageMemory = llRound(((float)used_memory / (float)total_memory) * 100);
  2. OK, hopefully someone can help me here as whatever I do always results in a 0 (zero) output! I'm just trying to do a simple calculation to work out the percentage of memory. It really shouldn't be so difficult, should it?? I thought maybe there was limitation with how much maths could be done in one line, so I split the two calculations up and it still doesn't work as expected. The calculation should look something like: 34968 / 65536 * 100 which rounded up should be about 53%. I wasn't sure if you could use parenthesis in it or not, but it didn't work anyway (eg: (34968 / 65536) * 100) integer used_memory = llGetUsedMemory(); integer total_memory = llGetMemoryLimit(); float percentageMaths = used_memory / total_memory; float percentageMemory = percentageMaths * 100; llOwnerSay("Memory used as percentage: " + (string)llRound(percentageMemory)); //result as: "Memory used as percentage: 0" Any insights?
  3. Hmm, that's a shame. It'd be handy to be able to grab the "collision". Oh well!
  4. Cast ray is all very new to me so this may be a silly question, but is there a way to detect the "hit" from a cast ray weapon? The traditional collision detection obviously doesn't work, and from what I do understand (if I read it right) of cast ray, it operates on a channel number type of thing between the weapon and target to detect the hit? So can you detect a "collision" if you don't know the original script of the weapon system for like a generic cast ray collision detection?
  5. Thanks, this should hopefully accomplish what I'm aiming for Thanks for all the help!
  6. OK, final question then to make my idea work if possible. I'd like to keep the scanner script separate just for tidiness (since I can't use an include() function) -- so can't lists be sent between scripts with a llMessageLinked ? I don't quite understand how that function works across scripts, and the examples on the docs don't really make it any clearer to me..
  7. I understand the need for typecasting at times, I'm just getting confused about how to do this within LSL, inside a loop whilst using llListFindList if the initial list I made isn't counted as a list of keys Do I need to use llList2Key on my TARGET_LIST and SEEN_LIST somehow for the llListFindList to understand the comparison of keys? I think I've been staring at this for too long now list TARGET_LIST = ["0f2e3a53-b856-413f-823b-71c10ca4aa58", "3a5add55-270d-4076-9e50-d4f37f2ad8af", "a6d06686-5198-4ff7-b42e-a7b4a75aaa5d", "d4b33149-686f-4bf4-b184-e8196a258b7a", "476c19b4-011e-4781-9e98-cefafe8f8606", "3498dd86-e37d-4f43-95c0-436121705a55", "3a5add55-270d-4076-9e50-d4f37f2ad8af"]; list SEEN_LIST; integer i = llGetListLength(SEEN_LIST); list REGION_KEYS = llGetAgentList(AGENT_LIST_REGION, []); integer NUM_KEYS = llGetListLength(REGION_KEYS); key id; while ((--i) >= 0) { id = llList2Key(SEEN_LIST, i); if (llListFindList(REGION_KEYS, [id]) < 0){ SEEN_LIST = llDeleteSubList(SEEN_LIST, i, i); } } // check for any on TARGET_LIST, when so add to SEEN_LIST while ((--NUM_KEYS) >= 0) { id = llList2Key(REGION_KEYS, NUM_KEYS); if (llListFindList((key)TARGET_LIST, [id]) >= 0) { if (llListFindList((key)SEEN_LIST, [id]) < 0) { SEEN_LIST += [id]; llOwnerSay(llGetDisplayName(id) + " is in your region of " + llGetRegionName() + "!"); } } }
  8. On another note, do I need to do something to define my list as a list of keys? The while loop with the list to list thing doesn't seem to be seeing anything. Keeps returning -1 even though I have keys in my target_list the same as those avi in the region I'm in..
  9. Yeah I've swapped it now to just be a list of UUIDs and I'll convert the key to username on output in llOwnerSay instead. Just about to try it inworld now
  10. So in light of all that, and using lists instead of strings.. does this make sense for memory checking, or does it have to be a string? if ((llGetListLength(TARGET_LIST) * 4.2) > llGetFreeMemory()) { //Delete the oldest entry in the list which is at the front of the list TARGET_LIST = llDeleteSubList(TARGET_LIST,0,0); }
  11. It looks similar to what I've got, it's just the IF part that's a bit different, though it looks to be saying the same thing from what I can tell: list ListItemDelete(list mylist,string element_old) { integer placeinlist = llListFindList(mylist, [element_old]); if (placeinlist != -1) return llDeleteSubList(mylist, placeinlist, placeinlist); return mylist; }
  12. Thanks I'll check it out! I don't expect there'd be many more than 20 (at most!) in a list at any one time with what I'm planning, but you never know. Even if I don't hash my list, this part looks like it could be useful to utilise in a modified way maybe: if ((llStringLength( hashedNames ) * 4.2) > llGetFreeMemory()) // In case memory gets tight { hashedNames = llGetSubString(hashedNames,3,-1); //Delete the oldest entry in hashedNames }
  13. Thanks, that's what I was hoping For this script, I'm mainly just thinking in terms of people storing a list of avatar keys/UUIDs now for the purpose of the snippets posted above in this thread. I have considered using the HTTP request functions to update and retrieve data stored on a server via PHP scripts instead to make sure things are more durable and/or persistent.
  14. Ah, right thanks for the heads up. I was using names as it was a customisable list, but I suppose I could do it another way which I was considering which was to store UUIDs instead, but it just meant the list couldn't just be stored/edited in a note file as easily/human-readable. But that's fine As for the list (however I create it now), if I store names in it as a variable -- will they be 'remembered' even after logging out if the script doesn't have any reset functions in it?
  • Create New...