Advertisement
giratina1999

Untitled

Jul 7th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. Target HUD
  2.  
  3. integer index;
  4. key HUDtarget;
  5. key photoReq;
  6. integer HUDattachpoint=ATTACH_HUD_CENTER_1;
  7. string missingtexture="1a6e02aa-23a8-7a5f-0525-44d724144f89";
  8. Target()
  9. {
  10. list agents=llGetAgentList(AGENT_LIST_REGION,[]);
  11. integer ownerindex=llListFindList( agents, (list)llGetOwner() );
  12. integer num_agents;
  13. agents=llDeleteSubList( agents, ownerindex, ownerindex );
  14. num_agents = llGetListLength(agents);
  15. index=((index<0)*(num_agents-1))+((index>=0)*(index*(index!=num_agents)));
  16. HUDtarget=llList2Key(agents, index);
  17. llSetText(llKey2Name(HUDtarget)+" ("+llGetDisplayName(HUDtarget)+")\n"+(string)HUDtarget, <0.0, 1.0, 0.0>, 1.0);
  18. photoReq=llHTTPRequest("http://world.secondlife.com/resident/" + (string)HUDtarget, [], "");
  19. llOwnerSay("("+(string)(index+1)+"/"+(string)(num_agents) +") Current Target: secondlife:///app/agent/" + (string)HUDtarget + "/inspect " + (string)HUDtarget );
  20. }
  21. default
  22. {
  23. state_entry()
  24. {
  25. llRequestPermissions(llGetOwner(),PERMISSION_ATTACH);
  26. }
  27. attach(key id)
  28. {
  29. if (id)
  30. {
  31. llSetScale(<0.1, 0.15, 0.1>);
  32. llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <2.0, 0.5, 1.0>, <0.0, 0.0, 0.0>, PRIM_ROT_LOCAL, <0.000000, -0.707107, 0.000000, 0.707107>, PRIM_COLOR, 0, <1.0,1.0,1.0>, 1.0, PRIM_COLOR, 1, <0.0,1.0,0.0>, 1.0, PRIM_COLOR, 3, <0.0,1.0,0.0>, 1.0, PRIM_COLOR, 2, <1.0,1.0,1.0>, 0.0, PRIM_COLOR, 4, <1.0,1.0,1.0>, 0.0]);
  33. llRotateTexture(270.0*DEG_TO_RAD,0);
  34. HUDattachpoint=llGetAttached();
  35. Target();
  36. llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
  37. }
  38. }
  39. on_rez(integer param)
  40. {
  41. if ( !llGetAttached() )
  42. {
  43. index=0;
  44. HUDtarget=NULL_KEY;
  45. llSetText("", <0.0, 1.0, 0.0>, 1.0);
  46. llSetTexture(missingtexture, 0);
  47. llRequestPermissions(llGetOwner(),PERMISSION_ATTACH);
  48. }
  49. }
  50. touch_start(integer n)
  51. {
  52. index=index+(llDetectedTouchFace(0)==1)-(llDetectedTouchFace(0)==3);
  53. Target();
  54. }
  55. http_response(key request_id, integer status, list metadata, string body)
  56. {
  57. if( request_id == photoReq )
  58. {
  59. string photoID;
  60. integer StartIndex=llSubStringIndex(body,"<title>");
  61. integer EndIndex=llSubStringIndex(body,"</title>");
  62. if( StartIndex!=-1)
  63. {
  64. integer tempIndex=llSubStringIndex(body,"imageid")+18;
  65. if(tempIndex>17)photoID=llGetSubString(body,tempIndex,tempIndex+35);
  66. }
  67. if ( photoID==NULL_KEY || photoID=="" ) photoID=missingtexture;
  68. llSetTexture(photoID, 0);
  69. }
  70. }
  71. run_time_permissions(integer perms)
  72. {
  73. if ( perms & PERMISSION_ATTACH ) llAttachToAvatar(HUDattachpoint);
  74. if ( perms & PERMISSION_TAKE_CONTROLS ) llTakeControls(CONTROL_BACK, FALSE, TRUE);
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement