Advertisement
Guest User

Lua script

a guest
Jan 22nd, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. Filename = "yolo.state"
  2. TimeoutConstant = 80
  3. rightmost = 0
  4. timeout = TimeoutConstant
  5.  
  6. function initializeRun()
  7. savestate.load(Filename)
  8. rightmost = 0
  9. timeout = TimeoutConstant
  10. end
  11.  
  12. function getPositions()
  13. marioX = memory.read_s16_le(0x94)
  14. marioY = memory.read_s16_le(0x96)
  15.  
  16. local layer1x = memory.read_s16_le(0x1A);
  17. local layer1y = memory.read_s16_le(0x1C);
  18.  
  19. screenX = marioX-layer1x
  20. screenY = marioY-layer1y
  21. end
  22.  
  23. initializeRun()
  24.  
  25. while true do
  26. getPositions()
  27.  
  28. if marioX > rightmost then
  29. rightmost = marioX
  30. timeout = TimeoutConstant
  31. end
  32.  
  33. if timeout <= 0 then
  34. initializeRun()
  35. end
  36.  
  37. timeout = timeout - 1
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement