Advertisement
jeppevinkel

Jepp's Hyperdrive Program

Oct 19th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. @name Jepp's Hyperdrive Program
  2. @inputs Jump Sound [X, Y, Z]:number TargetPos:vector [CaptainSeat, Teleporter, Beacon]:entity
  3. @outputs [X, Y, Z]:number [TargetPos, OriginPost]:vector TargetAngle:angle Jump Sound
  4. @persist [PlaceCord, PlaceName]:array OriginPos:vector
  5. @trigger
  6.  
  7. function help()
  8. {
  9. #CaptainSeat:printColorDriver(vec(255,0,0), "Jepp's Hyperdrive Program Commands")
  10. #CaptainSeat:printColorDriver(vec(255,255,255), "Type ", vec(255,0,0), "/help", vec(255,255,255), " to view commands")
  11. #CaptainSeat:printColorDriver(vec(255,255,255), "Type ", vec(255,0,0), "/jump <location name>", vec(255,255,255), " to jump to the location of choise")
  12. #CaptainSeat:printColorDriver(vec(255,255,255), "Type ", vec(255,0,0), "/return", vec(255,255,255), " to return to previous position")
  13. #CaptainSeat:printColorDriver(vec(255,255,255), "Type ", vec(255,0,0), "/locations", vec(255,255,255), " for a list of possible locations")
  14. #CaptainSeat:printColorDriver(vec(255,255,255), "Type ", vec(255,0,0), "/save <location name>", vec(255,255,255), " to save the beacons current locations")
  15. CaptainSeat:printDriver("Jepp's Hyperdrive Program Commands")
  16. CaptainSeat:printDriver("Type /help to view commands")
  17. CaptainSeat:printDriver("Type /jump <location name> to jump to the location of choise")
  18. CaptainSeat:printDriver("Type /return to return to previous position")
  19. CaptainSeat:printDriver("Type /locations for a list of possible locations")
  20. CaptainSeat:printDriver("Type /save <location name> to save the beacons current locations")
  21. }
  22.  
  23. function jump( Location:string )
  24. {
  25. Count = 1
  26. for(I = Count, PlaceName:count())
  27. {
  28. if(PlaceName[Count, string]:lower() == Location:lower())
  29. {
  30. botSay("JeppCom", "HyperDrive", vec(255,255,0), "Now jumping to: " + PlaceName[Count, string])
  31. X = PlaceCord[Count, vector]:x()
  32. Y = PlaceCord[Count, vector]:y()
  33. Z = PlaceCord[Count, vector]:z()
  34. TargetPos = PlaceCord[Count, vector]
  35. OriginPos = Teleporter:pos()
  36. TargetAngle = CaptainSeat:angles()
  37. Jump = 1
  38. timer("jumpDelay", 1000)
  39. }
  40. Count = Count + 1
  41. }
  42. }
  43.  
  44. function returnBack()
  45. {
  46. X = OriginPos:x()
  47. Y = OriginPos:y()
  48. Z = OriginPos:z()
  49. TargetPos = OriginPos
  50. OriginPos = Teleporter:pos()
  51. TargetAngle = CaptainSeat:angles()
  52. botSay("JeppCom", "HyperDrive", vec(255,255,0), "Now returning to previous location")
  53. Jump = 1
  54. timer("jumpDelay", 1000)
  55. }
  56.  
  57. function saveLocation( Name:string )
  58. {
  59. PlaceCord[PlaceCord:count()+1,vector] = Beacon:pos()
  60. PlaceName[PlaceName:count()+1,string] = Name
  61. #CaptainSeat:printColorDriver(vec(255,255,255), "Beacon location has been saved as ", vec(255,0,0), Name)
  62. CaptainSeat:printDriver("Beacon location has been saved as: " + Name + "With cords: " + Beacon:pos())
  63. }
  64.  
  65. function savedLocations()
  66. {
  67. Count = 1
  68. TeleportNumber = PlaceName:count()
  69. if(TeleportNumber)
  70. {
  71. for (I = Count, TeleportNumber)
  72. {
  73. #CaptainSeat:printColorDriver(vec(255,255,255), "Location #" + Count + ": ", vec(255,0,0), PlaceName[Count,string])
  74. CaptainSeat:printDriver("Location #" + Count + ": " + PlaceName[Count,string])
  75. Count = Count + 1
  76. }
  77. }
  78. else
  79. {
  80. CaptainSeat:printDriver("You don't have any locations")
  81. }
  82. }
  83.  
  84. if(first() | duped())
  85. {
  86. runOnTick(1)
  87. runOnChat(1)
  88.  
  89. # Cordinates
  90. PlaceCord = array(
  91. vec(-7219.0834960938,-5839.1557617188,-8259.701171875), #Cordinate 1
  92. vec(-6329.625, -5113.500, -2549.937), #Cordinate 2
  93. vec(-11520.750,-12298.781,10273.625), #Cordinate 3
  94. vec(4183.2036132812,3282.0788574219,-6362.9663085938), #Cordinate 4
  95. vec(-4637.3525390625,2781.3884277344,3495.0825195312), #Cordinate 5
  96. vec(4834.4384765625,6153.0639648438,10191.5078125), #Cordinate 6
  97. vec(-12218.34765625,13355.432617188,-11842.986328125) #Cordinate 7
  98. )
  99. # Names
  100. PlaceName = array(
  101. "Rhodon", #Name 1
  102. "RhodonSpace", #Name 2
  103. "Zarkol", #Name 3
  104. "Trensalore", #Name 4
  105. "Aura", #Name 5
  106. "Cydonia", #Name 6
  107. "BuildBay" #Name 7
  108. )
  109. Sound = 1
  110. }
  111.  
  112. if(changed(CaptainSeat:driver()))
  113. {
  114. help()
  115. }
  116.  
  117. if(chatClk(CaptainSeat:driver()) | chatClk(owner()))
  118. {
  119. Com = CaptainSeat:driver():lastSaid():explode(" ")
  120. if(Com[1, string] == "/jump" & Com[2, string])
  121. {
  122. jump(Com[2, string])
  123. }
  124. elseif(Com[1, string] == "/return")
  125. {
  126. returnBack()
  127. }
  128. elseif(Com[1, string] == "/help")
  129. {
  130. help()
  131. }
  132. elseif(Com[1, string] == "/locations")
  133. {
  134. savedLocations()
  135. }
  136. elseif(Com[1, string] == "/save" & Com[2, string])
  137. {
  138. saveLocation(Com[2, string])
  139. }
  140. }
  141.  
  142. if(clk("jumpDelay"))
  143. {
  144. Jump = 0
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement