Advertisement
BrendanD

simpler

Nov 23rd, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer LEASED_UNTIL = 200;
  2. integer DAYSEC = 86400;
  3.  
  4. string timespanHover(integer time)
  5. {      
  6.     integer days = time / DAYSEC;
  7.     integer curtime = (time / DAYSEC) - (time % DAYSEC);
  8.     integer hours = curtime / 3600;
  9.     integer minutes = (curtime % 3600) / 60;
  10.     integer seconds = curtime % 60;
  11.      
  12.     return (string)llAbs(days) + " days, " + (string)llAbs(hours) + " hours,\n"
  13.         + (string)llAbs(minutes) + " minutes, " + (string)llAbs(seconds) + " seconds";
  14. }
  15.  
  16. default
  17. {
  18.     touch_start(integer total_number)      
  19.     {
  20.         //basicaly paying it adds multiple of these
  21.         //this woudl be a pay per add time
  22.         LEASED_UNTIL = LEASED_UNTIL + (1 * DAYSEC);
  23.     }
  24.    
  25.     state_entry()
  26.     {
  27.         llSetTimerEvent(0.5); //0.5 sec checks
  28.     }
  29.  
  30.     timer()
  31.     {
  32.         llSetText("Rent due in:\n" + timespanHover(LEASED_UNTIL + llGetUnixTime()), <0.0, 1.0, 0.0>, 1.0);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement