SHARE
TWEET

Untitled

a guest Feb 20th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. list sides;
  2. list deftextures;
  3.  
  4. string profile_key_prefix = "<meta name=\"imageid\" content=\"";
  5. string profile_img_prefix = "<img alt=\"profile image\" src=\"http://secondlife.com/app/image/";
  6. integer profile_key_prefix_length; // calculated from profile_key_prefix in state_entry()
  7. integer profile_img_prefix_length; // calculated from profile_key_prefix in state_entry()
  8.  
  9. GetProfilePic(key id){
  10.     string URL_RESIDENT = "http://world.secondlife.com/resident/";
  11.     c=llHTTPRequest( URL_RESIDENT + (string)id,[HTTP_METHOD,"GET"],"");
  12. }
  13. GetDefaultTextures(){
  14.     integer    i;
  15.     integer    faces = llGetNumberOfSides();
  16.     for (i = 0; i < faces; i++){
  17.         sides+=i;
  18.         deftextures+=llGetTexture(i);
  19.     }
  20. }
  21. SetDefaultTextures(){
  22.     integer    i;
  23.     integer    faces;
  24.     faces = llGetNumberOfSides();
  25.     for (i = 0; i < faces; i++){
  26.         llSetTexture(llList2String(deftextures,i),i);
  27.     }
  28. }
  29. key c;
  30. key ocheck;
  31. default{
  32.     on_rez(integer r){
  33.         llResetScript();
  34.     }
  35.     state_entry(){
  36.         profile_key_prefix_length = llStringLength(profile_key_prefix);
  37.         profile_img_prefix_length = llStringLength(profile_img_prefix);
  38.         llSetText("",<0.8,0,1>,1);
  39.         GetDefaultTextures();
  40.         GetProfilePic(llGetOwner());
  41.     }
  42.     http_response(key req,integer stat, list met, string body){
  43.         integer s1 = llSubStringIndex(body, profile_key_prefix);
  44.         integer s1l = profile_key_prefix_length;
  45.         if(s1 == -1){ // second try
  46.             s1 = llSubStringIndex(body, profile_img_prefix);
  47.             s1l = profile_img_prefix_length;
  48.         }
  49.  
  50.         if(s1 == -1){ // still no match?
  51.             SetDefaultTextures();
  52.         }
  53.         else{
  54.             s1 += s1l;
  55.             key UUID=llGetSubString(body, s1, s1 + 35);
  56.             if (UUID == NULL_KEY) {
  57.                 SetDefaultTextures();
  58.             }
  59.             else {
  60.                 c = NULL_KEY;
  61.                 llSetTexture(UUID,ALL_SIDES);
  62.                 ocheck = llRequestAgentData(llGetOwner(),DATA_ONLINE);
  63.                 llSetTimerEvent(25);
  64.             }
  65.         }
  66.     }timer(){
  67.         ocheck = llRequestAgentData(llGetOwner(),DATA_ONLINE);
  68.     }
  69.     dataserver(key qid,string data){
  70.         llSetTimerEvent(0.0);
  71.         if(qid == ocheck){
  72.             integer run = (integer)data;
  73.             llSetLinkColor(LINK_ALL_OTHERS, <128 * llAbs(run - 1), 128 * run, 0>, ALL_SIDES);
  74.             ocheck = NULL_KEY;
  75.         }
  76.         llSetTimerEvent(25);
  77.     }
  78. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top