# HG changeset patch # User Robert McIntyre # Date 1333967816 18000 # Node ID a9e7507379e97fa07879bc267e92d9f4f4de89fe # Parent 82e3ba144773feb8116b19801562a2d3ffa706f1 adjusting run to use 0x00 items for money since they are worth a half million each. diff -r 82e3ba144773 -r a9e7507379e9 clojure/com/aurellem/run/bootstrap_1.clj --- a/clojure/com/aurellem/run/bootstrap_1.clj Sun Apr 08 21:21:39 2012 -0500 +++ b/clojure/com/aurellem/run/bootstrap_1.clj Mon Apr 09 05:36:56 2012 -0500 @@ -200,46 +200,60 @@ (set-cursor 1) select-menu-entry))) +(defn wait-for-quantity + [[moves state :as script]] + (if (not= (item-quantity-selected state) 1) + (repeat-until-different [] item-quantity-selected script) + script)) + +(defn wait-for-cursor + [[moves state :as script]] + (if (not= (list-offset state) 0) + (repeat-until-different [] list-offset script) + script)) + (defn deposit-held-item [n quantity [moves state :as script]] (let [total-quantity (second (nth-item state n))] (println "total-quantity" total-quantity) (->> script (set-cursor n) (select-menu-entry 1) - ((fn [[moves state :as script]] - (if (not= (item-quantity-selected state) 1) - (repeat-until-different [] item-quantity-selected script) - script))) + (wait-for-quantity) (set-quantity total-quantity quantity) (delayed-difference [] [:a] 100 #(search-string % "stored")) (scroll-text)))) +(defn sell-held-item [n quantity [moves state :as script]] + (let [total-quantity (second (nth-item state n))] + (->> script + (wait-for-cursor) ;; when selling, the cursor always + (set-cursor n) ;; returns to the top of the list. + (select-menu-entry 1) + (wait-for-quantity) + (set-quantity total-quantity quantity) + (delayed-difference [] [:a] 100 current-depth) + (play-moves (repeat 20 [:b])) + (delayed-difference [] [:a] 100 #(search-string % "What")) + ))) + (defn widthdraw-pc-item [n quantity [moves state :as script]] (let [total-quantity (second (nth-pc-item state n))] (->> script (set-cursor n) (select-menu-entry 1) - ((fn [[moves state :as script]] - (if (not= (item-quantity-selected state) 1) - (repeat-until-different [] item-quantity-selected - script) - script))) + (wait-for-quantity) (set-quantity total-quantity quantity) (delayed-difference [] [:a] 100 #(search-string % "Withdrew")) (scroll-text)))) (defn toss-held-item [n quantity [moves state :as script]] - (let [total-quantity (second (nth-item state n))] + (let [total-quantity (second (nth-item state n))] (->> script (set-cursor n) (select-menu-entry 1) (set-cursor-relative 1) (select-menu-entry -1) - ((fn [[moves state :as script]] - (if (not= (item-quantity-selected state) 1) - (repeat-until-different [] item-quantity-selected - script) - script))) + (wait-for-quantity) (set-quantity total-quantity quantity) (play-moves [[:a]]) (scroll-text) @@ -256,13 +270,12 @@ ([] (initial-deposits (begin-initial-deposits))) ([script] (->> script - (deposit-held-item 0 0xFE) - (deposit-held-item 1 0xFE) + (deposit-held-item 1 0x2) ((fn [script] (reduce (fn [script item] (deposit-held-item item 0xFF script)) script - (range 2 (+ 12 2))))) + (range 3 (+ 12 3))))) close-all-menus))) @@ -290,18 +303,21 @@ (scroll-text) (select-menu-entry) (widthdraw-pc-item 0 1) - (widthdraw-pc-item 3 99) - (widthdraw-pc-item 3 99) - (widthdraw-pc-item 3 57) - (widthdraw-pc-item 2 99) - (widthdraw-pc-item 2 99) - (widthdraw-pc-item 2 56) - (widthdraw-pc-item 1 99) - (widthdraw-pc-item 1 99) - (widthdraw-pc-item 1 56) (widthdraw-pc-item 0 99) - (widthdraw-pc-item 0 99) - (widthdraw-pc-item 0 57) + (widthdraw-pc-item 1 1) + (widthdraw-pc-item 2 5) + ;; (widthdraw-pc-item 3 99) + ;; (widthdraw-pc-item 3 99) + ;; (widthdraw-pc-item 3 57) ;; take all + ;; (widthdraw-pc-item 2 99) + ;; (widthdraw-pc-item 2 99) + ;; (widthdraw-pc-item 2 56) ;; take all + ;; (widthdraw-pc-item 1 99) + ;; (widthdraw-pc-item 1 99) + ;; (widthdraw-pc-item 1 55) ;; leave one + ;; (widthdraw-pc-item 0 99) + ;; (widthdraw-pc-item 0 99) + ;; (widthdraw-pc-item 0 57) ;; leave one (close-all-menus)))) (defn-memo to-celadon @@ -358,7 +374,7 @@ ;; Lemonade :) TM49 (tri-attack) -(defn go-to-floor-two +(defn-memo go-to-floor-two ([] (go-to-floor-two (to-celadon))) ([script] (->> script @@ -369,8 +385,34 @@ ← ←]) (first-difference [] ↑ AF)))) +(defn talk + "Assumes that you are facing a person and engages in conversation" + [[moves state :as script]] + (delayed-difference [] [:a] 100 + #(aget (memory %) text-address) + script)) + + (defn get-money-floor-two - []) + ([] (get-money-floor-two (go-to-floor-two))) + ([script] + (->> script + talk + (set-cursor 1) + (select-menu-entry) + (sell-held-item 2 1) + (sell-held-item 2 1) + + ;; (sell-held-item 11) + ;; (sell-held-item 10) + ;; (sell-held-item 9) + ;; (sell-held-item 8) + ;; (sell-held-item 7) + ;; (sell-held-item 6) + (do-nothing 40)))) + + + (defn floor-two-TMs []) diff -r 82e3ba144773 -r a9e7507379e9 moves/temp.vbm Binary file moves/temp.vbm has changed