Script.lsl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // :SHOW:1
  2. // :CATEGORY:NPC
  3. // :NAME:HyperGrid Story Nine
  4. // :AUTHOR:Ferd Frederix
  5. // :KEYWORDS:NPC, controller, cyber helmet
  6. // :CREATED:2015-11-24 20:25:33
  7. // :EDITED:2015-11-24 19:25:33
  8. // :ID:1087
  9. // :NUM:1843
  10. // :REV:1.0
  11. // :WORLD:OpenSim
  12. // :DESCRIPTION:
  13. // NPC helmet controller
  14. // Accepts a single chatted command to msake the cyber being helmet flash for a second or two.
  15. // rezzed in world and not worn
  16. // :CODE:
  17. // TUNABLES
  18. integer debug = 0;
  19. // GLOBALS
  20. integer counter = 0;
  21. integer listener;
  22. // FUNCTIONS
  23. DEBUG(string msg)
  24. {
  25. if (debug & 1)
  26. llSay(0,llGetScriptName() + ":" + msg);
  27. if (debug & 2)
  28. llSetText(msg, <1,0,0>,1.0);
  29. }
  30. NpcSaySomething(){
  31. list sayings = ["The helmet begins to glow","A beam of light appears","The helmet begins to hum","The cyberbeing helmet is activated", "bzzz", "Zap","KaPow!"];
  32. key NpcKey = llGetOwner();
  33. DEBUG("Owner Key = " + (string) NpcKey);
  34. llSay(0, llList2String(sayings,counter++));
  35. if (counter > llGetListLength(sayings)) {
  36. counter = 0;
  37. }
  38. }
  39. Go()
  40. {
  41. NpcSaySomething();
  42. llSetLinkPrimitiveParamsFast(0,[PRIM_GLOW,ALL_SIDES,.2, PRIM_SIZE, <2,2,2>,PRIM_COLOR,ALL_SIDES,<1,1,1>,0.5 ]);
  43. llSetTimerEvent(2);
  44. }
  45. integer Helmet_Channel = 576;
  46. default
  47. {
  48. on_rez(integer p)
  49. {
  50. llResetScript();
  51. }
  52. changed(integer what)
  53. {
  54. if (what & CHANGED_REGION_START)
  55. {
  56. llResetScript();
  57. }
  58. }
  59. state_entry()
  60. {
  61. llSetText("", <1,0,0>,1.0);
  62. llListenRemove(listener);
  63. listener= llListen(Helmet_Channel, "","","BOOM"); // listen for boom command
  64. llSetTextureAnim(ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1.0, 1.0, 1.0);
  65. llSensorRepeat("Namaka ♥", NULL_KEY, AGENT, 25.0, PI,5);
  66. }
  67. listen(integer channel, string name, key id, string msg)
  68. {
  69. Go();
  70. }
  71. touch_start(integer total_number)
  72. {
  73. Go();
  74. }
  75. sensor(integer n)
  76. {
  77. llSetRegionPos(llDetectedPos(0) + <0,0,1>);
  78. }
  79. no_sensor()
  80. {
  81. llSetRegionPos(<200, 128, 48>); // sop we can find this blasted thing
  82. }
  83. timer()
  84. {
  85. llSetLinkPrimitiveParamsFast(0,[PRIM_GLOW,ALL_SIDES,0.2, PRIM_SIZE, <1.5,1.5,1> ] );
  86. llSleep(0.25);
  87. llSetLinkPrimitiveParamsFast(0,[PRIM_GLOW,ALL_SIDES,0.2, PRIM_SIZE, <1.2,1.2,1> ] );
  88. llSetLinkPrimitiveParamsFast(0,[PRIM_GLOW,ALL_SIDES,0, PRIM_SIZE, <1,1,1> ] );
  89. llSleep(0.25);
  90. llSetLinkPrimitiveParamsFast(0,[PRIM_GLOW,ALL_SIDES,0, PRIM_SIZE, <1,1,1>,PRIM_COLOR,ALL_SIDES,<1,1,1>,0 ] );
  91. llSetTimerEvent(0);
  92. }
  93. }