Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. integer timeToGive1 = 560; // Time required for campers to camp (in seconds)
  2. string prize1 = "Dunkle Macht"; // The name of the prize (must be in the camp chair's inventory)
  3. string animation; // the first animation in inventory will automatically be used
  4. // the animation name must be stored globally to be able to stop the animation when standing up
  5. integer ctlChannel = 123221; // Control channel, default is 12321, MUST CHANGE THIS!!!
  6.  
  7. // Internal Veriables
  8. integer sitTime = 0;
  9. key sitter;
  10. string sitterName;
  11.  
  12. default
  13. {
  14. state_entry()
  15. {
  16. if (prize1 == "")
  17. {
  18. prize1 = llGetInventoryName(INVENTORY_OBJECT,0);
  19. }
  20. llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
  21. }
  22.  
  23. changed(integer change)
  24. {
  25. if (change & CHANGED_LINK)
  26. {
  27. key av = llAvatarOnSitTarget();
  28. if (av) //evaluated as true if not NULL_KEY or invalid
  29. llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
  30. else // avatar is standing up
  31. {
  32. if (animation)
  33. llStopAnimation(animation); // stop the started animation
  34. llResetScript(); // release the avatar animation permissions
  35. }
  36. }
  37. }
  38.  
  39. run_time_permissions(integer perm)
  40. {
  41. if (perm & PERMISSION_TRIGGER_ANIMATION)
  42. {
  43. animation = llGetInventoryName(INVENTORY_ANIMATION,0); // get the first animation from inventory
  44. if (animation)
  45. {
  46. llStopAnimation("sit"); // stop the default sit animation
  47. llStartAnimation(animation);
  48. }
  49. }
  50. }
  51. }
  52. {
  53. { llSetText("Ready for camping\nSit here for "+(string) (timeToGive1 / 60)+"minute(s) to get "+prize1+" for free!",<1,1,1>,1);
  54. sitTime = 0;
  55. sitter = NULL_KEY;
  56. sitterName = "No one";
  57. }
  58. changed(integer change)
  59. {
  60. if (change & CHANGED_LINK) {
  61. key target = llAvatarOnSitTarget();
  62. if (target) {
  63. sitter = target;
  64. sitterName = llKey2Name(target);
  65. state sitting;
  66. }
  67. }
  68. }
  69. }
  70.  
  71. state sitting
  72. {
  73. state_entry()
  74. {
  75. llSetTimerEvent(1.0);
  76. llListen(ctlChannel,"",NULL_KEY,"");
  77. }
  78. listen(integer channel, string name, key id, string msg) {
  79. if (channel == ctlChannel) {
  80. if (msg == "kick") {
  81. llUnSit(sitter);
  82. }
  83. }
  84. }
  85. timer()
  86. {
  87. llSetText(" Chair in use\nOccupied by "+sitterName + "\nwill get "+prize1+" after " + (string) (timeToGive1 - sitTime) + " second(s)",<1,1,1>,1);
  88. if (sitTime++ > timeToGive1) {
  89. llGiveInventory(sitter,prize1);
  90. llUnSit(sitter);
  91. llSay(0,sitterName + ", thank you for camping, enjoy your prize!");
  92. state default;
  93. }
  94. }
  95. changed(integer change)
  96. {
  97. if (change & CHANGED_LINK) {
  98. if (llAvatarOnSitTarget() == NULL_KEY)
  99.  
  100. }
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement