Advertisement
Specter_

Portals

Jul 29th, 2019
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. IF(@#ptllaunchmode=0);
  2. DO;
  3. IFMATCHES(%@&currentcmd%,"^/ptl$");
  4. @#filtermes=1;
  5. @#ptllaunchmode=1;
  6. EXEC(Portals.txt,"Processing...");
  7. ENDIF;
  8. IF(%@&pscoords[0]%!=);
  9. FOREACH(@&pscoords,&coord);
  10. #x=0;#y=0;#z=0;
  11. MATCH(%&coord%,"^(.+?) (.+?) (.+)$",{#x,#y,#z});
  12. #y1=%YPOS%+1;
  13. IF((%#x%=%XPOS%)&&((%#y%=%YPOS%)||(%#y%=%#y1%))&&(%#z%=%ZPOS%));
  14. @#ptllaunchmode=2;
  15. EXEC(Portals.txt,"Processing...");
  16. #match=1;
  17. BREAK;
  18. ENDIF;
  19. NEXT;
  20. IF(#match=1);
  21. #match=0;
  22. IF(#teleporting=1);
  23. #teleporting=0;
  24. #i=0;
  25. DO;INC(#i);IF((%#x%!=%XPOS%)||((%#y%!=%YPOS%)&&(%#y%!=%#y1%))||(%#z%!=%ZPOS%));BREAK;ENDIF;UNTIL(#i>50);
  26. ELSE;
  27. INDEXOF(@&pscoords,#i,"%#x% %#y% %#z%");
  28. LOG(&7[&3Portals&7] &3%@&ptlmatch% &a%@&ppoints[%#i%]%);
  29. DO;
  30. #y1=%YPOS%+1;
  31. IFMATCHES(%@&currentcmd%,"^/ptl$");
  32. @#filtermes=1;
  33. @#ptllaunchmode=1;
  34. EXEC(Portals.txt,"Processing...");
  35. ENDIF;
  36. IF((%#x%!=%XPOS%)||((%#y%!=%YPOS%)&&(%#y%!=%#y1%))||(%#z%!=%ZPOS%));
  37. #x=0;#y=0;#z=0;
  38. BREAK;
  39. ENDIF;
  40. IF(RMOUSE);
  41. INDEXOF(@&pscoords,#i,"%#x% %#y% %#z%");
  42. @&tbc=/%@&pcmds[%#i%]%;
  43. #teleporting=1;
  44. BREAK;
  45. ENDIF;
  46. LOOP;
  47. ENDIF;
  48. ENDIF;
  49. ENDIF;
  50. LOOP;
  51. ENDIF;
  52. IF(@#ptllaunchmode=1);
  53. @#ptllaunchmode=0;
  54. UNSET(@&currentcmd);
  55. MATCH(%@&chatcontent%,"^/ptl (.+?)\b",{&case});
  56. IFMATCHES(%&case%,"^h$|^help$",&ccase);
  57. LOG(&8=============[&3Portals&8]=============);
  58. LOG(&a/ptl h &3- %@&ptlh1%);
  59. LOG(&a/ptl l &3- %@&ptlh2%);
  60. LOG(&a/ptl ap &7<point name> <cmd> &3- %@&ptlh3%);
  61. LOG(&a/ptl dp &7<point name> &3- %@&ptlh4%);
  62. LOG(&a/ptl sel &7<point name> &3- %@&ptlh5%);
  63. LOG(%@&ptlh6%);
  64. ENDIF;
  65. IFMATCHES(%&case%,"^ap$|^addpoint$",&ccase);
  66. MATCH(%@&chatcontent%,"^/ptl %&case% (.+?) (.+)$",{&point,&cmd});
  67. IF(%&point%=);
  68. LOG(&7[&3Portals&7] &3%@&ptlneedspnamecmd%);
  69. ELSE;
  70. INDEXOF(@&ppoints[],#i,%&point%);
  71. IF(#i=-1);
  72. IFBEGINSWITH(%&cmd%,"/");
  73. &cmd=\%&cmd%;
  74. REPLACE(&cmd,"\/","");
  75. ENDIF;
  76. PUSH(@&ppoints[],"%&point%");
  77. PUSH(@&pcmds[],"%&cmd%");
  78. PUSH(@&pscoords[],"%XPOS% %YPOS% %ZPOS%");
  79. LOG(&7[&3Portals&7] &3%@&ptadded% &a%&point% &a< &b%&cmd%&a >);#ind=1;
  80. ENDIF;
  81. ELSE;
  82. IF((#ind!=1)&&(#i!=-1));
  83. LOG(&7[&3Portals&7] &3%@&ptlexists%);
  84. ELSE;
  85. #ind=0;
  86. ENDIF;
  87. ENDIF;
  88. ENDIF;
  89. IFMATCHES(%&case%,"^dp$|^delpoint$",&ccase);
  90. MATCH(%@&chatcontent%,"^/ptl %&case% (.+?)$",{&point});
  91. IF(%&point%=);
  92. LOG(&7[&3Portals&7] &3%@&ptlneedspname%);
  93. ELSE;
  94. INDEXOF(@&ppoints[],#i,"%&point%");
  95. IF(#i=-1);
  96. LOG(&7[&3Portals&7] &3%@&ptlunexists%);
  97. ELSE;
  98. LOG(&7[&3Portals&7] &3%@&ptlemd% "&a%@&ppoints[%#i%]%&3");
  99. UNSET(@&ppoints[%#i%]);
  100. UNSET(@&pcmds[%#i%]);
  101. UNSET(@&pscoords[%#i%]);
  102. INDEXOF(@&ppoints[],#i,"");
  103. IF(#i!=-1);
  104. ARRAYSIZE(@&ppoints,#n);#n=#n-1;
  105. FOR(#j,%#i%,%#n%);
  106. #k=#j+1;
  107. @&ppoints[%#j%]=%@&ppoints[%#k%]%;
  108. @&pcmds[%#j%]=%@&pcmds[%#k%]%;
  109. @&pscoords[%#j%]=%@&pscoords[%#k%]%;
  110. NEXT;
  111. IF(%@&ppoints[1]%!=);
  112. POP(@&ppoints[],&del);
  113. POP(@&pcmds[],&del);
  114. POP(@&psoords[],&del);
  115. ENDIF;
  116. ENDIF;
  117. ENDIF;
  118. ENDIF;
  119. IF(%@&ppoints[0]%=);
  120. UNSET(@&ppoints[]);
  121. UNSET(@&pcmds[]);
  122. UNSET(@&pscoords[]);
  123. ENDIF;
  124. ENDIF;
  125. IFMATCHES(%&case%,"^l$|^list$",&ccase);
  126. ARRAYSIZE(@&ppoints,#n);
  127. IF(#n!=0);
  128. #n=#n-1;
  129. LOG(&7[&3Portals&7] &3%@&ptlplist%);
  130. @#tcsmblockchat=1;
  131. FOR(#i,0,%#n%);
  132. LOG("&a%@&ppoints[%#i%]%&a <&b%@&pscoords[%#i%]%&a> => <&b%@&pcmds[%#i%]%&a>");
  133. NEXT;
  134. @#tcsmblockchat=0;
  135. ELSE;
  136. LOG(&7[&3Portals&7] &3%@&ptlnopoints%);
  137. ENDIF;
  138. ENDIF;
  139. IFMATCHES(%&case%,"^s$|^sel$|^select$",&ccase);
  140. MATCH(%@&chatcontent%,"^/ptl %&case% (.+?)$",{&point});
  141. IF(%&point%=);
  142. LOG(&7[&3Portals&7] &3%@&ptlneedspname%);
  143. ELSE;
  144. INDEXOF(@&ppoints[],#i,"%&point%");
  145. IF(#i=-1);
  146. LOG(&7[&3Portals&7] &3%@&ptlunexists%);
  147. ELSE;
  148. MATCH(%@&pscoords[%#i%]%,"^(.+?) (.+?) (.+)$",{#x,#y,#z});
  149. ECHO("//pos1 %#x%,%#y%,%#z%");
  150. ENDIF;
  151. ENDIF;
  152. ENDIF;
  153. IF(%&ccase%=);
  154. ECHO(%@&chatcontent%);
  155. ENDIF;
  156. ENDIF;
  157. IF(@#ptllaunchmode=2);
  158. @#ptllaunchmode=0;
  159. ARRAYSIZE(@&ppoints,#n);
  160. ARRAYSIZE(@&pcmds,#m);
  161. ARRAYSIZE(@&pscoords,#o);
  162. IF((#n=#m)&&(#m=#o));
  163. #max=#n;
  164. ELSE;
  165. #sort[0]=#n;
  166. #sort[1]=#m;
  167. #sort[2]=#o;
  168. FOR(#i,1,2);
  169. #j=#i-1;
  170. IF(#sort[%#i%]>#sort[%#j%]);#max=#sort[%#i%];ENDIF;
  171. NEXT;
  172. ENDIF;
  173. FOR(#i,0,%#max%);
  174. IF(((%@&ppoints[%#i%]%=)&&(%@&pcmds[%#i%]%!=)&&(%@&pscoords[%#i%]%!=))||((%@&ppoints[%#i%]%!=)&&(%@&pcmds[%#i%]%=)&&(%@&pscoords[%#i%]%!=))||((%@&ppoints[%#i%]%!=)&&(%@&pcmds[%#i%]%!=)&&(%@&pscoords[%#i%]%=))||((%@&ppoints[%#i%]%=)&&(%@&pcmds[%#i%]%=)&&(%@&pscoords[%#i%]%!=))||((%@&ppoints[%#i%]%=)&&(%@&pcmds[%#i%]%!=)&&(%@&pscoords[%#i%]%=))||((%@&ppoints[%#i%]%!=)&&(%@&pcmds[%#i%]%=)&&(%@&pscoords[%#i%]%=)));
  175. LOG(&7[&3Portals&7] &4CRITICAL ERROR!!!);
  176. LOG(&7[&3Portals&7] &4Deleting portal %#i%...);
  177. LOGTO(debug.txt,"--------------------------------------------------");
  178. LOGTO(debug.txt,"[%DATE%|%TIME%] ERROR REPORT BY PORTALS");
  179. LOGTO(debug.txt,"--------------------------------------------------");
  180. LOGTO(debug.txt,"Known stats:");
  181. IF(%@&ppoints[%#i%]%!=);
  182. LOGTO(debug.txt,"Point name: %@&ppoints[%#i%]%");
  183. ENDIF;
  184. IF(%@&pcmds[%#i%]%!=);
  185. LOGTO(debug.txt,"Point coords: %@&pcmds[%#i%]%");
  186. ENDIF;
  187. IF(%@&pscoords[%#i%]%!=);
  188. LOGTO(debug.txt,"Portal coords: %@&pscoords[%#i%]%");
  189. ENDIF;
  190. UNSET(@&ppoints[%#i%]);
  191. UNSET(@&pcmds[%#i%]);
  192. UNSET(@&pscoords[%#i%]);]
  193. LOG(&7[&3Portals&7] &4All what we know is written to &cdebug.txt);
  194. ENDIF;
  195. NEXT;
  196. ENDIF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement