Tentative Starfield load loot script

Post gaming related scripts
Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Tentative Starfield load loot script

Post by Noo0B » 10 Oct 2023, 03:14

First of all this is a tentative script, it's my first 2.0 script, timings are not optimized and it has no game crash reload code, I haven't found a way to move the screen or mouse and there's bugs and no statistics or tooltips.
What it does is that it spam kill an enemy and saves if the loot is good so be careful or you might end without disk space. Like I said it's tentative and not tested.
This is done on 1080p no scaling, English int keyboard, English language game.
Requirements are that you make a full save whith you looking down and your enemy is right in front of you and about to die. I used the mining laser on this one but it can be any weapon to finish off the enemy, just adapt the script accordingly. You can do a quicksave but remember to run the loop hotkey (f7) inside the game proper because the code to get off the initial menus do not work and it will rewrite your quicksave - at least it did here, but a lot of strage things happen here anyway. Name your save the local time like 235959.png on it and capture it when it is not selected with printscreen, cropping a wee bit less of the digits on it using paint for example. Make a second capture for the same save when the save is selected naming it like before but with a w on the end like 235959w.png. Edit the script on line 14 with the digits from your save localtime.
Edit the movement code according to your save so you will always have your victim centered on your screen.
Download these captures if you do not want to use your own, they might actually be good.
https://1drv.ms/u/s!AgzOWuNb0PCFgZES7Me91intDjPusw?e=1AoA1S

Code: Select all

#Warn
#SingleInstance Force
ProcessSetPriority "H"
SendMode "event"
SetWorkingDir A_ScriptDir
SetTitleMatchMode 2
#MaxThreadsperHotkey 2
SetKeyDelay 0, 50
SetMouseDelay 50
WinActivate "Starfield"
HotIfWinActive "Starfield"
InstallMouseHook
toggle := false
time:= "110157"
timeimg:= "*55 " time ".png"
timewimg:= "*55 " time "w.png"
x_time:= "x_%time%"
y_time:= "y_%time%"
x_timew:= "x_%time%w"
y_timew:= "y_%time%w"
timew:= "%time%w"
;-------------------------------------------------------------------------
f11:: {
    exitapp
}
;-------------------------------------------------------------------------
f6:: {
    reload
}
;-------------------------------------------------------------------------
;----------------------------------------------------------------------------
F7:: {
    global
    sleep(100)
    if imagesearch(&x_sfquit, &y_sfquit, 50, 640, 129, 719, "*55 sfquit.png") {
        send('esc')
        sleep(200)
    }
    sleep(250)
    if imagesearch(&x_sfback, &y_sfback, 1760, 1000, 1799, 1029, "*55 sfback.png") {
        send('esc')
        sleep(200)
    }
    loop {
        item:= 0
        sleep(100)
;----------------------------------------------------------------------------
load ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(7000) ; load delay
;---------custom movement
lbutton
        send "{lbutton down}"
        sleep(50)
w
a
        send "{w down}{a down}"
        sleep(200)
        send "{a up}"
        sleep(50)
        send "{w up}"
        sleep(50)
lbutton
        send "{lbutton up}"
        sleep(200)
;------------item scan
;----------------------------------------------------------------------------
loot ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(200)
        if (item = 1) {
;----------------------------------------------------------------------------
save ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(2500) ;save delay
        }
;----------------------------------------------------------------------------
    }
}
;---------functions
;----------------------------------------------------------------------------
;f12::{
;    loot
;}
;----------------------------------------------------------------------------
loot() {
    global
    if imagesearch(&x_loot, &y_loot, 0, 0, 1920,1080, "*55 lootbox.png") {
        loop 99 {
            sleep 50
            if (pixelsearch(&x_legendary, &y_legendary, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0xEDC162, 30) or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*75 calibratedw.png") or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*75 calibratedb.png") or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*75 modifiedp.png") or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*75 advancedw.png")) {
                item:= 1
e
                loop 9 {
                    send "{e down}"
                    sleep(50)
                    send "{e up}"
                    sleep(50)
                }
                break
            }
        }
    }
}
;----------------------------------------------------------------------------
load() {
    global
esc
    send "{esc down}"
    sleep(50)
    send "{esc up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
    loop {
down
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(100)
        if (A_Index <7)
            i:= A_Index*70
            i2:= i
        if imagesearch(&x_time, &y_time, 1010, 320+i, 1105,443+i, timeimg) {
            loop {
up
                send "{up down}"
                sleep(50)
                send "{up up}"
                sleep(100)
                if imagesearch(&x_timew, &y_timew, 1010, 320+i, 1105,443+i, timewimg) {
enter
                    loop 2 {
                        sleep(50)
                        send "{enter down}"
                        sleep(50)
                        send "{enter up}"
                    }
                    break 2
                }
            }
        }
        if (A_Index >999)
            break
    }
}
;-------------------------------------------------------------------------
save() {
    global
esc
    send "{esc down}"
    sleep(50)
    send "{esc up}"
    sleep(500)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(100)
    }
down
    send "{down down}"
    sleep(50)
    send "{down up}"
    sleep(100)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 6 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
    sleep(50)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(50)
}
;----------------------------------------------------------------------------
quickload() {
    global
    f9down := GetKeyState("f9")
    sleep(50)
    if (f9down = 1) {
        sleep(50)
        send "{f9 up}"
        sleep(50)
    }
    send "{f9}"
}
;----------------------------------------------------------------------------
enter() {
    global
    enterdown := GetKeyState("enter")
    sleep(50)
    if (enterdown = 1) {
        sleep(50)
        send "{enter up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
lbutton() {
    global
    lbuttondown := GetKeyState("lbutton")
    sleep(50)
    if (lbuttondown = 1) {
        sleep(50)
        send "{lbutton up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
e() {
    global
    edown := GetKeyState("e")
    sleep(50)
    if (edown = 1) {
        sleep(50)
        send "{e up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
esc() {
    global
    escdown := GetKeyState("esc")
    sleep(50)
    if (escdown = 1) {
        sleep(50)
        send "{esc up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
w() {
    global
    wdown := GetKeyState("w")
    sleep(50)
    if (wdown = 1) {
        sleep(50)
        send "{w up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
a() {
    global
    adown := GetKeyState("a")
    sleep(50)
    if (adown = 1) {
        sleep(50)
        send "{a up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
s() {
    global
    sdown := GetKeyState("s")
    sleep(50)
    if (sdown = 1) {
        sleep(50)
        send "{s up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
d() {
    global
    ddown := GetKeyState("d")
    sleep(50)
    if (ddown = 1) {
        sleep(50)
        send "{d up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
up() {
    global
    updown := GetKeyState("up")
    sleep(50)
    if (updown = 1) {
        sleep(50)
        send "{up up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
down() {
    global
    downdown := GetKeyState("down")
    sleep(50)
    if (downdown = 1) {
        sleep(50)
        send "{down up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
enjoy.

Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Tentative Starfield load loot script

Post by Noo0B » 10 Oct 2023, 16:30

Now it has a save checker and some more.
f3 loads and shows the new items' inventory
f2 redirects the load and erase hotkeys to the next save below on the list
f1 erases with confirmation
f8 autoerases and loads
If your script got stuck check the autosaves manually and delete.
if you pressed the wrong key just hit esc.
https://1drv.ms/u/s!AgzOWuNb0PCFgZF7kRDatav6_kBw6w?e=Onc4sI

Code: Select all

#Warn
#SingleInstance Force
ProcessSetPriority "H"
SendMode "event"
SetWorkingDir A_ScriptDir
SetTitleMatchMode 2
#MaxThreadsperHotkey 2
SetKeyDelay 0, 50
SetMouseDelay 50
WinActivate "Starfield"
HotIfWinActive "Starfield"
InstallMouseHook
toggle := false
time:= "110157"
timeimg:= "*55 " time ".png"
timewimg:= "*55 " time "w.png"
x_time:= "x_%time%"
y_time:= "y_%time%"
x_timew:= "x_%time%w"
y_timew:= "y_%time%w"
timew:= "%time%w"
checkindex:= 0
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
f11::{
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
    loot
}
;----------------------------------------------------------------------------
f1:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
eraser
}
;----------------------------------------------------------------------------
f2:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
    checkindex+= 1
}
;----------------------------------------------------------------------------
f3:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
loadcheck
}
;----------------------------------------------------------------------------
f8:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
eraserloadcheck
}
;----------------------------------------------------------------------------
f12:: {
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
    exitapp
}
;-------------------------------------------------------------------------
f6:: {
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
    reload
}
;-------------------------------------------------------------------------
;----------------------------------------------------------------------------
F7:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
    sleep(100)
;    if imagesearch(&x_sfquit, &y_sfquit, 50, 640, 129, 719, "*55 sfquit.png") {
;        send('esc')
;        sleep(2000)
;        if imagesearch(&x_sfback, &y_sfback, 1760, 1000, 1799, 1029, "*55 sfback.png") {
;            send('esc')
;            sleep(200)
;        }
;    }
;    else if imagesearch(&x_sfback, &y_sfback, 1760, 1000, 1799, 1029, "*55 sfback.png") {
;        send('esc')
;        sleep(200)
;    }
;    loop {
;        sleep(100)
;        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
;            break
;    }
esc
    loop {
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
        sleep(50)
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(100)
    }
    loop {
        item:= 0
        sleep(100)
;----------------------------------------------------------------------------
load ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(4000) ; load delay
        loop {
            send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
            sleep(100)
            if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
                break
        }
;---------custom movement
lbutton
        send "{lbutton down}"
        sleep(50)
w
a
        send "{w down}{a down}"
        sleep(250)
        send "{w up}"
        sleep(50)
        send "{a up}"
        sleep(50)
lbutton
        send "{lbutton up}"
        sleep(200)
;------------item scan
;----------------------------------------------------------------------------
loot ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(200)
        if (item = 1) {
;----------------------------------------------------------------------------
save ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(2500) ;save delay
        }
;----------------------------------------------------------------------------
    }
}
;---------functions
;----------------------------------------------------------------------------
loot() {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
    if imagesearch(&x_loot, &y_loot, 0, 0, 1920,1080, "*55 lootbox.png") {
        loop 9 {
            sleep 50
            if (pixelsearch(&x_legendary, &y_legendary, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0xEDC162, 30) or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedw.png") or imagesearch(&x_calibratedb, &y_calibratedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedb.png") or imagesearch(&x_modifiedp, &y_modifiedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 modifiedp.png") or imagesearch(&x_modifiedb, &y_modifiedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 modifiedb.png") or imagesearch(&x_advancedw, &y_advancedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 advancedw.png")) {
                item:= 1
e
                loop 9 {
                    send "{e down}"
                    sleep(50)
                    send "{e up}"
                    sleep(50)
                }
                break
            }
        }
    }
}
;----------------------------------------------------------------------------
load() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(100)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
down
    loop 999 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(100)
        if (A_Index <7)
            offset:= A_Index*70
        if imagesearch(&x_time, &y_time, 1010, 320+offset, 1105,443+offset, timeimg) {
up
            loop {
                sleep(100)
                send "{up down}"
                sleep(50)
                send "{up up}"
                if imagesearch(&x_timew, &y_timew, 1010, 320+offset, 1105,443+offset, timewimg) {
enter
                    loop 2 {
                        sleep(200)
                        send "{enter down}"
                        sleep(50)
                        send "{enter up}"
                    }
                    break 2
                }
            }
        }
    }
}
;-------------------------------------------------------------------------
save() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(100)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(100)
    }
down
    send "{down down}"
    sleep(50)
    send "{down up}"
    sleep(100)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 7 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
    sleep(50)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(50)
}
;----------------------------------------------------------------------------
quickload() {
    global
    f9down := GetKeyState("f9")
    sleep(50)
    if (f9down = 1) {
        sleep(50)
        send "{f9 up}"
        sleep(50)
    }
    send "{f9}"
}
;----------------------------------------------------------------------------
loadcheck() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(100)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop (checkindex) {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
    if imagesearch(&x_timew, &y_timew, 1010, 390, 1105,943, timewimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if Result = "Retry"
            reload
        if Result = "Abort"
            exitapp
        if Result = "Abort"
            exitapp
        if Result = "Ignore"
            return
    }
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(4000) ; load delay
    loop {
        sleep(100)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
    }
i
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
z
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(200)
}
;----------------------------------------------------------------------------
eraser() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(100)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop (checkindex) {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
    if imagesearch(&x_timew, &y_timew, 1010, 390, 1105,943, timewimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if Result = "Retry"
            reload
        if Result = "Abort"
            exitapp
        if Result = "Abort"
            exitapp
        if Result = "Ignore"
            return
    }
r
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
    rdown := GetKeyState("r")
    if (rdown = 1) {
        send "{r up}"
        sleep(200)
enter
        send "{enter down}"
        sleep(50)
        send "{enter up}"
        sleep(200)
esc
        loop {
            if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
                break
            sleep(50)
            send "{esc down}"
            sleep(50)
            send "{esc up}"
            sleep(100)
        }
    }
}
;----------------------------------------------------------------------------
eraserloadcheck() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(100)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop (checkindex) {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
    if imagesearch(&x_timew, &y_timew, 1010, 390, 1105,943, timewimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if Result = "Retry"
            reload
        if Result = "Abort"
            exitapp
        if Result = "Abort"
            exitapp
        if Result = "Ignore"
            return
    }
r
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
enter
    loop 2 {
        send "{enter down}"
        sleep(50)
        send "{enter up}"
        sleep(200)
    }
    sleep(500)
    loop 2 {
        send "{enter down}"
        sleep(50)
        send "{enter up}"
        sleep(200)
    }
    sleep(4000) ; load delay
    loop {
        sleep(100)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
    }
i
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
z
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(200)
}
;----------------------------------------------------------------------------
enter() {
    global
    enterdown := GetKeyState("enter")
    sleep(50)
    if (enterdown = 1) {
        sleep(50)
        send "{enter up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
lbutton() {
    global
    lbuttondown := GetKeyState("lbutton")
    sleep(50)
    if (lbuttondown = 1) {
        sleep(50)
        send "{lbutton up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
e() {
    global
    edown := GetKeyState("e")
    sleep(50)
    if (edown = 1) {
        sleep(50)
        send "{e up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
esc() {
    global
    escdown := GetKeyState("esc")
    sleep(50)
    if (escdown = 1) {
        sleep(50)
        send "{esc up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
w() {
    global
    wdown := GetKeyState("w")
    sleep(50)
    if (wdown = 1) {
        sleep(50)
        send "{w up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
a() {
    global
    adown := GetKeyState("a")
    sleep(50)
    if (adown = 1) {
        sleep(50)
        send "{a up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
s() {
    global
    sdown := GetKeyState("s")
    sleep(50)
    if (sdown = 1) {
        sleep(50)
        send "{s up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
d() {
    global
    ddown := GetKeyState("d")
    sleep(50)
    if (ddown = 1) {
        sleep(50)
        send "{d up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
up() {
    global
    updown := GetKeyState("up")
    sleep(50)
    if (updown = 1) {
        sleep(50)
        send "{up up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
down() {
    global
    downdown := GetKeyState("down")
    sleep(50)
    if (downdown = 1) {
        sleep(50)
        send "{down up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
i() {
    global
    idown := GetKeyState("i")
    sleep(50)
    if (idown = 1) {
        sleep(50)
        send "{i up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
r() {
    global
    rdown := GetKeyState("r")
    sleep(50)
    if (rdown = 1) {
        sleep(50)
        send "{r up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
z() {
    global
    zdown := GetKeyState("z")
    sleep(50)
    if (zdown = 1) {
        sleep(50)
        send "{z up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
q() {
    global
    qdown := GetKeyState("q")
    sleep(50)
    if (qdown = 1) {
        sleep(50)
        send "{z up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------

Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Tentative Starfield load loot script

Post by Noo0B » 11 Oct 2023, 12:19

You may want to do your own autosavew.png capture like before. It's configured for scanning a capture of only the 4 first letters. It's a "w", so select the autosave you will use as printscreen capture model and like before nick the edges of "AUTO", specially the right of the "O".

Code: Select all

#Warn
#SingleInstance Force
ProcessSetPriority "H"
SendMode "event"
SetWorkingDir A_ScriptDir
SetTitleMatchMode 2
#MaxThreadsperHotkey 2
SetKeyDelay 0, 50
SetMouseDelay 50
WinActivate "Starfield"
HotIfWinActive "Starfield"
InstallMouseHook
toggle := false
time:= "52236"
timeimg:= "*75 " time ".png"
timewimg:= "*75 " time "w.png"
x_time:= "x_%time%"
y_time:= "y_%time%"
x_timew:= "x_%time%w"
y_timew:= "y_%time%w"
timew:= "%time%w"
autosavedelete:= 1
checkindex:= 0
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
f11::{
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    loot
}
;----------------------------------------------------------------------------
f1:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
eraser
}
;----------------------------------------------------------------------------
f2:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    checkindex+= 1
}
;----------------------------------------------------------------------------
f3:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
loadcheck
}
;----------------------------------------------------------------------------
f8:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
eraserloadcheck
}
;----------------------------------------------------------------------------
f12:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    exitapp
}
;-------------------------------------------------------------------------
f6:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    reload
}
;-------------------------------------------------------------------------
;----------------------------------------------------------------------------
F7:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(100)
;    if imagesearch(&x_sfquit, &y_sfquit, 50, 640, 129, 719, "*55 sfquit.png") {
;        send('esc')
;        sleep(2000)
;        if imagesearch(&x_sfback, &y_sfback, 1760, 1000, 1799, 1029, "*55 sfback.png") {
;            send('esc')
;            sleep(200)
;        }
;    }
;    else if imagesearch(&x_sfback, &y_sfback, 1760, 1000, 1799, 1029, "*55 sfback.png") {
;        send('esc')
;        sleep(200)
;    }
;    loop {
;        sleep(100)
;        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
;            break
;    }
esc
    loop {
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
        sleep(50)
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(300)
    }
    loop {
        item:= 0
        sleep(100)
;----------------------------------------------------------------------------
load ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(4000) ; load delay
        loop {
            send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
            sleep(100)
            if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
                break
        }
;---------custom movement
lbutton
        send "{lbutton down}"
        sleep(50)
w
a
        send "{w down}"
        sleep(1150)
        send "{w up}"
        sleep(500)
lcontrol
        send "{lcontrol down}"
        sleep(50)
        send "{lcontrol up}"
w
        send "{w down}"
        sleep(900)
        send "{w up}"
        sleep(50)
lbutton
        send "{lbutton up}"
        sleep(1100)
;------------item scan
;----------------------------------------------------------------------------
loot ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(200)
        if (item = 1) {
;----------------------------------------------------------------------------
save ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(2500) ;save delay
        }
;----------------------------------------------------------------------------
    }
}
;---------functions
;----------------------------------------------------------------------------
loot() {
    global
    sleep 150
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    if imagesearch(&x_loot, &y_loot, 0, 0, 1920,1080, "*55 lootbox.png") {
        loop 9 {
            sleep 150
            if (pixelsearch(&x_legendary, &y_legendary, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0xEDC162, 30) or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedw.png") or imagesearch(&x_calibratedb, &y_calibratedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedb.png") or imagesearch(&x_calibratedp, &y_calibratedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedp.png") or imagesearch(&x_modifiedp, &y_modifiedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedp.png") or imagesearch(&x_modifiedp2, &y_modifiedp2, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedp2.png") or imagesearch(&x_modifiedb, &y_modifiedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedb.png") or imagesearch(&x_modifiedb2, &y_modifiedb2, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedb2.png") or imagesearch(&x_advancedw, &y_advancedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 advancedw.png")) {
                item:= 1
e
                loop 9 {
                    send "{e down}"
                    sleep(50)
                    send "{e up}"
                    sleep(50)
                }
                break
            }
        }
    }
}
;----------------------------------------------------------------------------
load() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(300)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
down
    loop {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(150)
        if (A_Index <7)
            offset:= A_Index*70
        if imagesearch(&x_time, &y_time, 1000, 310+offset, 1120,353+offset, timeimg) {
            sleep(50)
up
            loop {
                send "{up down}"
                sleep(50)
                send "{up up}"
                sleep(150)
                if imagesearch(&x_timew, &y_timew, 1000, 310+offset, 1120,353+offset, timewimg) {
enter
                    loop 2 {
                        sleep(50)
                        send "{enter down}"
                        sleep(50)
                        send "{enter up}"
                    }
                    break 2
                }
				if (A_Index >299) {
					load()
					break 2
				}
            }
        }
		if (A_Index >299) {
			load()
			break
		}
    }
}
;-------------------------------------------------------------------------
save() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(300)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(100)
    }
down
    send "{down down}"
    sleep(50)
    send "{down up}"
    sleep(100)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 7 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
    sleep(50)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(50)
}
;----------------------------------------------------------------------------
quickload() {
    global
    f9down := GetKeyState("f9")
    sleep(50)
    if (f9down = 1) {
        sleep(50)
        send "{f9 up}"
        sleep(50)
    }
    send "{f9}"
}
;----------------------------------------------------------------------------
loadcheck() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(300)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
r
e
	if (autosavedelete = 1) {
		loop {
			sleep(500)
			if imagesearch(&x_autosavew, &y_autosavew, 390, 390, 450,410, "*55 autosavew.png") {
				send "{r down}"
				sleep(50)
				send "{r up}"
				sleep(200)
				send "{e down}"
				sleep(50)
				send "{e up}"
				sleep(200)
			} else
				break
		}
	}
down
    loop (checkindex) {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
    if imagesearch(&x_timew, &y_timew, 1010, 390, 1105,943, timewimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if Result = "Retry"
            reload
        if Result = "Abort"
            exitapp
        if Result = "Abort"
            exitapp
        if Result = "Ignore"
            return
    }
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(4000) ; load delay
    loop {
        sleep(100)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
    }
i
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
z
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(200)
}
;----------------------------------------------------------------------------
eraser() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(300)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
r
e
	if (autosavedelete = 1) {
		loop {
			sleep(500)
			if imagesearch(&x_autosavew, &y_autosavew, 390, 390, 450,410, "*55 autosavew.png") {
				send "{r down}"
				sleep(50)
				send "{r up}"
				sleep(200)
				send "{e down}"
				sleep(50)
				send "{e up}"
				sleep(200)
			} else
				break
		}
	}
down
    loop (checkindex) {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
    if imagesearch(&x_timew, &y_timew, 1010, 390, 1105,943, timewimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if Result = "Retry"
            reload
        if Result = "Abort"
            exitapp
        if Result = "Abort"
            exitapp
        if Result = "Ignore"
            return
    }
r
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
    rdown := GetKeyState("r")
    if (rdown = 1) {
        send "{r up}"
        sleep(200)
enter
        send "{enter down}"
        sleep(50)
        send "{enter up}"
        sleep(200)
esc
        loop {
            if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
                break
            sleep(50)
            send "{esc down}"
            sleep(50)
            send "{esc up}"
            sleep(100)
        }
    }
}
;----------------------------------------------------------------------------
eraserloadcheck() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10))
            break
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(300)
    }
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
down
    loop 2 {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
r
e
	if (autosavedelete = 1) {
		loop {
			sleep(500)
			if imagesearch(&x_autosavew, &y_autosavew, 390, 390, 450,410, "*55 autosavew.png") {
				send "{r down}"
				sleep(50)
				send "{r up}"
				sleep(200)
				send "{e down}"
				sleep(50)
				send "{e up}"
				sleep(200)
			} else
				break
		}
	}
down
    loop (checkindex) {
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    sleep(200)
    if imagesearch(&x_timew, &y_timew, 1010, 390, 1105,943, timewimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if Result = "Retry"
            reload
        if Result = "Abort"
            exitapp
        if Result = "Abort"
            exitapp
        if Result = "Ignore"
            return
    }
r
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
enter
    loop 2 {
        send "{enter down}"
        sleep(50)
        send "{enter up}"
        sleep(200)
    }
    sleep(500)
    loop 2 {
        send "{enter down}"
        sleep(50)
        send "{enter up}"
        sleep(200)
    }
    sleep(4000) ; load delay
    loop {
        sleep(100)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
    }
i
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
up
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
enter
    send "{enter down}"
    sleep(50)
    send "{enter up}"
    sleep(200)
z
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(200)
}
;----------------------------------------------------------------------------
enter() {
    global
    key:= "enter"
    keyf()
}
;----------------------------------------------------------------------------
lbutton() {
    global
    key:= "lbutton"
    keyf()
}
;----------------------------------------------------------------------------
e() {
    global
    key:= "e"
    keyf()
}
;----------------------------------------------------------------------------
esc() {
    global
    key:= "esc"
    keyf()
}
;----------------------------------------------------------------------------
w() {
    global
    key:= "w"
    keyf()
}
;----------------------------------------------------------------------------
a() {
    global
    key:= "a"
    keyf()
}
;----------------------------------------------------------------------------
s() {
    global
    key:= "s"
    keyf()
}
;----------------------------------------------------------------------------
d() {
    global
    key:= "s"
    keyf()
}
;----------------------------------------------------------------------------
up() {
    global
    key:= "up"
    keyf()
}
;----------------------------------------------------------------------------
down() {
    global
    key:= "down"
    keyf()
}
;----------------------------------------------------------------------------
i() {
    global
    key:= "i"
    keyf()
}
;----------------------------------------------------------------------------
r() {
    global
    key:= "r"
    keyf()
}
;----------------------------------------------------------------------------
z() {
    global
    key:= "z"
    keyf()
}
;----------------------------------------------------------------------------
q() {
    global
    key:= "q"
    keyf()
}
;----------------------------------------------------------------------------
lcontrol() {
    global
    key:= "lcontrol"
    keyf()
}
;----------------------------------------------------------------------------
keyf() {
    global
    if (GetKeyState(key, )) {
        send("{" key " up}")
    }
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------

Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Tentative Starfield load loot script

Post by Noo0B » 11 Oct 2023, 23:02

Reworked a bit with more function referencing instead of repeated code.
Added tooltips and an intrusive autosave check and longer delays to make the script more persistent.
Save captures lost the need to have a w added to the end of the name so now its just the localtime on the save like 235959.png and same for the autosave.png provided.
Enter key deprecated.
That's all I remember.
Inventory check Hotkeys now are:
f1: erases the indexed save.
f2: references the next save from top to bottom on the list.
f3: loads
f4: f2+f3
f8: f1+f3, new save same index.
A bit untested.
Plans are to add camera movement and new items menu item identification.

Code: Select all

#Warn
#SingleInstance Force
ProcessSetPriority "H"
SendMode "event"
SetWorkingDir A_ScriptDir
SetTitleMatchMode 2
#MaxThreadsperHotkey 2
SetKeyDelay 0, 50
SetMouseDelay 50
WinActivate "Starfield"
HotIfWinActive "Starfield"
InstallMouseHook
toggle := false
time:= "52236"
timeimg:= "*75 " time ".png"
x_time:= "x_%time%"
y_time:= "y_%time%"
x_timew:= "x_%time%w"
y_timew:= "y_%time%w"
autosavedelete:= 1
checkindex:= 0
tooltipy:=400
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
f10::{
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
}
f11::{
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
    loot
}
;----------------------------------------------------------------------------
f1:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
eraser
}
;----------------------------------------------------------------------------
f2:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
    checkindex+= 1
    tooltipy:= 400+(checkindex*70)
    if tooltipy > 820
        tooltipy:= 820
}
;----------------------------------------------------------------------------
f3:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
loadcheck
}
;----------------------------------------------------------------------------
f4:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
    checkindex+= 1
    tooltipy:= 400+(checkindex*70)
    if tooltipy > 820
        tooltipy:= 820
loadcheck
}
;----------------------------------------------------------------------------
f8:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
eraserloadcheck
}
;----------------------------------------------------------------------------
f12:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
    exitapp
}
;----------------------------------------------------------------------------
f6:: {
    global
    sleep(50)
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
    reload
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
F7:: {
    global
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    sleep(50)
starto2
    loop {
        item:= 0
        send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
        sleep(100)
;----------------------------------------------------------------------------
load ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
;---------custom movement
lbutton
        send "{lbutton down}"
        sleep(50)
w
a
        send "{w down}"
        sleep(1150)
        send "{w up}"
        sleep(500)
lcontrol
        send "{lcontrol down}"
        sleep(50)
        send "{lcontrol up}"
w
        send "{w down}"
        sleep(900)
        send "{w up}"
        sleep(50)
lbutton
        send "{lbutton up}"
        sleep(1100)
;------------item scan
;----------------------------------------------------------------------------
loot ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(200)
        if (item = 1) {
;----------------------------------------------------------------------------
save ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        }
    } ;---------main hotkey loop end
} ;--------- end
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------hotkey functions
;----------------------------------------------------------------------------
loot() {
    global
    sleep 100
    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}{lcontrol up}"
    if imagesearch(&x_loot, &y_loot, 0, 0, 1920,1080, "*55 lootbox.png") { ;<----------searches for the lootbox
        loop 9 {
            sleep 150
            if (pixelsearch(&x_legendary, &y_legendary, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0xEDC162, 30) or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedw.png") or imagesearch(&x_calibratedb, &y_calibratedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedb.png") or imagesearch(&x_calibratedp, &y_calibratedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 calibratedp.png") or imagesearch(&x_modifiedp, &y_modifiedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedp.png") or imagesearch(&x_modifiedp2, &y_modifiedp2, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedp2.png") or imagesearch(&x_modifiedb, &y_modifiedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedb.png") or imagesearch(&x_modifiedb2, &y_modifiedb2, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*65 modifiedb2.png") or imagesearch(&x_advancedw, &y_advancedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, "*55 advancedw.png")) {
                item:= 1
e
                loop 7 {
                    send "{e down}"
                    sleep(100)
                    send "{e up}"
                    sleep(100)
                }
                break
            }
        }
    }
}
;----------------------------------------------------------------------------
load() {
    global
box
loadmenu
save1
loadloop
sleep(4000) ;---------load delay
o2
}
;-------------------------------------------------------------------------
save() {
    global
box
down
    send "{down down}"
    sleep(100)
    send "{down up}"
    sleep(100)
enter
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(200)
save1
enter
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(500)
o2
}
;----------------------------------------------------------------------------
quickload() {
    global
    f9down := GetKeyState("f9")
    sleep(50)
    if (f9down = 1) {
        sleep(100)
        send "{f9 up}"
        sleep(100)
    }
    send "{f9}"
}
;----------------------------------------------------------------------------
loadcheck() {
    global
box
loadmenu
save1
saveindex
e
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(200)
    send "{e down}"
    sleep(100)
    send "{e up}"
	settimer () => tooltip(), -10
    sleep(4000) ; load delay
o2
inventory
}
;----------------------------------------------------------------------------
eraser() {
    global
box
loadmenu
save1
saveindex
r
    send "{r down}"
    sleep(100)
    send "{r up}"
    sleep(2000)
    rdown := getkeystate("r")
    if (rdown = 1) {
        send "{r up}"
        sleep(200)
enter
        send "{e down}"
        sleep(100)
        send "{e up}"
        sleep(200)
		SetTimer () => ToolTip(), -10
    } else
		settimer () => tooltip(), -10
sleep 100
}
;----------------------------------------------------------------------------
eraserloadcheck() {
    global
box
loadmenu
save1
saveindex
r
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
e
    sleep(500)
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(300)
;----------file erased
    loop 2 {
        send "{e down}"
        sleep(50)
        send "{e up}"
        sleep(200)
    }
	SetTimer () => ToolTip(), -10
    sleep(4000) ; load delay
o2
inventory
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------aux functions
;----------------------------------------------------------------------------
o2() {
    global
    loop {
        sleep(150)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
    }
    sleep(100)
}
;----------------------------------------------------------------------------
starto2() {
    global
esc
    loop {
        sleep(150)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 0)
            break
        send "{esc down}"
        sleep(100)
        send "{esc up}"
    }
    sleep(100)
}
;----------------------------------------------------------------------------
box() {
    global
esc
    loop { ;<----------searches for the menu screen
        sleep(150)
        if (imagesearch(&x_quit, &y_quit, 70, 660, 119, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10)) ;<---------search for quit menu and lack of scroll bar
            break
        send "{esc down}"
        sleep(100)
        send "{esc up}"
    }
    sleep(200)
up
    loop { ;<----------sends the box choice to top
        sleep(150)
        if pixelsearch(&x_box1, &y_box1, 220, 400, 221, 401, 0xFFFFFF, 0) ;<----------top save
            break
        send "{up down}"
        sleep(100)
        send "{up up}"
    }
    sleep 300
}
;----------------------------------------------------------------------------
loadmenu() {
    global
down
    loop 2 { ;<----------chooses load menu
        sleep(100)
        send "{down down}"
        sleep(100)
        send "{down up}"
    }
    sleep(200)
e
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(200)
}
;----------------------------------------------------------------------------
save1() {
    global
up
    loop { ;<----------sends the savefile choice to top
        sleep(150)
        if pixelsearch(&x_save1, &y_save1, 870, 400, 871, 401, 0xFFFFFF, 0) ;<----------top save
            break
        send "{up down}"
        sleep(100)
        send "{up up}"
    }
    sleep 300
}
;----------------------------------------------------------------------------
loadloop() {
    global
down
e
r
loop { ;<----------chooses the selected load capture
		loop {
        if (A_Index <7)
            offset:= A_Index*71
		ToolTip time, 1220, 355+offset,
        sleep(150)
        if imagesearch(&x_time, &y_time, 1000, 310+offset, 1120,353+offset, timeimg) { ;<----------finds the selected load capture
            loop 2 {
                sleep(100)
                send "{e down}"
                sleep(100)
                send "{e up}"
                }
            }
            settimer () => tooltip(), -10
            break
        } else { ;<----------scroll down to highlight the next load file
            sleep(100)
            send "{down down}"
            sleep(100)
            send "{down up}"
        }
        if (A_Index >299) { ;<----------reloads the load function if fail
            settimer () => tooltip(), -10
            load()
            break
        }
    }
    sleep(100)
}
;----------------------------------------------------------------------------
saveindex() {
    global
r
e
    loop {
        sleep(100)
        if imagesearch(&x_autosave, &y_autosave, 390, 390, 450,410, "*55 autosave.png") {
            send "{r down}"
            sleep(100)
            send "{r up}"
            sleep(200)
            send "{e down}"
            sleep(100)
            send "{e up}"
            sleep(200)
        } else
            break

	}
	tooltip(checkindex+1, 350, tooltipy, )
down
    loop (checkindex) {
        send "{down down}"
        sleep(200)
        send "{down up}"
        sleep(200)
    }
    sleep(200)
    if imagesearch(&x_time, &y_time, 1010, 390, 1105,943, timeimg) {
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if (Result = "retry") {
			settimer () => tooltip(), -10
            reload
		}
        if (Result = "abort") {
			setTimer () => tooltip(), -10
            exitapp
		}
        if Result = "ignore"
            return
    }
    sleep 100
}
;----------------------------------------------------------------------------
inventory() {
    global
i
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
up
    loop 8 {
        sleep(100)
        send "{up down}"
        sleep(100)
        send "{up up}"
    }
e
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(200)
z
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(200)
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
keyf() {
    global
    if (GetKeyState(key, )) {
        send("{" key " up}")
    }
}
;----------------------------------------------------------------------------
enter() {
    global
    key:= "enter"
keyf()
}
;----------------------------------------------------------------------------
lbutton() {
    global
    key:= "lbutton"
keyf()
}
;----------------------------------------------------------------------------
e() {
    global
    key:= "e"
keyf()
}
;----------------------------------------------------------------------------
esc() {
    global
    key:= "esc"
keyf()
}
;----------------------------------------------------------------------------
w() {
    global
    key:= "w"
keyf()
}
;----------------------------------------------------------------------------
a() {
    global
    key:= "a"
keyf()
}
;----------------------------------------------------------------------------
s() {
    global
    key:= "s"
keyf()
}
;----------------------------------------------------------------------------
d() {
    global
    key:= "s"
keyf()
}
;----------------------------------------------------------------------------
up() {
    global
    key:= "up"
keyf()
}
;----------------------------------------------------------------------------
down() {
    global
    key:= "down"
keyf()
}
;----------------------------------------------------------------------------
i() {
    global
    key:= "i"
keyf()
}
;----------------------------------------------------------------------------
r() {
    global
    key:= "r"
keyf()
}
;----------------------------------------------------------------------------
z() {
    global
    key:= "z"
keyf()
}
;----------------------------------------------------------------------------
q() {
    global
    key:= "q"
keyf()
}
;----------------------------------------------------------------------------
lcontrol() {
    global
    key:= "lcontrol"
keyf()
}
;----------------------------------------------------------------------------
https://1drv.ms/u/s!AgzOWuNb0PCFgZQSGVyz2dXnkP2xdg?e=wvbdSH
*edit: code corrected here the one on the rar is an old version.

Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Tentative Starfield load loot script

Post by Noo0B » 11 Oct 2023, 23:28

eh you may want to use the old version for a bit, not sure.
edit*
now it has some failsafes and a few more complicated stuff

Code: Select all

#Warn
#SingleInstance Force
ProcessSetPriority "H"
SendMode "event"
SetWorkingDir A_ScriptDir
SetTitleMatchMode 2
#MaxThreadsperHotkey 1
SetKeyDelay 0, 50
SetMouseDelay 50
WinActivate "Starfield"
HotIfWinActive "Starfield"
InstallMouseHook
toggle := false
;----------------------------------------------------------------------------
time:= "103410" ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
timeimg:= "*95 " time ".png"
;----------------------------------------------------------------------------
coldev:= "*95" ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
x_time:= "x_%time%"
y_time:= "y_%time%"
autosavedelete:= 1
checkindex:= 0
tooltipy:= 400
offset:= 0
indexoffset:= 0
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
f10::{
    global
keyup
    sleep(50)
}
f11::{
    global
keyup
    sleep(50)
    loot
}
;----------------------------------------------------------------------------
f1:: {
    global
keyup
    sleep(50)
eraser
}
;----------------------------------------------------------------------------
f2:: {
    global
keyup
    sleep(50)
    checkindex+= 1
    tooltipy:= 400+(checkindex*71)
    if tooltipy > 827
        tooltipy:= 827
}
;----------------------------------------------------------------------------
f3:: {
    global
keyup
    sleep(50)
loadcheck
}
;----------------------------------------------------------------------------
f4:: {
    global
keyup
    checkindex+= 1
    tooltipy:= 400+(checkindex*71)
    if tooltipy > 827
        tooltipy:= 827
loadcheck
}
;----------------------------------------------------------------------------
f8:: {
    global
keyup
    sleep(50)
eraserloadcheck
}
;----------------------------------------------------------------------------
f12:: {
    global
keyup
    sleep(50)
    exitapp
}
;----------------------------------------------------------------------------
f6:: {
    global
    sleep(50)
keyup
    sleep(50)
    reload
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
F7:: {
    global
keyup
    sleep(50)
starto2
    loop {
        item:= 0
keyup
        sleep(100)
;----------------------------------------------------------------------------
load ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
;---------custom movement
lcontrol
        sleep(1550)
        send "{lcontrol down}"
        sleep(50)
        send "{lcontrol up}"
w
        send "{w down}"
        sleep(1250)
        sleep(50)
        send "{w up}"
d
        send "{d down}"
        sleep(410)
        send "{d up}"
        sleep(100)
;------------item scan
;----------------------------------------------------------------------------
loot:
    SetTimer () => ToolTip(), -10
    sleep(50)
loot ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        sleep(100)
        if (item = 1) {
;----------------------------------------------------------------------------
save ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        }
    } ;---------main hotkey loop end
} ;--------- end
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------hotkey functions
;----------------------------------------------------------------------------
loot() {
    global
    sleep 100
keyup
    if imagesearch(&x_loot, &y_loot, 0, 0, 1920,1080, "*55 lootbox.png") { ;<----------searches for the lootbox
        tooltip("Lootbox found", x_loot, y_loot)
        sleep(300)
        loop 9 {
            sleep 150
            if (pixelsearch(&x_legendary, &y_legendary, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0xEDC162, 30) or imagesearch(&x_calibratedw, &y_calibratedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " calibratedw.png") or imagesearch(&x_calibratedb, &y_calibratedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " calibratedb.png") or imagesearch(&x_calibratedp, &y_calibratedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " calibratedp.png") or imagesearch(&x_modifiedp, &y_modifiedp, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " modifiedp.png") or imagesearch(&x_modifiedp2, &y_modifiedp2, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " modifiedp2.png") or imagesearch(&x_modifiedb, &y_modifiedb, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " modifiedb.png") or imagesearch(&x_modifiedb2, &y_modifiedb2, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " modifiedb2.png") or imagesearch(&x_advancedw, &y_advancedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " advancedw.png")) {
                tooltip("item found", x_loot, y_loot)
                sleep(100)
                item:= 1
e
                loop 7 {
                    send "{e down}"
                    sleep(100)
                    send "{e up}"
                    sleep(100)
                }
                break
            }
        }
    }
    SetTimer () => ToolTip(), -10
}
;----------------------------------------------------------------------------
load() {
    global
box
loadmenu
save1
loadloop
    SetTimer () => ToolTip(), -10
    sleep(2000) ;---------load delay
o2
}
;-------------------------------------------------------------------------
save() {
    global
box
down
    send "{down down}"
    sleep(100)
    send "{down up}"
    sleep(100)
enter
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(200)
save1
enter
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(500)
o2
}
;----------------------------------------------------------------------------
quickload() {
    global
    f9down := GetKeyState("f9")
    sleep(50)
    if (f9down = 1) {
        sleep(100)
        send "{f9 up}"
        sleep(100)
    }
    send "{f9}"
}
;----------------------------------------------------------------------------
loadcheck() {
    global
box
loadmenu
save1
saveindex
e
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(200)
    send "{e down}"
    sleep(100)
    send "{e up}"
    sleep(2000) ; load delay
o2
inventory
}
;----------------------------------------------------------------------------
eraser() {
    global
box
loadmenu
save1
saveindex
r
    send "{r down}"
    sleep(100)
    send "{r up}"
    sleep(2000)
    rdown := getkeystate("r")
    if (rdown = 1) {
        send "{r up}"
        sleep(200)
enter
        send "{e down}"
        sleep(100)
        send "{e up}"
        sleep(200)
		SetTimer () => ToolTip(), -10
    } else
		settimer () => tooltip(), -10
sleep 100
}
;----------------------------------------------------------------------------
eraserloadcheck() {
    global
box
loadmenu
save1
saveindex
r
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
e
    sleep(500)
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(300)
;----------file erased
    loop 2 {
        send "{e down}"
        sleep(50)
        send "{e up}"
        sleep(200)
    }
	SetTimer () => ToolTip(), -10
    sleep(2000) ; load delay
o2
inventory
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------aux functions
;----------------------------------------------------------------------------
o2() {
    global
    loop {
        sleep(150)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 20) {
            tooltip("o2 dial found", x_o2, y_o2)
            break
        }
    }
    settimer () => tooltip(), -10
    sleep(100)
}
;----------------------------------------------------------------------------
starto2() {
    global
esc
    loop {
        sleep(150)
        if pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 20) {
            tooltip("o2 dial found", x_o2, y_o2)
            break
        }
        else {
        send "{esc down}"
        sleep(100)
        send "{esc up}"
        sleep(100)
        }
    }
    settimer () => tooltip(), -10
    sleep(100)
}
;----------------------------------------------------------------------------
box() {
    global
esc
    sleep(100)
    loop { ;<----------searches for the menu screen
        sleep(150)
        if (imagesearch(&x_quit, &y_quit, 70, 660, 139, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 20)) {
            tooltip("quit box found", x_quit+100, y_quit)
            break
        } else {
        send "{esc down}"
        sleep(100)
        send "{esc up}"
        sleep(100)
        }
    }
    sleep(300)
up
    loop { ;<----------sends the box choice to top
        sleep(150)
        if (pixelsearch(&x_box1, &y_box1, 85, 385, 86, 386, 0xFFFFFF, 20) or pixelsearch(&x_box1, &y_box1, 85, 385, 86, 386, 0x707071, 20)){ ;<----------top box
            sleep(100)
            tooltip("top box found", x_box1+150, y_box1)
            break
        } else {
        send "{esc down}"
        sleep(100)
        send "{esc up}"
        sleep(100)
        }
    }
    settimer () => tooltip(), -10
    sleep 300
}
;----------------------------------------------------------------------------
loadmenu() {
    global
esc
    loop {
        if (imagesearch(&x_quit, &y_quit, 70, 660, 139, 699, "*55 quit.png") and pixelsearch(&x_b, &y_b, 290, 380, 290, 381, 0x09141A, 20)) {
            tooltip("quit box found", x_quit+100, y_quit)
            break
        } else {
        send "{esc down}"
        sleep(100)
        send "{esc up}"
        sleep(100)
        }
    }
down
    loop {
        sleep(200)
        if (imagesearch(&x_quit, &y_quit, 70, 660, 139, 699, "*55 quit.png") and pixelsearch(&x_g, &y_g, 290, 380, 291, 381, 0x09141A, 20)) {
            loop 2 { ;<----------chooses load menu
                sleep(100)
                send "{down down}"
                sleep(100)
                send "{down up}"
            }
            sleep(100)
e
            send "{e down}"
            sleep(100)
            send "{e up}"
            sleep(200)
            break
        } else {
esc
load
        exit
        }
    }
    settimer () => tooltip(), -10
    sleep(100)
}
;----------------------------------------------------------------------------
save1() {
    global
up
    loop { ;<----------sends the savefile choice to top
        sleep(150)
        if pixelsearch(&x_save1, &y_save1, 870, 400, 871, 401, 0xFFFFFF, 20) { ;<----------top save
            sleep(100)
            tooltip("top save found", x_box1+150, y_box1)
            break
        } else {
        send "{up down}"
        sleep(100)
        send "{up up}"
        }
    }
    settimer () => tooltip(), -10
    sleep 300
}
;----------------------------------------------------------------------------
loadloop() {
    global
up
down
e
r
    loop 900 { ;<----------chooses the selected load capture
        if (A_Index < 8)
            offset:= A_Index*71
        sleep(200)
        if imagesearch(&x_time, &y_time, 1000, 320+offset, 1120,360+offset, timeimg) { ;<----------finds the selected load capture
            tooltip("<<--- " time, 1200, 340+offset)
            sleep(100)
            loop 2 {
                send "{e down}"
                sleep(100)
                send "{e up}"
                sleep(100)
            }
            settimer () => tooltip(), -10
            break
        } else if ((A_Index < 299) or (A_Index > 599)) { ;<----------scroll down to highlight the next load file
            send "{down down}"
            sleep(100)
            send "{down up}"
            sleep(100)
        }
        if ((A_Index > 299) and (A_Index < 599)) {
            send "{up down}"
            sleep(100)
            send "{up up}"
            sleep(100)
        } ;<----------reloads the load function if fail
        if (A_Index > 899) {
load
        break
        }
    }
    settimer () => tooltip(), -10
    sleep(100)
}
;----------------------------------------------------------------------------
saveindex() {
    global
r
e
    loop {
        sleep(100)
        if imagesearch(&x_autosave, &y_autosave, 390, 390, 450,410, "*55 autosave.png") {
            tooltip("intrusive autosave found", 500, 395)
            send "{r down}"
            sleep(100)
            send "{r up}"
            sleep(200)
            send "{e down}"
            sleep(100)
            send "{e up}"
            sleep(200)
        } else
            break
	}
	tooltip(checkindex+1, 350, tooltipy)
down
    loop (checkindex) {
        send "{down down}"
        sleep(200)
        send "{down up}"
        sleep(200)
    }
    if (checkindex < 8)
        indexoffset:= checkindex*71
    else
        indexoffset:= 426
    sleep(150)
    if imagesearch(&x_time, &y_time, 1000, 320+indexoffset, 1120,360+indexoffset, timeimg) {
        tooltip (time, 1220, 355+indexoffset)
        Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
        if (Result = "retry") {
			settimer () => tooltip(), -10
            reload
		}
        if (Result = "abort") {
			settimer () => tooltip(), -10
            exitapp
		}
        if Result = "ignore"
            return
    }
    sleep 100
}
;----------------------------------------------------------------------------
inventory() {
    global
i
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
up
    loop 8 {
        sleep(100)
        send "{up down}"
        sleep(100)
        send "{up up}"
    }
e
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(200)
z
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(200)
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
keyf() {
    global
    if (GetKeyState(key, )) {
        send("{" key " up}")
    }
}
;----------------------------------------------------------------------------
enter() {
    global
    key:= "enter"
keyf()
}
;----------------------------------------------------------------------------
lbutton() {
    global
    key:= "lbutton"
keyf()
}
;----------------------------------------------------------------------------
e() {
    global
    key:= "e"
keyf()
}
;----------------------------------------------------------------------------
esc() {
    global
    key:= "esc"
keyf()
}
;----------------------------------------------------------------------------
w() {
    global
    key:= "w"
keyf()
}
;----------------------------------------------------------------------------
a() {
    global
    key:= "a"
keyf()
}
;----------------------------------------------------------------------------
s() {
    global
    key:= "s"
keyf()
}
;----------------------------------------------------------------------------
d() {
    global
    key:= "s"
keyf()
}
;----------------------------------------------------------------------------
up() {
    global
    key:= "up"
keyf()
}
;----------------------------------------------------------------------------
down() {
    global
    key:= "down"
keyf()
}
;----------------------------------------------------------------------------
i() {
    global
    key:= "i"
keyf()
}
;----------------------------------------------------------------------------
r() {
    global
    key:= "r"
keyf()
}
;----------------------------------------------------------------------------
z() {
    global
    key:= "z"
keyf()
}
;----------------------------------------------------------------------------
q() {
    global
    key:= "q"
keyf()
}
;----------------------------------------------------------------------------
lcontrol() {
    global
    key:= "lcontrol"
keyf()
}
;----------------------------------------------------------------------------
lshift() {
    global
    key:= "lshift"
keyf()
}
;----------------------------------------------------------------------------
keyup() {
    global
    sleep 50
lbutton
    sleep 50
esc
w
a
s
d
e
r
enter
up
down
i
z
q
lcontrol
lshift
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
.

Noo0B
Posts: 151
Joined: 26 Jan 2018, 19:54

Re: Tentative Starfield load loot script

Post by Noo0B » 14 Oct 2023, 06:52

added a few failsafes and some sort of ocr since I don't seem to be able to use the simplest tool.
Tightened the timings as well.
there's the original captures, the others might need some trimming.https://1drv.ms/u/s!AgzOWuNb0PCFgZ5SvGbf1X8ihSaEDw?e=UX5rvd

Code: Select all

#include OCR.ahk
#Warn
#SingleInstance Force
ProcessSetPriority "H"
SendMode "event"
SetWorkingDir A_ScriptDir
SetTitleMatchMode 2
#MaxThreadsperHotkey 1
SetKeyDelay 0, 50
SetMouseDelay 50
WinActivate "Starfield"
HotIfWinActive "Starfield"
InstallMouseHook
toggle := false
;----------------------------------------------------------------------------
time:= "time" ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
timeimg:= "*95 " time ".png"
;----------------------------------------------------------------------------
coldev:= "*95" ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
checkindex:= 1
item:= 0
indexfactor:= 0
indexcomp:= ""
clockwork2comp:= ""
clockworkcompare:= ""
hl:= "h.png"
;save1posList:= [[1025, 395, 1035, 410], [1037, 395, 1047, 410], [1054, 395, 1064, 410], [1067, 395, 1077, 410], [1085, 395, 1095, 410], [1098, 395, 1108, 410]]
;save2posList:= [[1025, 466, 1035, 481], [1037, 466, 1047, 481], [1054, 466, 1064, 481], [1067, 466, 1077, 481], [1085, 466, 1095, 481], [1098, 466, 1108, 481]]
;save3posList:= [[1025, 538, 1035, 553], [1037, 538, 1047, 553], [1054, 538, 1064, 553], [1067, 538, 1077, 553], [1085, 538, 1095, 553], [1098, 538, 1108, 553]]
;save4posList:= [[1025, 609, 1035, 624], [1037, 609, 1047, 624], [1054, 609, 1064, 624], [1067, 609, 1077, 624], [1085, 609, 1095, 624], [1098, 609, 1108, 624]]
;save5posList:= [[1025, 681, 1035, 696], [1037, 681, 1047, 696], [1054, 681, 1064, 696], [1067, 681, 1077, 696], [1085, 681, 1095, 696], [1098, 681, 1108, 696]]
;save6posList:= [[1025, 752, 1035, 767], [1037, 752, 1047, 767], [1054, 752, 1064, 767], [1067, 752, 1077, 767], [1085, 752, 1095, 767], [1098, 752, 1108, 767]]
;save7posList:= [[1025, 824, 1035, 839], [1037, 824, 1047, 839], [1054, 824, 1064, 839], [1067, 824, 1077, 839], [1085, 824, 1095, 839], [1098, 824, 1108, 839]]
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
f10::{
    pause
}
f11::{
    ; Pre-established coordinates
;local x := 1025
;local y := 395
;local w := 1035
;local h := 410
    ; Perform OCR on the specified rectangle and store the result in a variable
;    ocrText := OCR.FromRect(x, y, w, h,,2).Text

    ; Display the result in a message box
;    MsgBox ocrText
 global indexfactor:= 3
clockwork2
}
;----------------------------------------------------------------------------
f1:: {
eraser
}
;----------------------------------------------------------------------------
f2:: {
global checkindex+= 1
}
;----------------------------------------------------------------------------
f3:: {
loadcheck
}
;----------------------------------------------------------------------------
f4:: {
global checkindex+= 1
loadcheck
}
;----------------------------------------------------------------------------
f8:: {
eraserloadcheck
}
;----------------------------------------------------------------------------
f12:: {
    exitapp
}
;----------------------------------------------------------------------------
f6:: {
    reload
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
F7:: {
starto2
    loop {
        global item:= 0
        sleep(100)
;----------------------------------------------------------------------------
load ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
;---------custom movement
        sleep(50)
        send "{w down}{a down}{LButton down}{Lctrl down}"
        sleep(200)
        send "{w up}{a up}"
        sleep(900)
        sleep(900)
        send "{LButton up}{w down}"
        sleep(200)
        send "{w up}{Lctrl up}"
;        loop {
;            if pixelsearch(&x_o2, &y_o2, 1376, 276, 1377, 277, 0xFFFFFF, 20) {
;                send "{lcontrol up}"
;            break
;            }
;        }
        SetTimer () => ToolTip(), -10
        sleep(100)
;------------item scan
;----------------------------------------------------------------------------
loot ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
        if (item = 1)
;----------------------------------------------------------------------------
save ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------
    } ;---------main hotkey loop end
} ;--------- end
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------hotkey functions
;----------------------------------------------------------------------------
loot() {
global item:= 0
    if imagesearch(&x_loot, &y_loot, 0, 0, 1920,1080, "*55 lootbox.png") { ;<----------searches for the lootbox
        tooltip("Lootbox found", x_loot, y_loot)
        loop 9 {
            if (pixelsearch(&x_legendary, &y_legendary, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0xEDC162, 30) or pixelsearch(&x_iconic, &y_iconic, x_loot-120, y_loot+50, x_loot+120,y_loot+60, 0x42356A, 30) or imagesearch(&x_advancedw, &y_advancedw, x_loot-120, y_loot+50, x_loot+120,y_loot+460, coldev " advancedw.png")) {
                tooltip("item found", x_loot, y_loot)
                sleep(50)
                item:= 1
                loop 7 {
                    send "{e down}"
                    sleep(50)
                    send "{e up}"
                    sleep(50)
                }
                break
            }
        }
    }
    SetTimer () => ToolTip(), -10
}
;----------------------------------------------------------------------------
load() {
box
loadmenu
save1
loadloop
    SetTimer () => ToolTip(), -10
    sleep(2000) ;---------load delay
o2
}
;-------------------------------------------------------------------------
save() {
box
savemenu
save1
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(50)
o2
}
;----------------------------------------------------------------------------
quickload() {
    f9down := GetKeyState("f9")
    sleep(50)
    if (f9down = 1) {
        sleep(50)
        send "{f9 up}"
        sleep(50)
    }
    send "{f9}"
}
;----------------------------------------------------------------------------
loadcheck() {
box
loadmenu
save1
saveindex
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(50)
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(2000) ; load delay
o2
inventory
}
;----------------------------------------------------------------------------
eraser() {
box
loadmenu
save1
saveindex
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(2000)
    rdown := getkeystate("r")
    if (rdown = 1) {
        send "{r up}"
        sleep(50)
        send "{e down}"
        sleep(50)
        send "{e up}"
        sleep(50)
		SetTimer () => ToolTip(), -10
    } else
		settimer () => tooltip(), -10
}
;----------------------------------------------------------------------------
eraserloadcheck() {
box
loadmenu
save1
saveindex
    send "{r down}"
    sleep(50)
    send "{r up}"
    sleep(1000)
    sleep(500)
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(100)
;----------file erased
    loop 2 {
        send "{e down}"
        sleep(50)
        send "{e up}"
        sleep(50)
    }
	SetTimer () => ToolTip(), -10
    sleep(2000) ; load delay
o2
inventory
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;---------aux functions
;----------------------------------------------------------------------------
o2() {
    while !(pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 20))
    sleep(50)
}
;----------------------------------------------------------------------------
starto2() {
    while !(pixelsearch(&x_o2, &y_o2, 106, 920, 108, 922, 0xFFFFFF, 20)) {
            send "{esc down}"
            sleep(50)
            send "{esc up}"
            sleep(50)
        }
}
;----------------------------------------------------------------------------
box() {
    while !(pixelsearch(&x_g, &y_g, 77, 445, 77, 452, 0x394145, 20) and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 10) and not pixelsearch(&x_w, &y_w, 111, 300, 111, 300, 0xFFFFFF, 20)) { ;menu check
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(150)
    }
}
;----------------------------------------------------------------------------
loadmenu() {
    while (pixelsearch(&x_g, &y_g, 77, 445, 77, 452, 0x394145, 20) and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 20) and not pixelsearch(&x_w, &y_w,  111, 300, 111, 300, 0xFFFFFF, 20)) { ;menu check
        while (pixelsearch(&x_w, &y_w, 77, 380, 77, 695, 0xFFFFFF, 20)) {
            if (y_w < 449) {
                send "{down down}"
                sleep(50)
                send "{down up}"
                sleep(50)
            } else if (y_w > 484) {
                send "{up down}"
                sleep(50)
                send "{up up}"
                sleep(50)
            } else {
                send "{e down}"
                sleep(50)
                send "{e up}"
                sleep(50)
                break 2
            }
        }
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(50)
    }
}
;----------------------------------------------------------------------------
savemenu() {
    while (pixelsearch(&x_g, &y_g, 77, 445, 77, 452, 0x394145, 20) and pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 20) and not pixelsearch(&x_w, &y_w,  111, 300, 111, 300, 0xFFFFFF, 20)) { ;menu check
        while (pixelsearch(&x_w, &y_w, 77, 380, 77, 695, 0xFFFFFF, 20)) {
            if (y_w < 413) {
                send "{down down}"
                sleep(50)
                send "{down up}"
                sleep(50)
            } else if (y_w > 449) {
                send "{up down}"
                sleep(50)
                send "{up up}"
                sleep(50)
            } else {
                send "{e down}"
                sleep(50)
                send "{e up}"
                sleep(50)
                break 2
            }
            sleep(50)
        }
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(50)
    }
    settimer () => tooltip(), -10
}
;----------------------------------------------------------------------------
save1() {
    while (pixelsearch(&x_g, &y_g, 77, 440, 77, 457, 0x394145, 20) and not ((pixelsearch(&x_w, &y_w, 111, 300, 111, 300, 0xFFFFFF, 20)) or pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 20))) { ;menu check
        while (pixelsearch(&x_w, &y_w, 313, 380, 313, 877, 0xFFFFFF, 20) and not (pixelsearch(&x_b, &y_b, 290, 761, 290, 761, 0x09141A, 20))) {
            if (y_w < 449) ;<----------top save
                break 2
            send "{up down}"
            sleep(50)
            send "{up up}"
            sleep(50)
        }
        send "{esc down}"
        sleep(50)
        send "{esc up}"
        sleep(50)
box
        break
    }
    sleep 100
}
;----------------------------------------------------------------------------
loadloop() {
    loop { ;<----------chooses the selected load capture
        if (A_Index <= 7)
            yoffset:= A_Index*71
        if imagesearch(&x_autosave, &y_autosave, 390, 320+yoffset, 450, 360+yoffset, "*55 autosave.png") or imagesearch(&x_autosaveh, &y_autosaveh,  1000, 320+yoffset, 1120,360+yoffset, "*55 autosaveh.png") {
            send "{r down}"
            sleep(50)
            send "{r up}"
            sleep(50)
            send "{e down}"
            sleep(50)
            send "{e up}"
            sleep(50)
        }
        if imagesearch(&x_time, &y_time, 1000, 320+yoffset, 1120, 360+yoffset, timeimg) { ;<----------finds the selected load capture
            tooltip("<<--- " time, 1200, 340+yoffset)
            loop 2 {
                send "{e down}"
                sleep(50)
                send "{e up}"
                sleep(50)
            }
            break
        }
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
    settimer () => tooltip(), -10
}
;----------------------------------------------------------------------------
saveindex() {
global indexcomp
global indexfactor:= 0
global checkindex
global savetime
global clockworkcompare:= 0
global highlight:= true
    blockinput  "mousemove"
    loop {
        indexfactor+= 1
        if (A_Index <= 7)
            yoffset:= A_Index*71
        tooltip(indexfactor, 350, 330 + yoffset)
        if (imagesearch(&x_autosave, &y_autosave, 390, 320+yoffset, 450 , 360+yoffset, "*55 autosave.png") or imagesearch(&x_autosaveh, &y_autosaveh,  1000, 320+yoffset, 1120,360+yoffset, "*55 autosaveh.png")) {
            send "{r down}"
            sleep(50)
            send "{r up}"
            sleep(50)
            send "{e down}"
            sleep(50)
            send "{e up}"
            sleep(50)
            send "{esc down}"
            sleep(50)
            send "{esc up}"
            sleep(50)
save1
            break
        }
        if imagesearch(&x_time, &y_time, 1000, 320+yoffset, 1120,360+yoffset, timeimg) {
            tooltip (time, 1220, 355+yoffset)
            Result := MsgBox("END OF SAVES.`nCLICK ABORT TO EXIT THE SCRIPT.`nCLICK RETRY TO RELOAD.","WARNING", "ARI")
            if (Result = "retry") {
                settimer () => tooltip(), -10
                reload
            }
            if (Result = "abort") {
                settimer () => tooltip(), -10
                exitapp
            }
            if Result = "ignore"
                return
        }
        if (checkindex = indexfactor) {
            highlight:= true
clockwork
            if (indexcomp > indexfactor) {
                loop (indexcomp - indexfactor) {
                sleep(50)
                send "{up down}"
                sleep(50)
                send "{up up}"
                break
                }
            }
            if (indexcomp < indexfactor) {
                loop (indexfactor - indexcomp) {
                send "{down down}"
                sleep(50)
                send "{down up}"
                sleep(50)
                break
                }
            }
            if (indexcomp = indexfactor) {
            highlight:= true
clockwork2
                if ((clockworkcompare= savetime) or (clockworkcompare= 0)) {
                    clockworkcompare:= savetime
                    break
                }
            }
        }
        sleep(50)
        send "{down down}"
        sleep(50)
        send "{down up}"
        sleep(50)
    }
	settimer () => tooltip(), -10
    blockinput "mousemoveoff"
}
;----------------------------------------------------------------------------
inventory() {
    send "{i down}"
    sleep(50)
    send "{i up}"
    sleep(200)
    loop 8 {
        send "{up down}"
        sleep(50)
        send "{up up}"
        sleep(50)
    }
    send "{e down}"
    sleep(50)
    send "{e up}"
    sleep(200)
    send "{z down}"
    sleep(50)
    send "{z up}"
    sleep(50)
}
;----------------------------------------------------------------------------
clockwork() {
global indexcomp:= ""
    saveposList:= [[324, 337], [337, 349], [349, 361]]
    indexfact:= indexfactor*71
    if indexfact > 497
        indexfact:= 497
    indexpos1:= 334+(indexfact)-(mod(indexfactor,2))
    indexpos2:= indexpos1+17
    For each, savepos in saveposList {
        Loop 11 {
            digit := A_Index - 1
            image :="sfdigit-" digit hl
            if(ImageSearch(&x_savepos, &y_savepos, savepos[1], indexpos1, savepos[2], indexpos2, "*105 " image)) {
            if (digit = "10")
                digit := ""
            Tooltip(digit, savepos[1], indexpos2)
            indexcomp:= indexcomp digit
            continue
            }
        }
    }
    settimer(() => tooltip(), -100)
}
;----------------------------------------------------------------------------
timecheck() {
global indexcomp
    saveposList:= [[324, 337], [337, 349], [349, 361]]
    loop 7 {
    indexcomp:=""
    indexfact:= A_Index*71
    if indexfact > 497
        indexfact:= 497
        indexpos1:= 334+(indexfact)-(mod(A_Index,2))
        indexpos2:= indexpos1+17
        For each, savepos in saveposList {
            forloopindex += 1
            Loop 11 {
                digit := A_Index - 1
                image :="sfdigit-" digit hl
                if(ImageSearch(&x_savepos, &y_savepos, savepos[1], indexpos1, savepos[2], indexpos2, "*105 " image)) {
                if (digit = "10")
                    digit := ""
                Tooltip(digit, savepos[1], indexpos2)
                indexcomp:= indexcomp digit
                continue
                }
            }
        }
        MsgBox(A_Index ": " indexcomp)
    }
    settimer(() => tooltip(), -100)
}
;----------------------------------------------------------------------------
clockwork2() {
Global savetime:= ""
    saveposList:= [[1025, 1035], [1037, 1047], [1054, 1064], [1067, 1077], [1085, 1095], [1098, 1108]]
    saveposfact:= indexfactor*71
    if saveposfact > 497
        saveposfact:= 497
    saveposList1:= 324 + (saveposfact) - mod(indexfactor,2)
    saveposList2:= saveposlist1 + 17
    For each, savepos in saveposList {
        Loop 11 {
            digit := A_Index - 1
            image := "sfdigit-" digit hl
            if(ImageSearch(&x_savepos, &y_savepos, savepos[1], saveposList1, savepos[2], saveposList2, "*105 " image)) {
            if (digit = "10")
                digit := "0"
            Tooltip(digit, savepos[1], saveposList2+3)
            savetime:= savetime digit
            continue
            }
        }
    }
    settimer(() => tooltip(), -100)
}
;----------------------------------------------------------------------------
timecheck2() {
    global savetime
    saveposList:= [[1025, 1035], [1037, 1047], [1054, 1064], [1067, 1077], [1085, 1095], [1098, 1108]]
    loop 7 {
        savetime:= ""
        saveposfact:= indexfactor*71
        if saveposfact > 497
            saveposfact:= 497
        saveposList1:= 324 + (saveposfact) - mod(indexfactor,2)
        saveposList2:= saveposlist1 + 17
        For each, savepos in saveposList {
            forloopindex += 1
            Loop 11 {
                digit := A_Index - 1
				image :="sfdigit-" digit hl
                if(ImageSearch(&x_savepos, &y_savepos, savepos[1], saveposList1, savepos[2], saveposList2, "*105 " image)) {
                if (digit = "10")
                    digit := "0"
                Tooltip(".", savepos[1], saveposList2+3)
                global savetime:= savetime digit
                continue
                }
            }
        }
        MsgBox(A_Index ": " savetime)
    }
    settimer(() => tooltip(), -100)
}
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;keyf() {
;    key:= ""
;    if (GetKeyState(key, )) {
;        send "{" key " down}"
;        send "{" key " up}"
;    }
;}
;;----------------------------------------------------------------------------
;enter() {
;    key:= "enter"
;keyf()
;}
;;----------------------------------------------------------------------------
;lbutton() {
;    key:= "lbutton"
;keyf()
;}
;;----------------------------------------------------------------------------
;e() {
;    key:= "e"
;keyf()
;}
;;----------------------------------------------------------------------------
;esc() {
;    key:= "esc"
;keyf()
;}
;;----------------------------------------------------------------------------
;ww() {
;    key:= "w"
;keyf()
;}
;;----------------------------------------------------------------------------
;a() {
;    key:= "a"
;keyf()
;}
;;----------------------------------------------------------------------------
;s() {
;    key:= "s"
;keyf()
;}
;;----------------------------------------------------------------------------
;d() {
;    key:= "s"
;keyf()
;}
;;----------------------------------------------------------------------------
;up() {
;    key:= "up"
;keyf()
;}
;;----------------------------------------------------------------------------
;down() {
;    key:= "down"
;keyf()
;}
;;----------------------------------------------------------------------------
;ii() {
;    key:= "i"
;keyf()
;}
;;----------------------------------------------------------------------------
;r() {
;    key:= "r"
;keyf()
;}
;;----------------------------------------------------------------------------
;z() {
;    key:= "z"
;keyf()
;}
;;----------------------------------------------------------------------------
;q() {
;    key:= "q"
;keyf()
;}
;;----------------------------------------------------------------------------
;lcontrol() {
;    key:= "lcontrol"
;keyf()
;}
;;----------------------------------------------------------------------------
;lshift() {
;    key:= "lshift"
;keyf()
;}
;;----------------------------------------------------------------------------
;keyup() {
;;    send "{lbutton up}{esc up}{w up}{a up}{s up}{d up}{e up}{r up}{enter up}{up up}{down up}{i up}{z up}{q up}"
;lbutton
;esc
;ww
;a
;s
;d
;e
;r
;enter
;up
;down
;ii
;z
;q
;lcontrol
;lshift
;}
If you like this code please support the people of the world and the less favored with a personal donation.
Thank you.
*edit use this code do not use the file

Post Reply

Return to “Gaming”