rock controller.lsl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // :SHOW:
  2. // :CATEGORY:NPC
  3. // :NAME:All-In one example Sequencer
  4. // :AUTHOR:Ferd Frederix
  5. /// :REV:1
  6. // :WORLD:Opensim
  7. // :DESCRIPTION:
  8. // Sample collision script for NPC sequence for the rock fall game
  9. // :CODE:
  10. list things ;
  11. DoIt()
  12. {
  13. things = [ -1,1,"@pause=1"];
  14. things = [ -1,8,"@sound=tremor"];
  15. things += [ 2,4,"@say=Oooooh a Human fell down and went boom!"];
  16. things += [ 2,0.1,"@rotate=180"];
  17. things += [ 4,4,"@say=No one said rocks would be safe hahahaha!"];
  18. things += [ 2,5,"@say=Anyone want to bet this silly human will never figure out how to get to the end of this?"];
  19. things += [ 3,2,"@say=Not me!"];
  20. things += [ 3,0.1,"@rotate=90"];
  21. things += [ 2,1,"@say=Not me!"];
  22. things += [ 2,0.1,"@rotate=90"];
  23. things += [ 3,2,"@fly=<81.33295, 53.93847, 34.28074>"];
  24. things += [ 3,2,"@fly=<83.37263, 66.61314, 33.87567>"];
  25. things += [ 2,2,"@fly=<81.33295, 53.93847, 34.28074>"];
  26. things += [ 2,2,"@fly=<90.31698, 65.18839, 32.46637>"];
  27. things += [ 4,1,"@say=No way ! Goodbye!"];
  28. things += [ 4,1,"@rotate=270"];
  29. things += [ 4,1,"@rotate=90"];
  30. things += [ 4,2,"@fly=<81.33295, 53.93847, 34.28074>"];
  31. things += [ 4,2,"@fly=<90.31698, 65.18839, 32.46637>"];
  32. things += [ 5,1,"@rotate=270"];
  33. things += [ 5,2,"@rotate=90"];
  34. things += [ 5,2,"@say=I bet this human thinks everything here is worth their trust."];
  35. things += [ 5,2,"@fly=<81.33295, 53.93847, 34.28074>"];
  36. things += [ 5,0.1,"@fly=<90.49598, 68.05671, 35.85766>"];
  37. things += [ 5,4,"@say=Good luck!"];
  38. things += [ -1,0.1,"@delete"];
  39. Speak();
  40. }
  41. Speak() {
  42. integer prim = llList2Integer(things,0);
  43. float time = llList2Float(things,1);
  44. string msg = llList2String(things,2);
  45. //llOwnerSay("Prim:" + (string) prim + " time:" + (string) time + " Msg:" + msg);
  46. if (prim) {
  47. things = llDeleteSubList(things,0,2);
  48. llMessageLinked(prim,0, msg,"");
  49. if (time > 0) {
  50. llSetTimerEvent(time);
  51. } else {
  52. llOwnerSay("Whooops, time = 0!");
  53. llOwnerSay("Prim:" + (string) prim + " time:" + (string) time + " Msg:" + msg);
  54. llSetTimerEvent(0);
  55. }
  56. } else {
  57. llOwnerSay("Done");
  58. Reset();
  59. llSetTimerEvent(0);
  60. }
  61. }
  62. Reset()
  63. {
  64. llSetStatus(STATUS_PHANTOM, FALSE); // Rev 2.
  65. llVolumeDetect(FALSE);
  66. llSleep(0.1);
  67. llVolumeDetect(TRUE);
  68. }
  69. default
  70. {
  71. state_entry()
  72. {
  73. llSetText("",<1,1,1>,1.0);
  74. Reset();
  75. }
  76. timer()
  77. {
  78. Speak();
  79. }
  80. collision_start(integer n) {
  81. //llOwnerSay("Collided with " + llKey2Name(llDetectedKey(0)));
  82. if (! osIsNpc(llDetectedKey(0)))
  83. {
  84. llOwnerSay("Rock fall!");
  85. llTriggerSound("tremor",1.0);
  86. DoIt();
  87. }
  88. }
  89. touch_start(integer p)
  90. {
  91. DoIt();
  92. }
  93. changed(integer what)
  94. {
  95. if (what & CHANGED_REGION_START)
  96. {
  97. llResetScript();
  98. }
  99. }
  100. }