summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-10 17:53:06 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-10 17:53:06 -0600
commitd1da18652d96212c05be10a9dfb22bc02071f84e (patch)
tree8e548d1327ffbd30f0d7705858c9855e23b9c601
parentbc30cd1e9a95342cbb77c1a05a2656f2505e817a (diff)
make givepoke work (h/t padz)
-rw-r--r--pokemontools/vba/vba.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/pokemontools/vba/vba.py b/pokemontools/vba/vba.py
index 62c16da..9d2be23 100644
--- a/pokemontools/vba/vba.py
+++ b/pokemontools/vba/vba.py
@@ -871,7 +871,7 @@ class crystal(object):
self.vba.memory = memory
- def givepoke(self, pokemon_id, level, nickname):
+ def givepoke(self, pokemon_id, level, nickname=None):
"""
Give the player a pokemon.
"""
@@ -899,9 +899,12 @@ class crystal(object):
0x91, # end
]
+ # picked this region of wram because it looks like it's probably unused
+ # in situations where givepoke will work.
#address = 0xd073
#address = 0xc000
- address = 0xd8f1
+ #address = 0xd8f1
+ address = 0xd280
mem = list(self.vba.memory)
backup_wram = mem[address : address + len(script)]
@@ -928,8 +931,11 @@ class crystal(object):
self.vba.press("a", hold=5, after=50)
else:
# no nickname
- self.vba.press("d", hold=10, after=20)
- self.vba.press("a", hold=5, after=30)
+ self.vba.press("b", hold=10, after=20)
+
+ # Wait for the script to end in the engine before copying the original
+ # wram values back in.
+ self.vba.step(count=100)
# reset whatever was in wram before this script was called
mem = list(self.vba.memory)