Guest User

wanderer lua script

a guest
Mar 16th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. x,y = term.getSize
  2.  
  3.  
  4. tempx = math.random(0,x)
  5. tempy = math.random(0,y)
  6.  
  7. posx = tempx
  8. posy = tempy
  9.  
  10. function renderMan()
  11. term.setCursorPos(posx,posy)
  12. print ("0")
  13. print ("|")
  14. end
  15.  
  16. function randomMove()
  17. dirx = math.random(-1,1)
  18. diry = math.random(-1,1)
  19.  
  20. posx = dirx
  21. posy = diry
  22. end
  23.  
  24. function willIMove()
  25. decision = math.random(0,5)
  26. if decision ~= 0 then
  27. decision = decision - 1
  28. decision = decision / 4
  29. sleep (decision)
  30. randomMove()
  31. end
  32. end
  33.  
  34.  
  35. while true do
  36.  
  37. renderMan()
  38. willIMove()
  39.  
  40. end
Advertisement
Add Comment
Please, Sign In to add comment