Mercurial > vba-clojure
diff clojure/com/aurellem/run/bootstrap_1.clj @ 363:79252378fd22
saving progress...]
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 09 Apr 2012 10:35:22 -0500 |
parents | 8d8023057b3c |
children | 958a333f16e2 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj Mon Apr 09 09:25:33 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj Mon Apr 09 10:35:22 2012 -0500 1.3 @@ -550,7 +550,7 @@ 1.4 (scroll-text 6) 1.5 close-menu))) 1.6 1.7 -(defn to-celadon-poke-center 1.8 +(defn-memo to-celadon-poke-center 1.9 ([] (to-celadon-poke-center (get-TM13))) 1.10 ([script] 1.11 (->> script 1.12 @@ -568,3 +568,80 @@ 1.13 (walk [↑ ↑ ↑ ↑]) ; enter poke center 1.14 (walk [↑ ↑ ↑ → → → → → → → → → →]) ; to computer 1.15 (turn ↑)))) 1.16 + 1.17 +(defn activate-rlm-pc [script] 1.18 + (->> script 1.19 + talk 1.20 + scroll-text 1.21 + wait-for-cursor 1.22 + (set-cursor 1) 1.23 + select-menu-entry 1.24 + (scroll-text 2))) 1.25 + 1.26 +(defn begin-deposit [script] 1.27 + (->> script 1.28 + (set-cursor 1) 1.29 + select-menu-entry)) 1.30 + 1.31 +(defn begin-withdraw [script] 1.32 + (->> script 1.33 + (set-cursor 0) 1.34 + (select-menu-entry))) 1.35 + 1.36 +(defn deposit-held-item-named 1.37 + [item-name quantity [moves state :as script]] 1.38 + (let [index (count 1.39 + (take-while 1.40 + (fn [[name quant]] 1.41 + (or (not= name item-name) 1.42 + (< quant quantity))) 1.43 + (inventory state)))] 1.44 + (println "index" index) 1.45 + (deposit-held-item index quantity script))) 1.46 + 1.47 + 1.48 +(defn-memo begin-hacking 1.49 + ([] (begin-hacking(to-celadon-poke-center))) 1.50 + ([script] 1.51 + (->> script 1.52 + activate-rlm-pc 1.53 + begin-deposit 1.54 + (deposit-held-item-named 0x00 30) 1.55 + (deposit-held-item-named :TM01 63) 1.56 + (deposit-held-item-named :awakening 4) 1.57 + (deposit-held-item-named :thunderstone 98) 1.58 + (deposit-held-item-named :TM09 55) 1.59 + (deposit-held-item-named 0x00 55)))) 1.60 + 1.61 +(defn open-held-items 1.62 + [script] 1.63 + (->> script 1.64 + select-menu-entry)) 1.65 + 1.66 +(defn-memo hacking-2 1.67 + ([] (hacking-2 (begin-hacking))) 1.68 + ([script] 1.69 + (->> script 1.70 + close-menu 1.71 + close-menu 1.72 + end-text;;; grr 1.73 + 1.74 + activate-start-menu 1.75 + open-held-items 1.76 + (toss-held-item 0 166) ;; discard cruft 1.77 + close-menu 1.78 + close-menu))) 1.79 + 1.80 +(defn-memo hacking-3 1.81 + ([] (hacking-3 (hacking-2))) 1.82 + ([script] 1.83 + (->> script 1.84 + activate-rlm-pc 1.85 + begin-withdraw 1.86 + (widthdraw-pc-item 0 99) 1.87 + (widthdraw-pc-item 0 1) 1.88 + (widthdraw-pc-item 2 0xFE) 1.89 + (widthdraw-pc-item 3 0xFE)))) 1.90 + 1.91 + 1.92 + 1.93 \ No newline at end of file