Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. --v0.1 rby ita gift shiny
  2. if memory.readbyte(0x013c) == 0x59 then
  3. yellow = 1
  4. else
  5. yellow = 0
  6. end
  7.  
  8.  
  9. local partyno = (memory.readbyte(0xd168-yellow))-1
  10. local addr = (0xd18b-yellow)+partyno*0x2C
  11. local atkdef
  12. local spespc
  13.  
  14.  
  15. function shiny(atkdef,spespc)
  16. if spespc == 0xAA then
  17. if atkdef == 0xA2 or atkdef == 0xA3 or atkdef == 0xA6 or atkdef == 0xA7 or atkdef == 0xAA or atkdef == 0xAB or atkdef == 0xAE or atkdef == 0xAF then
  18. return true
  19. else
  20. return false
  21. end
  22. else
  23. return false
  24. end
  25. end
  26.  
  27.  
  28. state = savestate.create()
  29. savestate.save(state)
  30.  
  31. while true do
  32.  
  33. emu.frameadvance()
  34.  
  35. atkdef = 0
  36. spespc = 0
  37. savestate.save(state)
  38. while atkdef == 0 and spespc == 0 do
  39. joypad.set(1, {A=true})
  40. vba.frameadvance()
  41. atkdef = memory.readbyte(addr)
  42. spespc = memory.readbyte(addr+1)
  43. end
  44. print(atkdef)
  45. print(spespc)
  46. if shiny(atkdef,spespc) then
  47. print("Shiny!!! Script stopped.")
  48. print(string.format("atk: %d", math.floor(atkdef/16)))
  49. print(string.format("def: %d", atkdef%16))
  50. print(string.format("spe: %d", math.floor(spespc/16)))
  51. print(string.format("spe: %d", spespc%16))
  52. savestate.save(state)
  53. break
  54. else
  55. savestate.load(state)
  56. end
  57.  
  58.  
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement