Advertisement
blis_nightfire

Untitled

Jun 27th, 2024
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Linden Scripting 1.79 KB | Source Code | 0 0
  1. //Hud Adjustment
  2. vector stayOnScreen;
  3.  
  4. vector hudAdjust(float aspect, integer newPos) {
  5.     vector rootPrim = llList2Vector(llGetLinkPrimitiveParams(LINK_ROOT, [PRIM_POS_LOCAL]), 0);
  6.     return llList2Vector(["Keeps HUD on screen no matter users screen width.",
  7.         /*Top    Left   - Justified = 1*/ <0.0, ( (aspect / 2) - (rootPrim.y / 2) - 0.03), (0.5 - (rootPrim.z / 2) - 0.07)>,
  8.         /*Top    Center - Justified = 2*/ <0.0, 0.0,                                       (0.5 - (rootPrim.z / 2) - 0.07)>,
  9.         /*Top    Right  - Justified = 3*/ <0.0, (-(aspect / 2) + (rootPrim.y / 2) + 0.03), (0.5 - (rootPrim.z / 2) - 0.07)>,
  10.         /*Center Left   - Justified = 4*/ <0.0, ( (aspect / 2) - (rootPrim.y / 2) - 0.03), 0.0>,
  11.         /*Center Center - Justified = 5*/ <0.0, 0.0,                                       0.0>,
  12.         /*Center Right  - Justified = 6*/ <0.0, (-(aspect / 2) + (rootPrim.y / 2) + 0.03), 0.0>,  
  13.         /*Bottem Left   - Justified = 7*/ <0.0, ( (aspect / 2) - (rootPrim.y / 2) - 0.03), (-0.5 + (rootPrim.z / 2) + 0.03)>,
  14.         /*Bottem Center - Justified = 8*/ <0.0, 0.0,                                       (-0.5 + (rootPrim.z / 2) + 0.03)>,
  15.         /*Bottem Right  - Justified = 9*/ <0.0, (-(aspect / 2) + (rootPrim.y / 2) + 0.03), (-0.5 + (rootPrim.z / 2) + 0.03)>
  16.     ], newPos);
  17. }
  18.  
  19. default {
  20.     run_time_permissions(integer perms) {  
  21.         integer attached = llGetAttached();
  22.         if (attached = ATTACH_HUD_CENTER_1 || ATTACH_HUD_CENTER_2) {
  23.             if (!attached) llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA);
  24.             else if (perms & PERMISSION_TRACK_CAMERA) { stayOnScreen = hudAdjust(llGetCameraAspect(), 5); }
  25.         } else { llOwnerSay("Please attach to center2 hud position."); llDetachFromAvatar(); }
  26.     }    
  27. }
  28.  
Tags: LSL Hud
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement