Mercurial > vba-clojure
comparison 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 |
comparison
equal
deleted
inserted
replaced
368:08f8284e2f1b | 369:abcc522a3242 |
---|---|
408 (wait-until (partial set-cursor-relative 1)) | 408 (wait-until (partial set-cursor-relative 1)) |
409 (set-cursor* n))) | 409 (set-cursor* n))) |
410 | 410 |
411 (defn first-character [state] | 411 (defn first-character [state] |
412 (aget (memory state) text-address)) | 412 (aget (memory state) text-address)) |
413 | |
414 (defn first-20-characters [state] | |
415 (subvec (vec (memory state)) text-address (+ 20 text-address))) | |
413 | 416 |
414 (defn set-quantity* | 417 (defn set-quantity* |
415 "Set the quantity of an item to buy or sell to the desired value | 418 "Set the quantity of an item to buy or sell to the desired value |
416 using the fewest possible button presses." | 419 using the fewest possible button presses." |
417 [total-quantity desired-quantity [moves state :as script]] | 420 [total-quantity desired-quantity [moves state :as script]] |
440 script | 443 script |
441 (range (Math/abs best-path)))))) | 444 (range (Math/abs best-path)))))) |
442 | 445 |
443 (defn set-quantity | 446 (defn set-quantity |
444 ([total-quantity desired-quantity [moves state :as script]] | 447 ([total-quantity desired-quantity [moves state :as script]] |
445 (->> script (wait-until (partial first-difference [] [:a] | 448 (->> script (wait-until (partial delayed-difference [] [:a] 100 |
446 first-character)) | 449 first-20-characters)) |
447 (set-quantity* total-quantity desired-quantity script))) | 450 (set-quantity* total-quantity desired-quantity))) |
448 ([desired-quantity [moves state :as script]] | 451 ([desired-quantity [moves state :as script]] |
449 (set-quantity 99 desired-quantity script))) | 452 (set-quantity 99 desired-quantity script))) |
450 | 453 |
451 | 454 |
452 (defn activate-start-menu [script] | 455 (defn activate-start-menu [script] |