Mercurial > vba-clojure
diff clojure/com/aurellem/run/bootstrap_0.clj @ 369:abcc522a3242
script: wrote memory pattern from within game!
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 10 Apr 2012 06:33:44 -0500 |
parents | 08f8284e2f1b |
children | daa3497bbe12 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Tue Apr 10 03:32:47 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Tue Apr 10 06:33:44 2012 -0500 1.3 @@ -411,6 +411,9 @@ 1.4 (defn first-character [state] 1.5 (aget (memory state) text-address)) 1.6 1.7 +(defn first-20-characters [state] 1.8 + (subvec (vec (memory state)) text-address (+ 20 text-address))) 1.9 + 1.10 (defn set-quantity* 1.11 "Set the quantity of an item to buy or sell to the desired value 1.12 using the fewest possible button presses." 1.13 @@ -442,9 +445,9 @@ 1.14 1.15 (defn set-quantity 1.16 ([total-quantity desired-quantity [moves state :as script]] 1.17 - (->> script (wait-until (partial first-difference [] [:a] 1.18 - first-character)) 1.19 - (set-quantity* total-quantity desired-quantity script))) 1.20 + (->> script (wait-until (partial delayed-difference [] [:a] 100 1.21 + first-20-characters)) 1.22 + (set-quantity* total-quantity desired-quantity))) 1.23 ([desired-quantity [moves state :as script]] 1.24 (set-quantity 99 desired-quantity script))) 1.25