Jump to content

Xiija

Resident
  • Posts

    909
  • Joined

  • Last visited

Posts posted by Xiija

  1. @Bavid Dailey

    does the station you are using show what encoding they are using?

    Looks like it's not UTF-8 mebbe?

    can you check with something like this?

    key  XMLRequest;
    default
    {
        state_entry()
        {       
        }
        touch_start(integer total_number)
        {  
            string url = "http://whatisland.macchiatomedia.org:8118/stats?sid=1";       
            XMLRequest =
                 llHTTPRequest( url , [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
                 HTTP_METHOD, "GET", 
                 HTTP_MIMETYPE,"application/xml;charset=utf-8", 
                 HTTP_BODY_MAXLENGTH,16384,
                 HTTP_PRAGMA_NO_CACHE,TRUE], "");   
        }
        http_response(key k,integer status, list meta, string body)
        { 
            if(k ==  XMLRequest)   
            {  
                if(status != 200)
                {  llOwnerSay("error code\n");              
                   return;   
                }
                llOwnerSay("Body: \n" + body);    
                llOwnerSay("Meta: " + llDumpList2String( meta, "\n") );
            }
        }
    }

    I checked this shoutcast station and i see this...

    Quote

    [08:14] Object: Body:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><SHOUTCASTSERVER><CURRENTLISTENERS>4</CURRENTLISTENERS><PEAKLISTENERS>58</PEAKLISTENERS><MAXLISTENERS>5000</MAXLISTENERS><UNIQUELISTENERS>4</UNIQUELISTENERS><AVERAGETIME>37371</AVERAGETIME><SERVERGENRE>Contemporary Reggae</SERVERGENRE><SERVERGENRE2></SERVERGENRE2><SERVERGENRE3></SERVERGENRE3><SERVERGENRE4></SERVERGENRE4><SERVERGENRE5></SERVERGENRE5><SERVERURL>http://www.itswhatisland.com</SERVERURL><SERVERTITLE>WHAT?! Island</SERVERTITLE><SONGTITLE>Byron Lee &amp; the Dragonaires - Tiny Winey</SONGTITLE><STREAMHITS>16202</STREAMHITS><STREAMSTATUS>1</STREAMSTATUS><BACKUPSTATUS>0</BACKUPSTATUS><STREAMLISTED>1</STREAMLISTED><STREAMPATH>/stream</STREAMPATH><STREAMUPTIME>1631032</STREAMUPTIME><BITRATE>128</BITRATE><SAMPLERATE>44100</SAMPLERATE><CONTENT>audio/mpeg</CONTENT><VERSION>2.5.5.733 (posix(linux x64))</VERSION></SHOUTCASTSERVER>

    ETA: sorry, i think that is the XML encoding, but you may still be able find the ID3 tags if they are included?.. if they are using non-standard encoding, they should list what they are using ?

  2. I tried it with 64 2-meter tiles and a root prim under them all, but i think this code only works for one agent at a time?

    anyhoo, mebbe someone can use it ...

    integer old;
    integer new;
    default
    {
        state_entry()
        {   llSetLinkPrimitiveParamsFast( LINK_ALL_OTHERS,
              [ PRIM_COLOR, ALL_SIDES, <0.0, 0.0, 0.0>, 1.0,
                PRIM_GLOW,ALL_SIDES,0.0
              ]);       
        }
        collision(integer num)
        { 
           new =  llDetectedLinkNumber(0);      
           if( new != 1)
           {
               if(new != old)
               {  llSetLinkPrimitiveParamsFast( new,
                  [ PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,
                    PRIM_GLOW,ALL_SIDES,0.1]);
                     
                   llSetLinkPrimitiveParamsFast( old,
                  [ PRIM_COLOR, ALL_SIDES, <0.0, 0.0, 0.0>, 1.0,
                    PRIM_GLOW,ALL_SIDES,0.0]);
                  old = new;                         
               }   
            } 
            llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, 8.0, PI, 0.2);            
        }  
        no_sensor() 
        {  llSetLinkPrimitiveParamsFast( LINK_ALL_OTHERS,
              [ PRIM_COLOR, ALL_SIDES, <0.0, 0.0, 0.0>, 1.0,
                PRIM_GLOW,ALL_SIDES,0.0
              ]);
           llSensorRemove();
           old = 0;
        }   
    }

     

  3. @jak Scribe

    mostly the above + the stuff on the wiki & llRotLookAt ...

    default
    {
        on_rez(integer start_param)
        {  llResetScript();       
        }
        state_entry()
        {  vector pos      = llGetPos();
           vector OwnerPos = llList2Vector(llGetObjectDetails( llGetOwner(),[OBJECT_POS]), 0);     
           llRotLookAt( llRotBetween( <1.0, 0.0, 0.0>, llVecNorm( <OwnerPos.x, OwnerPos.y, pos.z> - pos ) ), 1.0, 0.4 );
        }    
    }

     

    • Thanks 1
  4. Just seeking a lil understanding..

    the wiki says :

    llSitTarget( vector offset, rotation rot );

    but when i use getlinkprimparams... it returns a list of 3 items?

     touch_start(integer total_number)
        {
            list ls = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_SIT_TARGET]);
            vector zero = llList2Vector(ls, 0);
            vector one = llList2Vector(ls, 1);
            vector three = llList2Vector(ls, 2);
            integer len = llGetListLength( ls );
            
            llOwnerSay("vecs: \n" + (string)zero + "\n " + (string)one + "\n "  + (string) three + "\n LEN: " + (string)len  );
        }
    Quote

    [13:06] Object: vecs:
    <0.00000, 0.00000, 0.00000>
     <0.00000, 0.00000, 1.85000>
     <0.00000, 0.00000, 0.00000>
     LEN: 3

     

  5. anyone else having problems with the MP ? .. when ever i change search params

    ( i.e. price, rights, etc ) and go to a second page, all i see is this ...

     

    43dfa17e1139b379ad6ffbe195fe39ef.png

    any ideas...?

    this one was first page, just changed the search params...

    9421d47585c5418c0a1a1bc50b429151.png

  6. @Todd Sivith

     

    tested this with 2 cylinder prims, seems to work ok... ( this script is in the root )

    integer tog = -1;
    default
    {
        touch_start(integer total_number)
        {  integer link = llDetectedLinkNumber(0);
           if( link == 2 )
           {    vector prim_pos = llList2Vector(llGetLinkPrimitiveParams( link, [PRIM_POSITION]),0);           
                prim_pos = ( prim_pos - llGetPos() ) / llGetRot();  
                prim_pos.z += (0.25 * (tog = -tog) );   
                llSetLinkPrimitiveParamsFast( link, [PRIM_POSITION,prim_pos]);
                llPlaySound("4c8c3c77-de8d-bde2-b9b8-32635e0fd4a6", 1.0);
           }  
        }
    }

     

    • Like 1
  7. @Gayngel

    dunno if this helps, but here is a very simple example... ( the url i'm using is a quickie server i made on replit )

    the send/recieve is all json

    LSL:

    key    http_request_id;
    string URL = "https://SecLife-php-1.tikihed.repl.co/index.php";
    
    default
    {
        state_entry()
        {     
        }
        touch_start(integer total_number)
        {  llOwnerSay("Sending...");
           string j_obj = llList2Json( JSON_OBJECT,     
               [  "name",   llDetectedName(0),
                  "region", llGetRegionName()     
               ]);
           http_request_id = llHTTPRequest(URL ,
           [ HTTP_METHOD,          "POST", 
             HTTP_MIMETYPE,        "application/x-www-form-urlencoded", 
             HTTP_BODY_MAXLENGTH,  16384,
             HTTP_PRAGMA_NO_CACHE, TRUE
           ], j_obj ); 
        }
        http_request(key id, string method, string body)
        { 
            integer responseStatus = 200;
            string responseBody    = "my method"; 
           
            if (method == "GET")
            {  responseStatus = 200;
               responseBody   = "ok";
            }
            // else if (method == "POST") ...;
            // else if (method == "PUT") ...;
            // else if (method == "DELETE") { responseStatus = 403; responseBody = "forbidden"; } 
            llHTTPResponse(id, responseStatus, responseBody);
        }
        http_response(key request_id, integer status, list metadata, string body) 
        {  llOwnerSay("\nHTTP Resp: \n \n" + body);   
        }
    }

    PHP:

    <?php
      if ($_SERVER["REQUEST_METHOD"] == "POST") {    
         $json = file_get_contents('php://input');
         $data = json_decode($json);
           foreach($data as $key=>$value){
              echo $key . " : " . $value . "\n";
            }
      }	 
    ?>

     

    • Like 1
    • Thanks 3
  8. Does anyone have any experience setting up a server on an old laptop/computer?

    A lot of the things i script in SL use node.js express servers running on repl.it,

    and they will soon be disallowing keep-alive pingers, so i guess i will need one.

    I'm hoping to keep it small and simple, and have both linux and windows comps i can use.

     i'm thinking of something like a WEPN ( Windows, Express, Postgres & Node) or PERN stack. ( or LAMP for linux ).

     

    Thanx for any ...

  9. thanx all for the helps, I used csv and could do both :)

    an example for anyone looking for list pointers...

    string webStations;
    list   jazz_a;
    list   jazz_b;
     
    default
    {
        state_entry()
        {  // JSON
            webStations = llList2Json( JSON_OBJECT, [] ); 
            
           // or json2list from web    
           jazz_a = [
            "https://breakz-high.rautemusik.fm/?ref=radiobrowserinfo",
            "https://jam-high.rautemusik.fm/?ref=radiobrowser",
            "https://mixtapes.superstreams.de/",
            "https://mixtapes.electronicssounds.com/",
            "http://stream.laut.fm/ruffneck-smille?ref=radiode",
            "http://o89fm.de:8000/main",
            "https://stream.0nlineradio.com/latin?ref=radiobrowser",
            "https://stream.0nlineradio.com/remix?ref=radiobrowser",
            "http://strm112.1.fm/reggae_mobile_mp3"
        ];
         jazz_b = [
            "2-https://breakz-high.rautemusik.fm/?ref=radiobrowserinfo",
            "2-https://jam-high.rautemusik.fm/?ref=radiobrowser",
            "2-https://mixtapes.superstreams.de/",
            "2-https://mixtapes.electronicssounds.com/",
            "2-http://stream.laut.fm/ruffneck-smille?ref=radiode",
            "2-http://o89fm.de:8000/main",
            "2-https://stream.0nlineradio.com/latin?ref=radiobrowser",
            "2-https://stream.0nlineradio.com/remix?ref=radiobrowser",
            "2-http://strm112.1.fm/reggae_mobile_mp3"
        ];
         string ja   = llList2CSV(jazz_a);
         string jb   = llList2CSV(jazz_b);
         webStations = llJsonSetValue (webStations, ["MAIN", "Jazz_a" ], ja); 
         webStations = llJsonSetValue (webStations, ["MAIN", "Jazz_b" ], jb); 
          
         string urls = llJsonGetValue (webStations, ["MAIN", "Jazz_a" ]); 
         llOwnerSay("\ndata:  " + urls);
         list   j1   = llCSV2List( urls );
         llOwnerSay("\nJSON data check: " + llList2String( j1, 0) );
         
         list   jmain = ["Jazz_a", "Jazz_b"];  // ================================= store list names as strings
         string jINDX = llList2String( jmain,0);   // ============================= get a string name
         string main  = llJsonGetValue (webStations, [ "MAIN" , jINDX ]);   // ==== call JSON string/list with a string name
         llOwnerSay("\nMain:\n" + main + "\n Touch to get LsD data");
         
        }
        touch_start(integer total_number)
        {   // LsD
            string j1 = llList2CSV(jazz_a);
            string j2 = llList2CSV(jazz_b);
            llLinksetDataWrite( "j1" ,j1 );//====================================== make a key string
            llOwnerSay( "\nLsD data check: \n" + llLinksetDataRead("j1")); //====== check it is stored
            
            list   jmain   = ["j1", "j2"];  // ==================================== store key names as list of strings
            string jINDX   = llList2String( jmain,0);  // ========================= get a string name
            llOwnerSay( "\n J data: \n" + llLinksetDataRead( jINDX ));      // ==== call LsD key with a string name
            
            list   jlist_1 = llCSV2List( llLinksetDataRead( jINDX ) );     // ===== seperate string into csv
            llOwnerSay("\nLsD first entry:\n " + llList2String( jlist_1, 0) );  
        }
    }

     

  10. @bigmoe Whitfield

    here is an example of an embed .... you can do arrays & objects etc..

    string slurl(key AvatarID)
    {
        string regionname = llGetRegionName();
        vector pos = llList2Vector(llGetObjectDetails(AvatarID, [ OBJECT_POS ]), 0);
     
        return "http://maps.secondlife.com/secondlife/"
            + llEscapeURL(regionname) + "/"
            + (string)llRound(pos.x) + "/"
            + (string)llRound(pos.y) + "/"
            + (string)llRound(pos.z) + "/";
    }
    key PostToDiscord(key AvatarID, string Message)
    {
        string SLURL = slurl(AvatarID); // call another function to get the slurl
        string user  = llKey2Name( AvatarID );
        list json    = [ 
            "username", llGetObjectName() + "",
            "embeds", 
                llList2Json(JSON_ARRAY,
                [
                llList2Json(JSON_OBJECT,
                    [
                        "color", "100000",
                        "title", "Server Location",
                        "url", SLURL,
                        "description",  "\nSender's Profile: http://my.secondlife.com/" +
                          llGetUsername(AvatarID)  + "\n \nMsg from " +
                          llGetUsername(AvatarID) + ": \n" + Message + "\n \n.",
                       
                        "author", llList2Json(JSON_OBJECT, 
                        [ 
                            "name",  user,
                            "icon_url", "https://my-secondlife-agni.akamaized.net/users/" +
                             llGetUsername(AvatarID) + "/sl_image.png"                               
                        ]),
                        "footer", llList2Json(JSON_OBJECT, 
                        [ 
                            "icon_url", "https://my-secondlife-agni.akamaized.net/users/" +
                             llGetUsername(AvatarID) + "/sl_image.png",
                            "text", "XMODS Discord Embedder"
                        ])                
                    ])
                 ]),
                "avatar_url",  "https://my-secondlife-agni.akamaized.net/users/" +
                                llGetUsername(AvatarID) + "/thumb_sl_image.png"
        ];
       
        return llHTTPRequest( WEBHOOK_URL ,
        [   HTTP_METHOD,          "POST", 
            HTTP_MIMETYPE,        "application/json",
            HTTP_VERIFY_CERT,      TRUE,
            HTTP_VERBOSE_THROTTLE, TRUE,
            HTTP_PRAGMA_NO_CACHE,  TRUE ],
              llList2Json(JSON_OBJECT, json) );
    }

    .

  11. Has anyone come up with any inventive ways to do pointers in LSL ?

    I need to cycle thru a list of lists ! lol

    currently dealing with this grunginess...

           integer x;
           integer len = llGetListLength( Jazz );
           for( x = 0; x < len; ++x )
           {   string node = (string)(x+1);
               string url  = llList2String(Jazz,x);
               webStations = llJsonSetValue (webStations, ["Jazz",  "NUM-" + node ], node); 
               webStations = llJsonSetValue (webStations, ["Jazz",  "NUM-" + node, "URL"], url); 
           }
           // ====================
           integer x2;
           integer len2 = llGetListLength( Rock );
           for( x2 = 0; x2 < len2; ++x2 )
           {   string node = (string)(x2+1);
               string url  = llList2String(Rock,x2);
               webStations = llJsonSetValue (webStations, ["Rock",  "NUM-" + node ], node); 
               webStations = llJsonSetValue (webStations, ["Rock",  "NUM-" + node, "URL"], url); 
           }
           // ========================
           integer x3;
           integer len3 = llGetListLength( Reggae );
           for( x3 = 0; x3 < len3; ++x3 )
           {   string node = (string)(x3+1);
               string url  = llList2String(Reggae,x3);
               webStations = llJsonSetValue (webStations, ["Reggae",  "NUM-" + node ], node); 
               webStations = llJsonSetValue (webStations, ["Reggae",  "NUM-" + node, "URL"], url); 
           }
           // ================================
           integer x4;
           integer len4 = llGetListLength( Country );
           for( x4 = 0; x4 < len4; ++x4 )
           {   string node = (string)(x4+1);
               string url  = llList2String(Country,x4);
               webStations = llJsonSetValue (webStations, ["Country",  "NUM-" + node ], node); 
               webStations = llJsonSetValue (webStations, ["Country",  "NUM-" + node, "URL"], url); 
           }
           

     

×
×
  • Create New...