local windowList = findWindowList("*","CrypticWindowClassDX1") if( #windowList == 0 ) then print("You need to run STO first!"); return 0; end function getWin() if( __WIN == nil ) then __WIN = windowList[1] end return __WIN; end function getProc() if __PROC == nil then if( __PROC ) then closeProcess(__PROC) end; __PROC = openProcess(findProcessByWindow(getWin())) end return __PROC; end function memoryReadRepeat(_type, proc, address, offset) local readfunc; local ptr = false; local val; if( type(proc) ~= "userdata" ) then error("Invalid proc", 2); end if( type(address) ~= "number" ) then error("Invalid address", 2); end if( _type == "int" ) then readfunc = memoryReadInt; elseif( _type == "uint" ) then readfunc = memoryReadUInt; elseif( _type == "float" ) then readfunc = memoryReadFloat; elseif( _type == "byte" ) then readfunc = memoryReadByte; elseif( _type == "string" ) then readfunc = memoryReadString; elseif( _type == "ustring" ) then readfunc = memoryReadUString; elseif( _type == "intptr" ) then readfunc = memoryReadIntPtr; ptr = true; elseif( _type == "uintptr" ) then readfunc = memoryReadUIntPtr; ptr = true; elseif( _type == "byteptr" ) then readfunc = memoryReadBytePtr; ptr = true; elseif( _type == "floatptr" ) then readfunc = memoryReadFloatPtr; ptr = true; else return nil; end for i = 1, 10 do showWarnings(false); if( ptr ) then val = readfunc(proc, address, offset); else val = readfunc(proc, address); end showWarnings(true); if( val ) then i = 11; end; -- Get out of loop end if( val == nil ) then local info = debug.getinfo(2); local name; if( info.name ) then name = info.name .. '()'; else name = ''; end local msg = sprintf("Error reading memory in %s from %s:%d", name, info.short_src, info.currentline or 0); error(msg, 2) end return val end setStartKey(key.VK_F5) setStopKey(key.VK_F6) local gamebase = getModuleAddress(findProcessByWindow(getWin()), "GameClient.exe") local proc = getProc() local startadd = memoryReadRepeat("uintptr",proc, gamebase + 0x24D88C0,{0x14,0x194,0x188}) --32bit --local startadd = memoryReadRepeat("uintptr",proc, gamebase + 0x25C6878,{0x34,0x18,0x38,0x648}) --64 bit startadd = startadd + 0xA0 printf("game base: 0x%x, start address: 0x%x\n",gamebase,startadd) showWindow(__WIN,1) repeat yrest(500) until memoryReadRepeat("int",proc,startadd + 0x4) ~= 0 function main() local function mine(_score) local stop = false local starttime = getTime() repeat repeat if memoryReadRepeat("float",proc,startadd + 0x10) > memoryReadRepeat("float",proc,startadd + 0x120 + 0x10) then keyboardPress(key.VK_DOWN) else keyboardPress(key.VK_UP) end yrest(50) local dist = memoryReadRepeat("float",proc,startadd + 0x10) - memoryReadRepeat("float",proc,startadd + 0x120 + 0x10) if 0 > dist then dist = 0-dist end until 0.4 > dist or deltaTime(getTime(),starttime) >= 59000 --print("size is ok") if memoryReadRepeat("int",proc,startadd + 0x200) == 0 then local turntime = getTime() repeat keyboardPress(key.VK_LEFT) yrest(20) until memoryReadRepeat("int",proc,startadd + 0x200) ~= 0 or deltaTime(getTime(),turntime) >= 1000 or deltaTime(getTime(),starttime) >= 59000 end --print("working well") repeat yrest(100) if memoryReadRepeat("intptr",proc, gamebase + 0x2468F58,{0x14,0x5B8,0x34,0x324,0x44}) > _score then keyboardPress(key.VK_ESCAPE) stop = true end until memoryReadRepeat("int",proc,startadd + 0x200) == 0 or deltaTime(getTime(),starttime) >= 59000 or stop until deltaTime(getTime(),starttime) >= 59000 or stop print("Score: "..memoryReadRepeat("intptr",proc, gamebase + 0x2468F58,{0x14,0x5B8,0x34,0x324,0x44})) end while(true) do keyboardBufferClear() if keyPressed(key.VK_CONTROL) and keyPressed(key.VK_Y) then mine(730) elseif keyPressed(key.VK_CONTROL) and keyPressed(key.VK_T) then mine(1430) end yrest(100) end end startMacro(main,true)