Argo Bot (Partially working)
Posted: Fri May 06, 2011 2:35 am
Updated (5/6/2011 - 2:44 PM CST):
Requires you to keep the window open and active. Doesn't work with the main action bar yet but the shift+action bar is working so use that for your pots. Also it loots which is nice.
Here is the bot.lua:
Yes, there is some stubbing (or just broken code) in there either not doing anything or commented out. When I work in more activity that'll change (namely using mem addresses instead of pixel scans).
Requires you to keep the window open and active. Doesn't work with the main action bar yet but the shift+action bar is working so use that for your pots. Also it loots which is nice.
Here is the bot.lua:
Code: Select all
include("addresses.lua");
setStartKey(key.VK_DELETE);
setStopKey(key.VK_END);
window = findWindow("ARGO")
function updateHP()
-- curHP = memoryReadIntPtr(myProcess, curHP_addr, curHP_offset);
-- maxHP = memoryReadIntPtr(myProcess, maxHP_addr, maxHP_offset);
-- tarHP = memoryReadIntPtr(myProcess, maxHP_addr, maxHP_offset);
end
function findTarget()
print( "Finding a target." )
targetSearch = true
hdc = openDC( window )
rSC,gSC,bSC = getPixel(hdc, 170, 641);
closeDC(hdc)
if ( rSC == 39 ) then
keyboardHold( key.VK_SHIFT )
yrest(50)
keyboardHold( key.VK_7 )
yrest(100)
keyboardRelease( key.VK_7 )
keyboardRelease( key.VK_SHIFT )
yrest(30000)
end
keyboardHold( key.VK_Q )
yrest(100)
while targetSearch do
keyboardHold( key.VK_TAB )
yrest(100)
keyboardRelease( key.VK_TAB )
if ( isTarget() ) then
targetSearch = false
end
end
keyboardRelease( key.VK_Q )
return true
end
function isTarget()
print( "Checking if there's a target." )
hdc = openDC( window )
rTF,gTF,bTF = getPixel(hdc, 391, 24);
closeDC(hdc)
if ( rTF == 165 and gTF == 50 and bTF == 65 ) then
return true
else
return false
end
end
function potUpdate()
print( "Checking HP, MP, and Core." )
hdc = openDC( window )
rHP,gHP,bHP = getPixel(hdc, 243, 641);
rMP,gMP,bMP = getPixel(hdc, 243, 656);
rCP,gCP,bCP = getPixel(hdc, 769, 630);
closeDC(hdc)
if ( rHP == 39 ) then
keyboardHold( key.VK_SHIFT )
yrest(50)
keyboardHold( key.VK_2 )
yrest(100)
keyboardRelease( key.VK_2 )
keyboardRelease( key.VK_SHIFT )
yrest(500)
end
if ( bMP == 39 ) then
keyboardHold( key.VK_SHIFT )
yrest(50)
keyboardHold( key.VK_3 )
yrest(100)
keyboardRelease( key.VK_3 )
keyboardRelease( key.VK_SHIFT )
yrest(500)
end
if ( gCP == 5 ) then
keyboardHold( key.VK_SHIFT )
yrest(50)
keyboardHold( key.VK_6 )
yrest(100)
keyboardRelease( key.VK_6 )
keyboardRelease( key.VK_SHIFT )
yrest(500)
end
end
function fightMonster()
print( "Fighting Monster!" )
while isTarget() do
potUpdate();
keyboardPress( key.VK_TILDE )
yrest(500);
keyboardPress( key.VK_1 )
keyboardHold( key.VK_1 )
yrest(100)
keyboardRelease( key.VK_1 )
yrest(500);
keyboardPress( key.VK_2 )
keyboardHold( key.VK_2 )
yrest(100)
keyboardRelease( key.VK_2)
yrest(500);
keyboardPress( key.VK_3 )
keyboardHold( key.VK_3 )
yrest(100)
keyboardRelease( key.VK_3 )
yrest(500);
keyboardPress( key.VK_4 )
keyboardHold( key.VK_4 )
yrest(100)
keyboardRelease( key.VK_4 )
yrest(500);
keyboardPress( key.VK_5 )
keyboardHold( key.VK_5 )
yrest(100)
keyboardRelease( key.VK_5 )
yrest(500);
end
end
function main()
-- attach( window )
-- number = getAttachedHwnd()
-- print( "Your window number is " .. number .. "\n")
print("This is my new Argo bot!")
--print("Pressing End will pause the bot and Delete will resume.\nPress Delete to continue.")
-- attachKeyboard(window)
-- weTestVks = true
-- while weTestVks do
-- keyboardPress( key.VK_TILDE )
-- yrest(500);
-- keyboardPress( key.VK_1 )
-- yrest(500);
-- keyboardPress( key.VK_2 )
-- yrest(500);
-- keyboardPress( key.VK_3 )
-- yrest(500);
-- keyboardPress( key.VK_4 )
-- yrest(500);
-- end
if ( not isTarget() ) then
findTarget()
end
weBegin = true
while weBegin do
print( "We Begin." )
fightMonster()
findTarget()
end
end
startMacro(main)