Jump to content

Gayngel

Resident
  • Posts

    184
  • Joined

  • Last visited

Posts posted by Gayngel

  1. 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

     

  2. To demonstrate what Frionil means:

     

    //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 = 0;   // LSL is a zero-indexed language
            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
                                        
             
         // move your processing stuff here
     
            if (isDoctorNear==0) 
                {
                //state PAIRED;  //doctor not in range - go back to beginnine
                // since you are in state PAIRED already and you have not closed the listener you dont need to call state PAIRED; again. The listener is still listening for commands.
                // calling a state within the same state will do nothing.    
                  
                
                } else{
                //do nothing and move foward to command processing below
                }
    
    
     
    //-------------------
    //--Process commands here based on command received from the bracelet                          
            
        }
    
        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()  
    
           
                 
     }//end channel
    } // end listen
    } //end state PAIRED

     

  3. integer lhandle;
    default
    {
        state_entry()
        {
            llSetPayPrice(PAY_HIDE,[1]);
        }
        
        // if the customer right clicks and select Pay from the menu
    
        money(key id, integer amount)
        {
           llGiveMoney(id,amount); 
           llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT,0)); 
        }
        
        // if the customer right clicks and selects Touch from the menu
        
        touch_end(integer num)
        {
          // llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT,0)); 
          // either give the item directly or bring up a dialog menu to deliver the item
            
            
           llListenRemove(lhandle);
           lhandle = llListen(-777,"","","");
           
           llDialog(llDetectedKey(0),"Select deliver to get your free item!",["Deliver"],-777); 
            
            
        }
        
        listen(integer chan, string name, key id, string msg)
        {
            if(chan == -777)
            {
               
               if(msg == "Deliver")
               {
              llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT,0)); 
               llListenRemove(lhandle);
               }
                
            }
            
            
        }
    }

     

    • Like 2
  4. 26 minutes ago, Sylvia Wasp said:

    I'm not sure I get this.  My vendors are three prims, the vendor and a forward and back button on each side, so you cycle through the items by pressing the buttons, than right-click and select "Pay" for whatever item you stop on.  The Pay dialogue has a single button with the price of the item on it.  If the item is zero lindens though, that button doesn't show on the dialogue.  

    If it's really true as Wolfie says that llSetPayPrice can't generate an event on a zero linden item, then maybe the "take a dollar - give a dollar" thing is the only way.  

    On the right click menu the Pay button will give the pay dialog with the pay buttons and the Touch button can either give an llDialog menu (blue pop-up menu) where the customer can select Deliver and the item be delivered from the listen event, or the Touch button can just deliver the item directly from the touch event without a dialog.

  5. The Caspervend multi-vendor does it two ways. Either you pay L$1 /  get L$1 or you can right click and select touch for a dialog menu and select the deliver button and deliver the item from the listen event. I'm not sure how your vendor is set up but a 3rd possible way is to on display of a free item disable the actual Buy button on the right click menu with llSetPayprice(PAY_HIDE,[PAY_HIDE]) and change the "Touch" button on the right click menu to "Buy" with llSetTouchText and set llSetClickAction to touch and then in a touch event deliver the item.

  6. You can set the price to 0 with llSetPayPrice but paying L$0 doesn't trigger any event.

    To turn a prim into a vendor that you can buy the contents for L$0 just edit the vendor prim and under the general tab select the "For Sale" check mark and set the price to 0 and then from the drop down select contents then select Apply. You can then set the click action to "buy object". Put in what you want to sell in the contents of the vendor.

  7. I am a programmer with 8 years experience in scripting with LSL. I enjoy building custom systems ground-up and will provide low lag solutions to my customer's specifications.

    I can:
    - Write simple, minor fixes to existing scripts
    -Create tip jars, club systems, dialog menus, detections, HUDs and vendors,etc
    -Make more advanced systems such as pose systems, RLV, vehicles, pathfinding, weaponry, SL experiences and HTTP for external coms to websites and databases.
    - Also experienced in HTML/CSS, php, SQL, Ruby, Rails, Python and Javascript 

    -I can also do scripting in Open Sim if needed.

    Script adaptations and library resources if used will be fully cited.

    I work closely with my clients providing working demos of their products with full perm models on completion and delivery. Note: Models will be mockups to present the functioning script, clients must finalize prim designs and builds themselves.

    Price: $7 USD an hour. Paypal or Linden Dollars accepted. 

    Scripts will be full perm on final payment .

    Delivery may be a few hours to weeks also dependent on script complexity and work load.

    IM me inworld. If I'm offline IMs will go to email and will get back to you ASAP. (Forwarning: Adult rated profile)

    Copy/paste this link to the nearby chat window in your viewer, press enter then click on my name in chat to open my profile:

    secondlife:///app/agent/a9ba2797-81af-429d-9833-51127ad5593c/about

    Discord: Gayngel#0431

    Marketplace Store:

    https://marketplace.secondlife.com/stores/149734

    • Like 1
  8. I am a programmer with 8 years experience in scripting with LSL. I enjoy building custom systems ground-up and will provide low lag solutions to my customer's specifications.

    I can:
    - Write simple, minor fixes to existing scripts
    -Create tip jars, club systems, dialog menus, detections, HUDs and vendors,etc
    -Make more advanced systems such as pose systems, RLV, vehicles, pathfinding, weaponry, SL experiences and HTTP for external coms to websites and databases.
    - Also experienced in HTML/CSS, php, SQL, Ruby, Rails, Python and Javascript 

    -I can also do scripting in Open Sim if needed.

    Script adaptations and library resources if used will be fully cited.

    I work closely with my clients providing working demos of their products with full perm models on completion and delivery. Note: Models will be mockups to present the functioning script, clients must finalize prim designs and builds themselves.

    Price: $7 USD an hour. Paypal or Linden Dollars accepted. 

    Scripts will be full perm on final payment .

    Delivery may be a few hours to weeks also dependent on script complexity and work load.

    IM me inworld. If I'm offline IMs will go to email and will get back to you ASAP. (Forwarning: Adult rated profile)

    Copy/paste this link to the nearby chat window in your viewer, press enter then click on my name in chat to open my profile:

    secondlife:///app/agent/a9ba2797-81af-429d-9833-51127ad5593c/about

    Marketplace Store:

    https://marketplace.secondlife.com/stores/149734

  9. 10 hours ago, ItHadToComeToThis said:
    $stmt=$pdo->prepare("INSERT INTO UserData (uuid, name, $column) VALUES ($uuid, $name, $stats)");
            $stmt->execute([$uuid, $name, $stats]);

    $stmt=$pdo->prepare("INSERT INTO UserData (uuid, name, column) VALUES ('".$uuid."', '".$name."', '".stats."')");
    $stmt->execute();

    • Thanks 1
  10. I am a programmer with 8 years experience in scripting with LSL. I enjoy building custom systems ground-up and will provide low lag solutions to my customer's specifications.

    I can write simple, minor fixes to existing scripts, tip jars, club systems, dialog menus, detections, HUDs and vendors to more advanced systems such as pose systems, RLV, vehicles, pathfinding, weaponry, SL experiences and HTTP for external coms to websites and databases. (Also experienced in HTML/CSS, php, SQL, Ruby, Rails, Python and Javascript )

    I can also do scripting in Open Sim if needed.

    Script adaptations and library resources if used will be fully cited.

    I work closely with my clients providing working demos of their products with full perm models on completion and delivery. Note: Models will be mockups to present the functioning script, clients must finalize prim designs and builds themselves.

    Price: $7 USD an hour. Paypal or Linden Dollars accepted. 

    Scripts will be full perm on final payment .

    Delivery may be a few hours to weeks also dependent on script complexity and work load.

    IM me inworld. If I'm offline IMs will go to email and will get back to you ASAP. (Forwarning: Adult rated profile)

    Copy/paste this link to the nearby chat window in your viewer, press enter then click on my name in chat to open my profile:

    secondlife:///app/agent/a9ba2797-81af-429d-9833-51127ad5593c/about

    Marketplace Store:

    https://marketplace.secondlife.com/stores/149734

  11. Recently I've been learning PHP and SQL and I now have a project that requires an external server as LSD wont have sufficient data storage. I can create and retrieve data from a table within my PHP script but I have no clue how to connect it to an inworld source.

    I've looked at some of the PHP server examples on the wiki but they are just too involved for me to understand.

    I would like a simple example of POSTING/GETTING a message to a PHP script (for example llHTTPRequest(example.com/example.php, [HTTP_METHOD,"POST"], "Greet" )) and an example  php script that receives the post and sends a message back ("Hello World") to the LSL script and then I reckon I can build up to retrieving data from the database from there.

    Can anyone show me how to do this? Thanks in advance.

    Edit: I know the LSL parts, keeping track of the URL and all that, I'm really more interested in the PHP side.

    • Like 1
×
×
  • Create New...