Advertisement
Gayngel

Countdown item giver with percentage of time left to give

Apr 17th, 2016
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. integer time_elapsed;
  2. float time = 5.0;
  3. key toucher;
  4.  
  5. default
  6. {
  7. ¶touch_end(integer num)
  8. {
  9. toucher = llDetectedKey(0);
  10. time_elapsed = 0;
  11. llResetTime();
  12. llSetTimerEvent(1.0);
  13.  
  14. }
  15.  
  16. timer()
  17. {
  18. time_elapsed = llRound(llGetTime());
  19. string percentage = (string)(time_elapsed/time*100);
  20. integer idx = llSubStringIndex(percentage, ".");
  21. llSetText(llGetSubString(percentage,0,idx-1)+"%",<1.0,0.0,0.0>,1.0);
  22.  
  23.  
  24. if(time_elapsed == 5.0)
  25. {
  26.  
  27. llGiveInventory(toucher, llGetInventoryName(INVENTORY_OBJECT, 0) );
  28. llSetTimerEvent(0.0);
  29.  
  30. }
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement