Advertisement
RuthvenWillenov

Parse Camera Params from String List

Oct 7th, 2024 (edited)
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. default
  4. {
  5.     state_entry()
  6.     {
  7.         llListen(-5,"","","");
  8.     }
  9.    
  10.     listen(integer chan, string name, key id, string msg)
  11.     {
  12.         list split = llParseStringKeepNulls(msg,["||"],[]);
  13.         list params;
  14.         integer len = llGetListLength(split);
  15.         integer i;
  16.         for(i = 0; i < len; i +=2)
  17.         {
  18.             integer rule = llList2Integer(split,i);
  19.             if((rule == CAMERA_POSITION)||
  20.             (rule == CAMERA_FOCUS_OFFSET)||
  21.             (rule == CAMERA_FOCUS))
  22.             {
  23.                 params += [rule,(vector)llList2String(split,i+1)];
  24.             }
  25.             if((rule == CAMERA_BEHINDNESS_ANGLE) ||
  26.             (rule == CAMERA_BEHINDNESS_LAG) ||
  27.             (rule == CAMERA_DISTANCE) ||
  28.             (rule == CAMERA_FOCUS_LAG) ||
  29.             (rule == CAMERA_FOCUS_THRESHOLD) ||
  30.             (rule == CAMERA_PITCH) ||
  31.             (rule == CAMERA_POSITION_LAG) ||
  32.             (rule == CAMERA_POSITION_THRESHOLD))
  33.             {
  34.                 params += [rule, (float)llList2String(split,i+1)];
  35.             }
  36.             else if((rule == CAMERA_ACTIVE) ||
  37.             (rule == CAMERA_FOCUS_LOCKED) ||
  38.             (rule == CAMERA_POSITION_LOCKED))
  39.             {
  40.                 params += [rule,llList2Integer(split,i+1)];
  41.             }
  42.         }
  43.         //llSetCameraParams(params);
  44.         llOwnerSay(llDumpList2String(params,"|"));
  45.     }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement