summaryrefslogtreecommitdiff
path: root/pokemontools/vba/vba.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-11 00:55:54 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-11 00:55:54 -0600
commit966985411f01b799fa71f4823da7a8cd6d9cc47b (patch)
treebe94d8ec6e86db5e883db5ebe9edffc2bdc951ff /pokemontools/vba/vba.py
parent1d9ecfa00f91d602073b56a64f9aa129b95a8c2e (diff)
detect the "mandatory switch" menuvba-automation
This requires a slightly slower text_wait function. There is probably a way to refactor that function in a way that doesn't cause cancer.
Diffstat (limited to 'pokemontools/vba/vba.py')
-rw-r--r--pokemontools/vba/vba.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/pokemontools/vba/vba.py b/pokemontools/vba/vba.py
index 0dac63f..10513c6 100644
--- a/pokemontools/vba/vba.py
+++ b/pokemontools/vba/vba.py
@@ -431,12 +431,17 @@ class crystal(object):
# set CurSFX
self.vba.write_memory_at(0xc2bf, 0)
- self.vba.press("a", hold=10, after=1)
+ self.vba.press("a", hold=10, after=50)
# check if CurSFX is SFX_READ_TEXT_2
if self.vba.read_memory_at(0xc2bf) == 0x8:
- print "cursfx is set to SFX_READ_TEXT_2, looping.."
- return self.text_wait(step_size=step_size, max_wait=max_wait, debug=debug, callback=callback, sfx_limit=sfx_limit)
+ if "CANCEL Which" in self.get_text():
+ print "probably the 'switch pokemon' menu"
+ return
+ else:
+ print "cursfx is set to SFX_READ_TEXT_2, looping.."
+ print self.get_text()
+ return self.text_wait(step_size=step_size, max_wait=max_wait, debug=debug, callback=callback, sfx_limit=sfx_limit)
else:
if sfx_limit > 0:
sfx_limit = sfx_limit - 1