Advertisement
Guest User

OnChat

a guest
May 22nd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. ifmatches(%CHATCLEAN%, "^ \* (.+?) (.+?) snitch at ?(.*?) \[([-\w]+?) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)\]");
  2. if(@paranoia);
  3. match(%CHATCLEAN%, "^ \* (.+?) (.+?) snitch at ?(.*?) \[([-\w]+?) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)\]",{&nick,&action,&sn_name,&sn_world_name,#coord_x,#coord_y,#coord_z});
  4. calcyawto(%#coord_x%,%#coord_z%,#yaw,#dst_inacc);
  5. if(%#dst_inacc% <= 500);
  6. unset(@paranoia);
  7. //echo("/exit");
  8. //echo("/g Hjaltland BEEP BOOP! %&nick% hit a snitch near me at [%#coord_x% %#coord_y% %#coord_z%].");
  9. wait(50ms);
  10. disconnect;
  11. endif;
  12. endif;
  13. endif;
  14.  
  15. ifmatches(%CHATCLEAN%,"^You sense a diamond nearby");
  16. playsound(entity.player.levelup);
  17. unset(@automine);
  18. //slot(9);
  19. endif;
  20.  
  21. Civcraft Snitch Distance - By Squeenix
  22.  
  23. //regular expression to grab any three signed numbers separated by spaces
  24.  
  25. match(%CHATCLEAN%,"(-?\d+)(?:[^-\d]+-?\d+)(?:[^-\d]+-?\d+[^-\d]*\Z)",&text,1,"NUL");
  26.  
  27. if(%&text% = "NUL");
  28.  
  29. stop;
  30.  
  31. else;
  32.  
  33. match(%CHATCLEAN%,"(-?\d+)(?:[^-\d]+-?\d+)(?:[^-\d]+-?\d+[^-\d]*\Z)",#x,1,"NUL");
  34.  
  35. match(%CHATCLEAN%,"(-?\d+)(?:[^-\d]+-?\d+[^-\d]*\Z)",#y,1,"NUL");
  36.  
  37. match(%CHATCLEAN%,"(-?\d+)(?:[^-\d]*\Z)",#z,1,"NUL");
  38.  
  39. //log(%#x% %#y% %#z%);
  40.  
  41. //built-in function for relative distance and direction using ints
  42.  
  43. calcyawto(%#x%,%#z%,#yaw,#dist);
  44.  
  45. //tedious translation of numeric yaw value into strings like "north"
  46.  
  47. if((%#yaw% > 337) || (%#yaw% <= 22));
  48. set(&dir,south);
  49. elseif((%#yaw% > 22) && (%#yaw% <= 67));
  50. set(&dir,southwest);
  51. elseif((%#yaw% > 67) && (%#yaw% <= 112));
  52. set(&dir,west);
  53. elseif((%#yaw% > 112) && (%#yaw% <= 157));
  54. set(&dir,northwest);
  55. elseif((%#yaw% > 157) && (%#yaw% <= 202));
  56. set(&dir,north);
  57. elseif((%#yaw% > 202) && (%#yaw% <= 247));
  58. set(&dir,northeast);
  59. elseif((%#yaw% > 247) && (%#yaw% <= 292));
  60. set(&dir,east);
  61. elseif((%#yaw% > 292) && (%#yaw% <= 337));
  62. set(&dir,southeast);
  63. endif;
  64.  
  65. //is it above or below you to within 40 blocks?
  66.  
  67. if(%#y% > %YPOS%+40);
  68. set(&height, and above you);
  69. elseif(%#y% < %YPOS%-40);
  70. set(&height, and below you);
  71. else;
  72. set(&height,"");
  73. endif;
  74.  
  75. //colorization and chatbox output
  76.  
  77. if(%#dist%<1000);
  78. log(&c %#dist% blocks%&height% to the %&dir%);
  79. elseif(%#dist%<2000);
  80. log(&a %#dist% blocks%&height% to the %&dir%);
  81. else;
  82. log(%#dist% blocks to the %&dir%);
  83. endif;
  84.  
  85.  
  86. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement