Jump to content

Gayngel

Resident
  • Posts

    183
  • Joined

  • Last visited

Posts posted by Gayngel

  1. You can store links by name.
     

    integer link1;
    
    integer link2;
    
    integer link3;
    
    integer link 4;
    
    
    
    default
    
    {
    
    state_entry()
    
    {
    
    integer total = llGetNumberOfPrims();
    
    integer i;
    
    
    
    for(i = 0; i < total; ++ i)
    
    {
    
    integer link = llGetLinkName(i);
    
    if(link == "Link1")
    
    link1 = i;
    
    else if(link == "Link2")
    
    link2 = i;
    
    else if(link == "Link3")
    
    link3 = i;
    
    else if(link == "Link4")
    
    link4 = i;
    
    
    
    }
    
    
    
    }
    
    }


    Note: This is only a very basic example, there might be better ways to store links like in a list or linksetdata if that's what you need.

  2. 2 hours ago, Chip Craig said:

    Initial support via an AI chatbot is actually a good idea. Consider it to be just a replacement for a knowledge base - you say what it is wrong and it suggests known fixes.

    Should the AI fail to resolve your issue then (depending upon your membership level) you still have access to various other support options. In theory, this should free up support staff to deal with proper support issues instead of "I can't be bothered to rtfm issues." In theory, providing it is limited to initial support only then it is good.

    That is how it's supposed to work but on the ground it really doesn't. All the bot does is give you the run around trying a million fixes you've tried before and then tells you to e-mail support where you waste more time going back and forth when really the issue can be resolved or logged as a bug to be fixed in 5 minutes if you could just speak to a person in live chat or a phone call, its frustrating as hell dealing with support bots.

    • Like 1
  3. I've got hundreds of items listed on one of my stores. When there's a sale I don't want to go through each listing and edit the price to half off or whatever percentage I want to knock off, that's too painstaking. There should be a button somewhere to select % off all items for a certain amount of time. Please make it easier for us Lindens!

    • Like 1
    • Haha 1
  4. 4 hours ago, Bleuhazenfurfle said:

     

    Which is where BUG-233819 comes in (either with or without the part referring to Henri, if those issues could be figured out).  Or, another option I put forward AGES ago (and several times since), of the same sort of thing, but llDetected style…  That has the added benefit that they can keep the snapshot list as a simple array of pointers to the existing key string data (or maybe even the entire items themselves, depending on how it's implemented), and only convert the key and/OR value names as needed (if you never actually care about the keys, they never need to even convert them for the script) — though hopefully without that exceedingly stupid 16 entry limit…

     

    Pointers would be WONDERFUL!

    • Like 1
  5. 12 minutes ago, Love Zhaoying said:

    So except for the "show me all the data in X category" or "delete all the keys in X category", there's no pain really. (Loop and get n keys, then get n more.)

    Well that's where the new functions llLinksetDataCountFound & llLinksetDataDeleteFound will be useful.

    • Like 1
  6. 2 hours ago, Wulfie Reanimator said:

    What am I missing? Couldn't you either get all keys with llLinksetDataListKeys(0,-1) and iterate through that (explicitly typecasting keys)

    Because the list to too large for script memory so have to do it in stages.
     

    2 hours ago, Wulfie Reanimator said:

    or search for the valid UUID pattern which can be very simple?

    [a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}

     


    For someone who doesn't understand regex and/or are proficient at it, it is far simpler to use indexes. I might use that pattern now though. Thanks Wulfie.

    • Thanks 1
  7. 8 hours ago, Bleuhazenfurfle said:

    FIFO ordering is what you want for forming a cache — and usually implemented using a timestamp at the front of the key.  (Also, BUG-233965)

    Though, I don't get most of what you're saying there.  I imagine it's along the lines of what I've said in a couple Jira comments, and ranted about in Scripts several times, among other things; The offset integer is just plain broken in the presence of other scripts…  If another script adds items, you'll get duplicates, and if another script deletes items, you'll miss some, and while you can track linkset_data to try to adjust your offset as you go, that still suffers from races.  Alpha sorting the keys is actually better for this, IF, we could use a key as the index rather than an integer offset.  DB's regularly use the last key found as their index (before they added cursors), for a reason.  (You'll still miss items added at or before your current cursor, but it's completely stable otherwise.)

    I get what you mean about racing but that can be mitigated by only editing LSD in one script and/or through control flow.


    All I want is something like this:

     

    // linkset data contains the following kv pairs
    
    // "a9ba2797-81af-429d-9833-51127ad5593c", "1"
    // "apple, 0"
    // "4ab1ec43-b2c0-4ded-8154-bb3b9cc9cbec", "1"
    // "banana, 0"
    
    integer tot = llLinkSetDataCountKeys();
    
    integer i;
    
    for(i = tot; i > -1; -- i)
    {
      
    
      if(llLinkSetDataType(i,DATA_TYPE_KEY))  // imaginary function that casts key found by index and then evaluate it to check if it is a valid key
       
      llLinksetDataIdxDelete(i); //imaginary function that deletes a key by its index 
    
    }

     

    Far simpler than having to add and search a pattern... and with a large database, having to search several times over to make sure all keys are caught.

    Edit: llLinksetDataDeleteFound might work for my purposes though once it arrives... if keys that are not to be deleted are made protected and keys that are to be deleted are unprotected. Or just delete all keys containing a pattern.

    Edit edit: Some llLinksetDataArray functions would be nice actually. I've made a feature request: https://jira.secondlife.com/browse/BUG-234166

    • Like 1
  8. Linkset data really needs an index or FIFO system to be able to iterate over entries and do things like delete the oldest entries or loop through all keys and delete a key if it evaluates to a UUID, etc. It's very frustrating not being able to edit keys with an unknown regex pattern... or even know if all the keys with the pattern are returned for that matter.

  9. 4 hours ago, Frionil Fang said:

    Content-Range is being ignored when I test it, too (edited to add: maybe the function doesn't consider it an allowed custom header?).

    Edited again since reading is hard: the Mozilla docs actually say Content-Range is a *response* header, not request. The Range is a *request* header and works, at least somewhat. Some servers will return unusable garbage, looks like a character set issue that I didn't try to circumvent.

    E.g.

    default
    {
        state_entry() {
            llHTTPRequest("https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range",
            [HTTP_BODY_MAXLENGTH,16384,HTTP_CUSTOM_HEADER,"Range","bytes=3-99"],
            "");
        }
        http_response(key id, integer status, list meta, string data) {
            llOwnerSay((string)status);
            llOwnerSay((string)llStringLength(data));
            llOwnerSay(data);
        }
    }

     

    Thank you @Frionil Fang . I stuck your script in a new prim and it worked at first but if I try edit the range it just returns status 200 & the max length of chars again. If I change the range back to yours it also returns status 200 & the max length of chars again. It seems to be buggy.

    Edit: From reading the docs and elsewhere I think it might always work if we can get the right HTTP_MIMETYPE and/or the right mix of range and content-range.

    • Like 1
  10. The wiki for llHTTPRequest says you can set a custom range of data returned with the content-range custom header. I've tried implementing the header in a request but it just returns the whole data instead of the range. I think I;m not writing it correctly or something.

     

    llHTTPRequest(url,[HTTP_BODY_MAXLENGTH,16384,HTTP_CUSTOM_HEADER,"Content-Range","bytes 3440-6900/*", HTTP_METHOD,"POST"],"");

     

  11. You can either reset the scripts on owner change or attach like this:

     

    integer permsGranted = FALSE;
    key owner;
    
    default
    {
    
    attach(key id)
    {
    if(id)
    {
    llResetScript();
    }
    }
    
    changed(integer change)
    {
    
        if(change & CHANGED_OWNER)
        {
    
         llResetScript();
    
        }
    
    }
    
    state_entry()
    {
    
    owner = llGetOwner();
    llRequestPermissions(owner, PERMISSION_CONTROL_CAMERA | PERMISSION_TRIGGER_ANIMATION | PERMISSION_TRACK_CAMERA);
    
    }
    
    run_time_permissions(integer perm)
    {
     
    if(perm &  PERMISSION_CONTROL_CAMERA && perm & PERMISSION_TRIGGER_ANIMATION && perm & PERMISSION_TRACK_CAMERA)
    {
        
    permsGranted = TRUE; 
        
    }
    
    
    
    }
    
    
    
    
    touch_end(integer num)
    {
       if(llDetectedKey(0) == owner && permsGranted == TRUE)
      {
        llOwnerSay("perms granted");
       // do stuff
      }
      
    }
    }

     

    • Like 1
  12. FWIW there are many free hosting sites that come with a free SQL database. Gives you more space than Linkset data if you ever need it. I use 000webhost.com a lot.

  13. Sorry for the double post. You can totally avoid a sensor (which can be laggy) for this anyway by doing this:

     

    key doctorKey = "a9ba2797-81af-429d-9833-51127ad5593c"; // change this to the uuid of the doctor
    integer ChInCmdLine220 = -220;
    integer listen_handle;
    integer isDoctorNear;
    
     //***Checks if paired doctor is within range of 2.5 meters  each time a command is heard from bracelet
    integer checkDoctorRange(key id)
    {
        vector obj_pos = llGetPos(); // get the position of the button (this script)
        
        list tmp = llGetObjectDetails(id, [OBJECT_POS]); // get the position of the doctor in a list
        
        
        vector doctor_pos = llList2Vector(tmp,0); // assign the position from the list to a variable
        
         // compare a distance between two vectors. 
        if(llVecDist(obj_pos,doctor_pos) <= 2.5) 
        return 1; //  // if the postion of the button and doctor is within range of 2.5 meters return 1
        
         
       else 
       return 0; //return 0 if not in range
       
      
    }
    
    default
    {
        
       /// default stuff
       state_entry()
       {
           
          // do other stuff then change state
           state PAIRED;
           
        } 
        
        
    }
    
    //Doctor touches a bracelet that sends message to this button (this script).
    //Script/button checks if message was sent by doctor.
    //Then script/button checks if the doctor is within range (2.5 meters).
    
    //--intial parameters here
    
    //--functions here 
    
    //--doctor touches the button (this object) and pairs to this button, assigning themself as the doctor.
    
    //------------- (STATE PAIRED) --------------- 
    state PAIRED  //start listening
    {   
        
      state_entry()  //for paired state
      {
       
       // llOwnerSay("state PAIRED");
        //LISTENERS 
       listen_handle = llListen (ChInCmdLine220, "", "", "");  //COMMAND CHANNEL - listens to bracelet on CH -220 for commands
    
      
    
       // best to assign llListen to a handle so at any point you dont need the listener open can remove it with llListenRemove()
       
    
       }  //end state_entry
        
      listen (integer channel, string name, key id, string message)
      {
       
     if (ChInCmdLine220==channel)  //CH -220  //=================START CHANNEL -220/COMMAND
     {    
     
         if(llGetOwnerKey(id) == doctorKey) // if the owner of the object sending the message is the doctor 
         {
             
          isDoctorNear =  checkDoctorRange(doctorKey);  // or isDoctorNear =  checkDoctorRange(llGetOwnerKey(id));
          
           if (isDoctorNear==0) 
                {
                    
                   llOwnerSay("Doctor is too far away.");  
                 //doctor not in range - go back to beginnine
                   
                 
                
                } 
           
           else{
                    
                   llOwnerSay("Doctor is nearby.");  
                
    		//--Process commands here based on command received from the bracelet
                  
                  
                }  
             
         }    // end if(llGetOwnerKey(id) == doctorKey) 
                 
     }//end channel
    } // end listen
    } //end state PAIRED

     

×
×
  • Create New...