Jump to content

Raena Parx

Resident
  • Posts

    106
  • Joined

  • Last visited

Posts posted by Raena Parx

  1. Hello. I'm using llSensor for the first time. My doctor wears a bracelet that sends commands to my button (this script that uses llSensor). Before any command is processed, this script (button) checks to be sure the doctor is within range of 2.5 meters.  I had a problem with finding where to place the commands llSensor() and sensor ().  I believe they are placed correctly, as the sensor does detect whether the doctor is close or not.  However, the calling llSensor() command is later in the script. 

    When the llSensor() command calls the sensor() subroutine, it detects the doctor and assigns a value of   isDoctorNear=1   . This works fine, and debugging show that.  But...

    The problem is once the sensor() subroutine is completed, the value of isDoctorNear ALWAYS comes up zero, even tho it was detected in the sensor() routine.  This is the line directly after llSensor().
    I cannot figure out why the value of isDoctorNear=1, and then the next script line llOwnerSay show it as zero value.

    It's a huge script, so I dummied it down to bare bones to show the problem.  It most likely will not run as-is, but is more a placeholder so you can see the structure of the code.

    Any anyone explain why the isDoctorNear value changes on the next line after llSensor() ?  And how to fix it?

    Thank you so much!

    Quote

    //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
    {


        sensor (integer num_detected)  //***sensor will check if paired doctor is withing 2.5 meters of this script.
        { 
           string message = "Detected " + (string)num_detected + " avatar(s): " + llDetectedName(0);

            isDoctorNear=0;   // start new search
            
            integer index = 1;
            while (index < num_detected)
                DetectedName=llDetectedName(index++); CurrentName=llDetectedName(index-1);
                message += ", " + DetectedName;

                //check if searched avatar is found in results
                    if (doctorName==CurrentName) 
                        {
                        isDoctorNear = 1; //isDoctorNear will be 1 if doctor is in range, or 0 if too far away
                        foundName=CurrentName;
                        }
        
               // llOwnerSay ("State Paired + sensor, isDoctorNear="+(string)isDoctorNear);  //debug
            
        }

        no_sensor()
        {
            isDoctorNear=0;  //doctor is not found within range
            llRegionSayTo(doctorKey, PUBLIC_CHANNEL, "*Out of Range* Please come closer to the VSM Exam Table.");    
               // llOwnerSay ("State Paired + NO sensor, isDoctorNear="+(string)isDoctorNear);  //debug            
            state PAIRED;  // start over
        }    
        
       
        
      state_entry()  //for paired state
      {
       
       // llOwnerSay("state PAIRED");
        //LISTENERS 
        llListen (ChInCmdLine220, "", "", "");  //COMMAND CHANNEL - listens to bracelet on CH -220 for commands
       

       }  //end state_entry
        
      listen (integer channel, string name, key id, string message)
      {

     if (ChInCmdLine220==channel)  //CH -220  //=================START CHANNEL -220/COMMAND
     {    

            //***Checks if paired doctor is within range of 2.5 meters  each time a command is heard from bracelet
            llSensor(doctorName, NULL_KEY, AGENT_BY_LEGACY_NAME, 2.5, PI);   //***<---CALLING LLSENSOR()  

            //***PROBLEM: isDoctorName ALWAYS TURNS TO ZERO AFTER llSensor command above, but should be 1 when doctor is in range.
           // llOwnerSay ("After Sensor: isDoctorNear="+(string)isDoctorNear); //DEBUG

     
            if (isDoctorNear==0) 
                {
                state PAIRED;  //doctor not in range - go back to beginnine
                } else{
                //do nothing and move foward to command processing below
                }


     
    //-------------------
    //--Process commands here based on command received from the bracelet
                 
    //end channel
    }
        

     

     

  2. 16 hours ago, alexx Ohmai said:

     

    default {
    	touch_start(integer touch) {
        	if(llGetAgentSize(llDetectedKey(0)) != ZERO_VECTOR) {
            	llRegionSayTo(llDetectedKey(0), 0, "Welcome to the region!");
            }
            else {
            	llInstantMessage(llDetectedKey(0), "You're so far away!");
            }
        }
    }

     

    Thank you so much for the explanation, and the code. I "kind of" understand it, but it is a little over my head yet.  I did find a solution already. But I really like the code you gave me to check if the toucher is in the Region. Thank you so much!

    • Like 1
  3. 3 hours ago, Quistess Alpha said:

    llSay(DEBUG_CHANNEL, "some text"); or similarly for llWhisper llShout or llRegionSay llRegionSayTo (it doesn't seem work with llRegionSayTo(); (no viewer support?) but does work with llRegionSay(); and all the others). it makes the text show up in a special kind of window in the same way as a stack-heap overflow, or llSetLinkPrimitiveParamsFast usage error.

    Oh cool!  Thank you Quistess!  I'll definately play with it. Thank you for explaining how it works ☺️

  4. Well...I rescind what I thought was the solution. lol  So it worked perfectly in test environment where the strings were pre-filled when creating the stringnames. But when I got it into my build, it didnt recognized the strings as they had been updated throughout the code.   Not sure why it would take the updated string values.

    So, I ended up having to just using the llOwnerSayTo command 7 times to get all the text to display.  But it was MUCH faster then using InstantMessage!

    I never knew that command existed. So thank you!

     

    • Like 1
  5. Just an update. The llRegionSayTo worked perfectly.  Turns out it's so fast, it doesn't need text-line grouping like I thought it would from when I was using llInstantMessage. It displayed the text in order, privately and fast...awesome!  Now if I can figure out how to avoid the timestamp when copy/pasting it from chat it'll be perfect lol. 

    Thank  you for the code Wulfie. Yours is the code I used mainly because I could understand it, and it was short and sweet and functional.

    I wasn't sure I understood the advantage of counting backward, so I used what I was more comfortable with. Though that may be a great option too if I understood it better lol. 

    THANK YOU TO EVERYONE for being so helpful!!!.   I really appreciate it!!!

    On 5/7/2023 at 9:41 PM, Wulfie Reanimator said:
    list lines; // Your strings are here.
    
    integer max = llGetListLength(lines);
    integer i = 0; // "i" is commonly used to "iterate" through a loop.
    
    while (i < max)
    {
        string text = llList2String(lines, i); // Pick one line from the list.
        llRegionSayTo(avatar, PUBLIC_CHANNEL, text); // Send it to an avatar.
        ++i; // Increment the variable by one, so the next line will be picked on the next iteration.
    }

     

  6. Thank you Wulfie. The code is awesome, and will simplify sending all the strings. 

    What I was trying to figure out tho, in the prior messages, is how to group the strings into larger strings that are as close to 1024 characters, so bulk-sending in a way. The code would need to calculate the length of each current string ( no problem there), plus the string length of next string, then decide if it can be added to a groupstring that's  <1024 characters, and if so, how much space is left , then repeat til all strings are sent. I can probably figure it out, but I guarantee it'll be like 20 lines of code more than is needed lol.  I'll let you know what I come up with so you can have a good laugh lol. 🙃

    Thank you for your help :)

     

    • Like 1
  7. 6 hours ago, alexx Ohmai said:

    Two things you want to do for the sake of efficiency.

    1.) Swap to llRegionSayTo()
    2.) Combine as much data into one string as possible.

    for point 1. you can use llRegionSayTo() to send the data to them, i'd recommend checking if they're in the same region if this is going to be somewhere that has neighboring regions, otherwise the region say will fail. this will allow you to fall back to llInstantMessage() in such cases.

    for point 2. strings can be a max of 1024, you can utilize for loops and do the math to combine data into a single string by comparing length left vs length of string to add. and if string to add is too long, send the data and start a new string. you can utilize for loops and "\n" for a newline where applicable. This will allow you to send more data in less strings, which is overall better for sending data to an agent as even llRegionSayTo() gets throttled if too many messages are sent on channel 0, but also data isn't always received in the order it was sent to the agent, so if you require message integrity you're better off formatting where you can. This approach also allows you to fall back to llInstantMessage() more reliably.

    Thank you for the suggestion.  The receiving avatar would be on the same region because it's activated on-touch.  The strings are already formatted with "\n'"'s, but vary a lot in size.

    I'm a bit lost on how the "For" operators works in .lsl. 

    For example, i found this on the lsl wiki:

    /block statement
    integer a = 0;
    integer b = 10;
    for(; a < b; ++a)
    {
        llOwnerSay((string)a);
        llOwnerSay((string)b);
    }

    why does it start with a semicolon? does that mean there's no initializer? - i'm just guessing.

    and the ++a....is that a counter?  meaning "a" will increment plus one each loop?

    trying to figure out how I would write a loop that reads all the data, one string at at time (so using lists for the string names, i'm guessing), and arrays?...(that's where I really get confused), then join the strings together into strings no longer than 1024 characters.  Not sure I'm that program-savvy.  But if I understand the concept, I might be able to pull it off.

    Thank you for your help :)

     

     

     

  8. Hello. I have several text strings (basically data fields), each with it's own string name. The strings range from short or long depending on the data needed.

     I'm trying to send these strings privately to the individual who requests them on touch, so I'm using llInstantMessage, but am running into a few issues.

    1. If I send them one string at a time it's    s-l-o-w       a-s       m-o-l-a-s-s-e-s.

    2. There's no way to combine them into one long string before sending with llInstantMessage to speed things up since a string field cannot be more than 1024 characters.

    Can someone suggest the best way to send several text strings privately on-touch?

    Thank you in advance. :)

  9. Hi All. I've never worked with deformers before. I did purchase Bento Buddy 2023. I watched a tutorial that looked really easy here...

    https://www.google.com/search?q=deformer+with+bento+buddy&rlz=1C1UEAD_enUS1007US1007&oq=deformer+with+bento+buddy&aqs=chrome..69i57j0i546.4264j1j7&sourceid=chrome&ie=UTF-8&bshm=bshqp/1#fpstate=ive&vld=cid:e3c204c8,vid:VwZfIAycZBU

    I followed every step, with exception of instead of moving the breast bones, i moved the hip bones. I'm trying to make a deformer that makes you're avatar s-u-p-e-r skinny (like cartoon skinny) when worn.  The only volume bones I see to edit on the skeleton are the hips so I tried to move them closer to eachother.  I'm not even sure if I moved the bones correctly.  I exported it as a deformer in Bento Buddy. I'm using Firestorm just to follow the tutorial.  However, when I try to upload the mesh model, the physics tab gives me this error:

    "One or more dimensions is less than 0.5m, only hull-based (analyzed) physics shapes will work correctly."

    And...consequently, the uploaded model does not work.  Any idea what may be causing this, and how to get around it?  Or if I'm even doing this right?  Any help is appreciated.

     

     

     

     

     

  10. Thank you so much - that was the answer I needed.  I only need the listener in one state, but didnt know the llListen has to be in the same state.

     

    So I revised the state three and it works!   Thank you so much everyone!

    Here is the revision:
    //===============
    state three{
       state_entry()
       { 
        llListen (ChInA, "", "", "");  
        llListen (ChInB, "", "", ""); 
       } //end state_entry
        
        listen (integer channel, string name, key id, string message)
        {
          //process messages heard from channels here 
          if (ChInA==channel)
          {
            llOwnerSay ("Message heard: "+message);
          }
        }
        
        
        touch_start(integer total_number)
        {
         //do stuff 
        state one;
        }
    } //end state three
     

     

     

     

    • Like 3
  11. Can someone please tell me where I can add a listener when using states?  I've tried several locations within the script and they all give me a script error.   Thank you in advance.

    Here is an example of what I'm trying to do...
    //===================================================================

    //where do I add the listen functions below: 
    //    listen (integer channel, string name, key id, string message)
    //    {
    //      //process messages heard from channels here    
    //    }

    //======SCRIPT STARTS HERE=========

    integer ChInA= -50;
    integer ChInB= -60;

    default
    {
        state_entry()
        {
        llListen (ChInA, "", "", "");  
        llListen (ChInB, "", "", ""); 
        state one;  //jump to state one
        }
    }

    //===============
    state one{
       state_entry()
       { 
        //do stuff
       } //end state_entry
        
        touch_start(integer total_number)
        {
         //do stuff 
        state two;
        }
    } //end state one

    //===============
    state two{
       state_entry()
       { 
        //do stuff
       } //end state_entry
        
        touch_start(integer total_number)
        {
         //do stuff 
        state three;
        }
    } //end state two

    //===============
    state three{
       state_entry()
       { 
        //do stuff
       } //end state_entry
        
        touch_start(integer total_number)
        {
         //do stuff 
        state one;
        }
    } //end state three


     

     

  12. Thank you all again.  Wulfie, I understand what you're saying, and although it would work for a custom build, or for an object with MOD permissions so the owner could activate permissions and place it in the furniture themselves.  This particular build is not mod, so I guess this option will not work. 

    Just a rant...Sometimes SL has soooo many limitations.  Why the extra permissions needed to break a link?  If the scripter writes it to break, they can use Owner/Group/All permissions to minimize who can use it. So why the EXTRA permissions. Oh well.   

    Thank you everyone for your help.  I think for a no-mod furniture, unless I customize it for each buyer, this is not gonna be an option.  But I really appreciate everyone trying!!!

    T H A N K   Y O U   !!!!!

     

  13. Thank you everyone for your input.  it is greatly appreciated!  I guess I wasn't quite clear when I said "detach".  What I meant is that the object is supposed to separate (detach) from itself, leaving a small piece of itself behind.

    A little more details:  This is a prop that rezzes when using MLPv2.  The prop/object rezzes. The user of the table (could be anyone) should be able to touch the object, then the object separates, leaving a piece of itself behind.  The next animation removes the original prop (except the for left-behind link), and then interracts with the left-behind link.  I hope that's clearer.

    The mention of making the object wearable was just something I tried as an alternative. I don't believe that works anyway, but it's not really the ideal solution.  I'd rather have the prop be a rezzed object.

    The user of the MLPv2 furniture could be anybody, (it's in a medical environment, so it could literally be any doctor or assistant). So "anybody" needs to be able to touch the prop to delink it. Asking the owner for permissions is not an option, because the owner may not be online when it's being used.  So if that's the only way it can work, I"m thinking I may have to give up on the option to delink on touch.

    Tessa, thank you so much for the code segments.  I haven't had a chance to try them out yet, but I'm guessing it's still asks the owner for permissions, correct?  Curious, what is the purpose/advantage of using a separate state for requesting owner-only permissions?

    Again thank you everyone for your help. 😄 🙃 ☺️

     

  14. I have a prop that's supposed to detach on touch. For testing purposes it's just 2 cubes.  This will be a rezzed object that anyone should be able to touch and it will detach.  It works perfectly for my avatar (owner), but not for any other avatars.  

    Below is the simplified portion of the script.  I tried changing out llGetOwner() with llDetectedKey(0) , but the other avatar never gets the message to accept permissions to unlink the object. And then it gives this script error: "Script asking non-owner for run time permissions only owner can grant". (I cannot make this dependent on getting permissions from the owner every time it's needed. )

    I tried making it a wearable object, but when worn it fails to detach at all.

    And one more weird thing - every time I use it, it detaches fine for me, but then the object that was left behind is still visible, but not selectable. It's not locked, it's just like it's not there at all. If you click it in edit mode it selects the objects that's behind it instead.

    Can someone please tell me what I'm doing wrong?

    Here is the script:

    //Test Detachable Link
    default{
    
        touch_start(integer n)
        {
        llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS );    
        //llRequestPermissions( llDetectedKey(0), PERMISSION_CHANGE_LINKS );    //does not work
        }
    
         run_time_permissions( integer perm )
        {
            if(perm & PERMISSION_CHANGE_LINKS) {llBreakLink(1);}
        }      
    }

     

    Thank you.

     

     

  15. Thank you so much for the information.  So...right, Trying to change over to a new animation engine at this point would be like reinventing the wheel, which is not an option lol. 

    That does surprise me that the animations from MLVPv2 are not in the poseball. Cause there are times when I deleted the furniture and only the poseball was left, and I hopped on it and the animation still worked - go figure hahaha.

    The solution for using experiences may be helpful, but still not sure if it would fit the doctor's needs...each time they have a new patient (bot baby), the new patient would need to have the parent log into the experience.  Granted it's only the first time, but still requires extra steps for the patient initially. I'll definitely speak with her to see if that would work. 

    I really appreciate everyone's help.  Thank you so much!

     

  16. Thank you all for suggestions. I actually had considered Experiences might be an option, but from everything I see, the avatar still needs to accept the Experience.  And I was told that the bot baby cannot touch anything to accept anything.   You mentioned about the parent logging in tho, so I'm not sure how that works. Bot babies and Experiences are all new to me. Would it be possible then for the parent to log into something and accept the Experience for the bot baby?

     

  17. I have several medical exam tables I created using MLPv2. Today I had the owner of a medical clinic ask me if there is a way to bypass requiring the avatar who's sitting on the poseball from having to respond "yes" to allow animation permissions.  I know AVSITTER and NPOSE can do that, but to try to recreate animation sets for all of my exam tables using another animation engine would be a herrendous task, and beyond my time capabilities. 

    Her reason for asking is because she has had several clients ask her - this is for "bot babies".  I never heard of them, but she said it's becoming a very common thing.  They are actually avatars, but no person behind them. They are controlled by the parent.  The parent can set the bot baby on an object, but the bot baby cannot touch anything to reply "yes" to give animation permissions.

    Does anyone know is MLPv2 might have a patch or a way of doing this?  I'm thinking it could be something extremely complicated, or extremely simple lol. 

    Thank you in advance!

     

×
×
  • Create New...