Script.lsl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // :CATEGORY:HyperGate
  2. // :NAME:OpenSim WalkthroughTeleporter
  3. // :AUTHOR:John Lester (PathFinder)
  4. // :KEYWORDS:
  5. // :CREATED:2014-02-09
  6. // :EDITED:2014-02-08 08:13:30
  7. // :ID:1022
  8. // :NUM:1586
  9. // :REV:1
  10. // :WORLD:OpenSim
  11. // :DESCRIPTION:
  12. // An instant Hypergrid jump to a different grid simply by walking
  13. // :CODE:
  14. // This is the script I use in my WarpGates. Its a Hypergrid script I got on Pathlandia and I use it everywhere.
  15. // For more info see http://becunningandfulloftricks.com/2010/10/29/the-metaphor-of-portals
  16. // anti-loop code added by Jag Nishi/The Ham
  17. string GridName = "Visit Pathlandia\n(4000,4000)\n";
  18. string SimAddress = "pathlandia.dlinkddns.com:9000:Pathlandia"; // use region name for inworld locations
  19. string LastVerified = "\nLast Verified: 04/05/2012";
  20. string Message = "";
  21. string BoilerPlate = "\nWalk through to teleport";
  22. vector LandingPoint = <123.0, 130.0, 13.0>;
  23. vector TextColor = <0,1,1>;
  24. vector LookAt = <1.0,1.0,0.0>;
  25. key AgentToTransfer;
  26. list LastFewAgents;
  27. string CONTROLLER_ID = "A";
  28. integer AUTO_START = TRUE;
  29. list particle_parameters = [];
  30. list target_parameters = [];
  31. StartEffects()
  32. {
  33. // llCollisionSound("Magic Chimes", 1.0);
  34. particle_parameters = [
  35. PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0),
  36. PSYS_PART_START_SCALE, <0.10,0.10, FALSE>,
  37. PSYS_PART_END_SCALE, <1.00,1.00, FALSE>,
  38. PSYS_PART_START_COLOR, <1,1,1>,
  39. PSYS_PART_END_COLOR, <1,1,1>,
  40. PSYS_PART_START_ALPHA, (float)1.0,
  41. PSYS_PART_END_ALPHA, (float)0.0,
  42. PSYS_SRC_BURST_PART_COUNT, 500,
  43. PSYS_SRC_BURST_RATE, (float)0.01,
  44. PSYS_PART_MAX_AGE, (float)1.0,
  45. PSYS_SRC_MAX_AGE, (float)0.6,
  46. PSYS_SRC_PATTERN, 2,
  47. PSYS_SRC_ACCEL, <0.0,0.0,-3.0>,
  48. PSYS_SRC_BURST_SPEED_MIN, (float)1.2,
  49. PSYS_SRC_BURST_SPEED_MAX, (float)5.01,
  50. PSYS_SRC_ANGLE_BEGIN, (float)0.25*PI,
  51. PSYS_SRC_ANGLE_END, (float)0.00*PI,
  52. PSYS_SRC_OMEGA, <0,0,0>,
  53. PSYS_PART_FLAGS, ( 0
  54. | PSYS_PART_INTERP_COLOR_MASK
  55. | PSYS_PART_INTERP_SCALE_MASK
  56. | PSYS_PART_EMISSIVE_MASK
  57. | PSYS_PART_FOLLOW_VELOCITY_MASK
  58. | PSYS_PART_WIND_MASK
  59. )
  60. ];
  61. if ( AUTO_START ) llParticleSystem( particle_parameters );
  62. }
  63. PerformTeleport( key WhomToTeleport )
  64. {
  65. integer CurrentTime = llGetUnixTime();
  66. integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] );
  67. if (AgentIndex != -1)
  68. {
  69. integer PreviousTime = llList2Integer ( LastFewAgents, AgentIndex+1 );
  70. if (PreviousTime >= (CurrentTime -5)) return;
  71. LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1);
  72. }
  73. LastFewAgents += [ WhomToTeleport, CurrentTime ];
  74. osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );
  75. }
  76. default
  77. {
  78. on_rez(integer start_param)
  79. {
  80. llResetScript();
  81. }
  82. state_entry()
  83. {
  84. //llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 0, 0, 0, 0, .05);
  85. llSetText(GridName + SimAddress + BoilerPlate + LastVerified + Message, TextColor, 1);
  86. }
  87. collision_start(integer num_detected)
  88. {
  89. StartEffects();
  90. if(llDetectedKey(0) != AgentToTransfer)
  91. {
  92. AgentToTransfer=llDetectedKey(0);
  93. PerformTeleport( llDetectedKey(0));
  94. }
  95. else
  96. {
  97. llSetTimerEvent(3);
  98. }
  99. }
  100. timer()
  101. {
  102. AgentToTransfer="";
  103. llSetTimerEvent(0);
  104. }
  105. touch_start(integer num_detected)
  106. {
  107. llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
  108. }
  109. link_message( integer sibling, integer num, string mesg, key target_key )
  110. {
  111. if ( mesg != CONTROLLER_ID ) { // this message isn't for me. Bail out.
  112. return;
  113. } else if ( num == 0 ) { // Message says to turn particles OFF:
  114. llParticleSystem( [ ] );
  115. } else if ( num == 1 ) { // Message says to turn particles ON:
  116. llParticleSystem( particle_parameters + target_parameters );
  117. } else if ( num == 2 ) { // Turn on, and remember and use the key sent us as a target:
  118. target_parameters = [ PSYS_SRC_TARGET_KEY, target_key ];
  119. llParticleSystem( particle_parameters + target_parameters );
  120. } else { // bad instruction number
  121. // do nothing.
  122. }
  123. }
  124. }
  125. //// "Explosion" PARTICLE TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
  126. //// You are free to use this script as you please, so long as you include this line:
  127. //** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//