Advertisement
lolsalat

Robot Steve

Mar 4th, 2016
389
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.  
  23. //  of course you can also use if conditions, while loops and so on. Don't worry if you don't know what that is :)
  24. //  if you want to learn how to use those, just google "javascript tutorial for beginners" or something like that
  25.  
  26. //write your RobotSteve Minescript code below
  27.  
  28.  
  29. //Code Example: (remove it if you want to create your own :) )
  30. turnRight();
  31. step();
  32. sleep(1000);
  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. set();
  46. turnRight();
  47. //end of Code Example
  48.  
  49.  
  50.  
  51. //ignore everything below here
  52.  
  53.  
  54. function sleep(milliseconds) {
  55.   var start = new Date().getTime();
  56.   for (var i = 0; i < 1e7; i++) {
  57.     if ((new Date().getTime() - start) > milliseconds){
  58.       break;
  59.     }
  60.   }
  61. }
  62.  
  63. function step(){
  64. if(isWall()==false&&looking==0){sendCommand("/tp @e[name=RobotCarol] ~1 ~ ~");}
  65. if(isWall()==false&&looking==1){sendCommand("/tp @e[name=RobotCarol] ~ ~ ~1");}
  66. if(isWall()==false&&looking==2){sendCommand("/tp @e[name=RobotCarol] ~-1 ~ ~");}
  67. if(isWall()==false&&looking==3){sendCommand("/tp @e[name=RobotCarol] ~ ~ ~-1");}
  68. }
  69.  
  70. function set(){
  71. if(looking==0){sendCommand("/execute @e[name=RobotCarol] ~1 ~ ~ /setblock ~ ~ ~ minecraft:stone 0 replace");}
  72. if(looking==1){sendCommand("/execute @e[name=RobotCarol] ~ ~ ~1 /setblock ~ ~ ~ minecraft:stone 0 replace");}
  73. if(looking==2){sendCommand("/execute @e[name=RobotCarol] ~-1 ~ ~ /setblock ~ ~ ~ minecraft:stone 0 replace");}
  74. if(looking==3){sendCommand("/execute @e[name=RobotCarol] ~ ~ ~-1 /setblock ~ ~ ~ minecraft:stone 0 replace");}
  75. }
  76.  
  77. function isWall(){
  78. return false;
  79. //TODO
  80. }
  81.  
  82. function turnRight(){
  83. looking = looking + 1;
  84. sendCommand("/tp @e[name=RobotCarol] ~ ~ ~ ~90 ~");
  85. if(looking>3){
  86. looking = 0;
  87. }
  88. }
  89.  
  90. function turnLeft(){
  91. looking = looking - 1;
  92. sendCommand("/tp @e[name=RobotCarol] ~ ~ ~ ~-90 ~");
  93. if(looking<0){
  94.    looking = 3;
  95. }
  96. }
  97.  
  98. function popUp(Text, Title){
  99. window.showMessageDialog(null, Text, Title, window.ERROR_MESSAGE);
  100. }
  101.  
  102. function sendCommand(Command) {
  103. func.sendCommand(func.var1, Command);
  104. }
  105.  
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement