Advertisement
lolsalat

Robot Carol (Minescript)

Mar 5th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main(func){
  2.  
  3.  
  4. var entx = func.getX(); //X-Coordinate
  5. var enty = func.getY(); //Y-Coordinate
  6. var entz = func.getZ(); //Z-Coordinate
  7.  
  8. var looking = 0;
  9.  
  10. sendCommand("/gamerule commandBlockOutput false");
  11. sendCommand('/summon ArmorStand ~ ~1 ~ {CustomName:"RobotCarol",CustomNameVisible:1,Equipment:[{},{id:iron_boots,Count:1},{id:iron_leggings,Count:1},{id:iron_chestplate,Count:1},{id:dirt,Count:1}]}');
  12.  
  13.  
  14.  
  15. // basic Commands:
  16. // step();              lets your robot walk one block
  17. // set();               lets your robot place a block
  18. // turnRight();         lets your robot turn Right
  19. // turnLeft();          lets your robot turn Left
  20. // sendCommand("s");    executes a command inside Minecraft (s = to execute [e.g. /say tree])
  21. // sleep(1000);         sleeps 1000 milliseconds (=1sec.) you can also use different Numbers [like sleep(2345);]
  22. // turnRight() and turnLeft() don't work yet!
  23.  
  24.  
  25. //  of course you can also use if conditions, while loops and so on. Don't worry if you don't know what that is :)
  26. //  if you want to learn how to use those, just google "javascript tutorial for beginners" or something like that
  27.  
  28. //write your RobotSteve Minescript code below
  29.  
  30.  
  31. //Code Example: (remove it if you want to create your own :) )
  32. turnRight();
  33. step();
  34. sleep(1000);
  35. step();
  36. sleep(1000);
  37. step();
  38. sleep(1000);
  39. step();
  40. sleep(1000);
  41. step();
  42. sleep(1000);
  43. step();
  44. sleep(1000);
  45. step();
  46. sleep(1000);
  47. set();
  48. turnRight();
  49. //end of Code Example
  50.  
  51.  
  52.  
  53. //ignore everything below here
  54.  
  55.  
  56. function sleep(milliseconds) {
  57.   var start = new Date().getTime();
  58.   for (var i = 0; i < 1e7; i++) {
  59.     if ((new Date().getTime() - start) > milliseconds){
  60.       break;
  61.     }
  62.   }
  63. }
  64.  
  65. function step(){
  66. if(isWall()==false&&looking==0){sendCommand("/tp @e[name=RobotCarol] ~1 ~ ~");}
  67. if(isWall()==false&&looking==1){sendCommand("/tp @e[name=RobotCarol] ~ ~ ~1");}
  68. if(isWall()==false&&looking==2){sendCommand("/tp @e[name=RobotCarol] ~-1 ~ ~");}
  69. if(isWall()==false&&looking==3){sendCommand("/tp @e[name=RobotCarol] ~ ~ ~-1");}
  70. }
  71.  
  72. function set(){
  73. if(looking==0){sendCommand("/execute @e[name=RobotCarol] ~1 ~ ~ /setblock ~ ~ ~ minecraft:stone 0 replace");}
  74. if(looking==1){sendCommand("/execute @e[name=RobotCarol] ~ ~ ~1 /setblock ~ ~ ~ minecraft:stone 0 replace");}
  75. if(looking==2){sendCommand("/execute @e[name=RobotCarol] ~-1 ~ ~ /setblock ~ ~ ~ minecraft:stone 0 replace");}
  76. if(looking==3){sendCommand("/execute @e[name=RobotCarol] ~ ~ ~-1 /setblock ~ ~ ~ minecraft:stone 0 replace");}
  77. }
  78.  
  79. function isWall(){
  80. return false;
  81. //TODO
  82. }
  83.  
  84. function turnRight(){
  85. looking = looking + 1;
  86. sendCommand("/tp @e[name=RobotCarol] ~ ~ ~ ~90 ~");
  87. if(looking>3){
  88. looking = 0;
  89. }
  90. }
  91.  
  92. function turnLeft(){
  93. looking = looking - 1;
  94. sendCommand("/tp @e[name=RobotCarol] ~ ~ ~ ~-90 ~");
  95. if(looking<0){
  96.    looking = 3;
  97. }
  98. }
  99.  
  100. function popUp(Text, Title){
  101. window.showMessageDialog(null, Text, Title, window.ERROR_MESSAGE);
  102. }
  103.  
  104. function sendCommand(Command) {
  105. func.sendCommand(func.var1, Command);
  106. }
  107.  
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement