Re: Shaiya fighter version 2
Posted: Mon Oct 06, 2008 12:53 am
anybody have the updated version of this script?i love this script
still no update?vvayinsane wrote:Im not sure how to fix that but i have found a way around it. Make sure all the mobs you are attacking are in front of you. The bot will work just fine. The only problem is once you scan and the screen starts to turn trying to find a kill that is when the problem starts. I know i got killed many times already.
I tried changing the scanmonsters, changed the time when it hits the attack key. I have yet to find a solution to that problem
No. Not at the current time. This is just due to the way Shaiya works.also i run multiple clients onthe same pc .. is their a way to run a bot with out being the current displayed window ??
Not on this bot, it seems. Zero is working hard on his next version of the bot which should be incredible. If you haven't checked it out yet, go ahead and read up on it now.still no update?
i did check it out but i have no idea how to run it ..i have no background on programing..i just find fighterv2,fighter and ur shaiya lua easier to use..i just need the anti ks feature and the 2nd row of hot keys for the HP pots working..i made this work for a while but after half an hour or so that sitting/standing up glitch comes out ..my son is trying zeros bot atm..i hope he can make it runelverion wrote:No. Not at the current time. This is just due to the way Shaiya works.also i run multiple clients onthe same pc .. is their a way to run a bot with out being the current displayed window ??
Not on this bot, it seems. Zero is working hard on his next version of the bot which should be incredible. If you haven't checked it out yet, go ahead and read up on it now.still no update?
yes = 1;
no = 0;
macro_running = true;
--------------------------------------------------
-- Don't touch the above code
--------------------------------------------------
--------------------------------------------------
-- Modify your Fighter's Setting
--------------------------------------------------
how_many_scanTarget = 4; --how many target you want to scan for Full HP mobs. Default is 4
how_many_seconds = 15; --how many seconds you want to keep targeting the mob before the hp is damaged. Default 15
how_many_pickup = 4; --how many pickups after mob dies. Default is 4
--------------------------------------------------
-- Modify what color Mob you want to kill
-- EX: min=4 max =4 kill green mob only
--------------------------------------------------
target_difficulty_color_min= 4;
target_difficulty_color_max= 5;
--white = 1
--cyan = 2
--blue = 3
--green = 4
--yellow = 5
--orange = 6
--red = 7
--purple = 8
--grey = 9
-------------------------------------------------
-- Modify the Fighter's Skills information
-- If you enter No, the skill will switch between
-- skill 1 and skill 2 for each mob
-- EX: mob 1 skill 1 next Mob will use skill 2
-------------------------------------------------
-- Enter no if you don't want to use Skill.
-- Skill 1 = hot key 3
-- Skill 2 = hot key 4
Use_both_skill = yes; --put No or Yes to use both skills Hotkey 3 and 4
skill1_reuse_time = yes;
skill2_reuse_time = yes;
-------------------------------------------------
-- Enter the recharge Time and MP it needed to buff
-------------------------------------------------
-- Enter 0 if you don't want to buff.
-- Buff 1 = hot key 5
-- Buff 2 = hot key 6
-- buff 3 = hot key 7
-- Set MP = 1 if you are lazy to check(it wont be accurate)
buff1_reuse_time = 4; -- measured by minutes
buff1_MP = 1;
buff2_reuse_time = 4; -- measured by minutes
buff2_MP = 1;
buff3_reuse_time = 9; -- measured by minutes
buff3_MP = 55;
------------------------------------------------
-- How many seconds do you want your fighter to
-- Pause before searching the next target
------------------------------------------------
-- Enter 0 if you just want him to kill without
-- resting.
char_pausing = 0;
------------------------------------------------
-- POTIONS
------------------------------------------------
-- All potion use values are specified in %
-- Set the values to 0 to not use that potion
HP_potion_use = 50;
MP_potion_use = 50;
SP_potion_use = 25;
------------------------------------------------
-- SITTING
------------------------------------------------
-- All sitting values are specified in %
-- We will only sit while out of battle
-- Set the values to 0 to not use sitting
HP_sit = 30;
MP_sit = 0;
SP_sit = 0;
--[[*********************************************************************
**************************************************************************
DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
**************************************************************************
************************************************************************]]
------------------------------------------------
-- HOTKEYS & Variables
------------------------------------------------
message = "too far away from an opponent";
hitFlag = 0;
startKey = key.VK_INSERT;
stopKey = key.VK_DELETE;
key_switchtarget = key.VK_TILDE;
key_attack = key.VK_1;
key_pickup = key.VK_2;
key_skill1 = key.VK_3;
key_skill2 = key.VK_4;
key_buff1 = key.VK_5;
key_buff2 = key.VK_6;
key_buff3 = key.VK_7;
key_hp_potion = key.VK_8;
key_hp_potion1 = key.VK_NUMPAD1;
key_hp_potion2 = key.VK_NUMPAD2;
key_hp_potion3 = key.VK_NUMPAD3;
key_hp_potion4 = key.VK_NUMPAD4;
key_hp_potion5 = key.VK_NUMPAD5;
key_hp_potion6 = key.VK_NUMPAD6;
key_hp_potion7 = key.VK_NUMPAD7;
key_hp_potion8 = key.VK_NUMPAD8;
key_hp_potion9 = key.VK_NUMPAD9;
key_hp_potion0 = key.VK_NUMPAD0;
key_mp_potion = key.VK_9;
key_sp_potion = key.VK_0;
key_sit = key.VK_C;
key_move_down = key.VK_S;
key_move_right= key.VK_E;
key_myself = key.VK_F1;
key_jump = key.VK_SPACE;
key_home = key.VK_HOME;
key_right = key.VK_RIGHT;
do_jump = 0;
skill_switch = 1;
continue = 0;
attackHit = false;
------------------------------------------------
-- Memory addresses
------------------------------------------------
text1 = 0x00641608;
text2 = 0x00541E08;
text3 = 0x00642208;
text4 = 0x00652608;
text5 = 0x00641A08;
playerptr_addr = 0x0081CBEC;
HP_offset = 300;
MaxHP_offset = 304;
MP_offset = 308;
MaxMP_offset = 312;
SP_offset = 316;
MaxSP_offset = 320;
targetid_addr = 0x0062FAD4; -- short, 65535 if none selected
-- REMOVED -- targettype_addr = 0x00619B1F; -- byte, 0 = player/NPC, 7 = monster
sitcheck_addr = 0x00643648; -- byte, 0 = standing, 7 = sitting
--memoryWriteBytePtr(proc, playerptr_addr, 608, 521); -- speed hack
--memoryWriteBytePtr(proc, playerptr_addr, 609, 5); -- running hack
--------------------------------------------------------------------------
-- Mathematic calculations
--------------------------------------------------------------------------
skill3Total = buff1_reuse_time * 60;
skill4Total = buff2_reuse_time * 60;
skill5Total = buff3_reuse_time * 60;
skill1_beginTime = os.time();
skill2_beginTime = os.time();
skill3_beginTime = os.time();
skill4_beginTime = os.time();
skill5_beginTime = os.time();
pause = char_pausing * 1000;
---------------------------------------------------------------------------
-- Various Functions
---------------------------------------------------------------------------
function init_window()
win = findWindow("Shaiya");
if(win == nil) then
printf(error_init);
macro_running = false;
end
end
function init_process()
proc = openProcess( findProcessByExe("game.exe") );
if(proc == 0) then
printf("error opening process.\n");
macro_running = false;
end
end
function init_hdc()
hdc = openDC(get_win());
local wx, wy, ww, wh = windowRect(get_win());
end
function get_hdc()
return hdc;
end
function get_win()
return win;
end
function debug_message(msg)
if (g_debug) then
print(msg);
logMessage(msg);
end
end
window_mode = false;
g_debug = true;
function target()
keyboardPress(key_switchtarget);
yrest(200);
end
function moveBreak()
keyboardHold(key_move_right);
yrest(100);
keyboardRelease(key_move_right);
end
function moveBack()
keyboardHold(key_move_down);
yrest(1000);
keyboardRelease(key_move_down);
end
function pickup()
printf("Pickup!\n");
if( how_many_pickup == 0 ) then
return;
end
local i;
for i = 1, how_many_pickup do
keyboardPress(key_pickup);
yrest(700);
end
end
--------------------------------------------------------------------------------
-- Skills & Buffing Functions
--------------------------------------------------------------------------------
function skill3()
if(skill1_reuse_time == 0) then
else
skill_switch = 2;
keyboardPress(key_skill1);
yrest(2000);
end
end
function skill4()
if(skill2_reuse_time == 0) then
else
skill_switch = 1;
keyboardPress(key_skill2);
yrest(2000);
end
end
function skill5()
if(buff5_reuse_time == 0) then
return;
end
local startTime = os.time();
if( os.difftime(startTime, skill3_beginTime) > skill3Total and MP >=buff1_MP) then
skill3_beginTime = os.time();
keyboardPress(key_buff1);
yrest(2000);
end
end
function skill6()
if(buff6_reuse_time == 0) then
return;
end
local startTime = os.time();
if( os.difftime(startTime, skill4_beginTime) > skill4Total and MP >= buff2_MP) then
skill4_beginTime = os.time();
keyboardPress(key_buff2);
yrest(2000);
end
end
function skill7()
if(buff7_reuse_time == 0) then
return;
end
local startTime = os.time();
if( os.difftime(startTime, skill5_beginTime) > skill5Total and MP >=buff3_MP) then
skill5_beginTime = os.time();
keyboardPress(key_buff3);
yrest(2000);
end
end
--------------------------------------------------------------------------------
-- Detects if You have target with full/damaged hp and
-- what color mob you have on target.
-- **************************************************
-- ***This has been done and program by ZeroSignal***
-- **************************************************
--------------------------------------------------------------------------------
TARGET_UNKNOWN = 0;
TARGET_DAMAGED = 1;
TARGET_FULL = 2;
TARGET_DEAD = 3;
DAMAGED_MOB1 = 0;
TARGET_BAR_COLOR = {
r_min=150, r_max=183,
g_min=10, g_max=75,
b_min=50, b_max=107
};
TARGET_HEALTH_BAR_PIXEL_OFFSET_1 = {x=36, y=36};
TARGET_HEALTH_BAR_PIXEL_OFFSET_2 = {x=165, y=36};
TARGET_HEALTH_BAR_PIXEL_OFFSET_3 = {x=100, y=36};
TARGET_NAME_COLOR_SCAN_OFFSET_1 = {x=98, y=15};
TARGET_NAME_COLOR_SCAN_OFFSET_2 = {x=110, y=15};
target_name_color = {
unknown=0,
white=1,
cyan=2,
blue=3,
green=4,
yellow=5,
orange=6,
red=7,
purple=8,
grey=9,
};
-- In order of difficulty, from easiest to hardest.
target_name_color_rgb = {
[target_name_color["white"]] = {r_min=255, r_max=255,
g_min=255, g_max=255,
b_min=255, b_max=255},
[target_name_color["cyan"]] = {r_min=120, r_max=140,
g_min=255, g_max=255,
b_min=255, b_max=255},
[target_name_color["blue"]] = {r_min=0, r_max=0,
g_min=0, g_max=0,
b_min=253, b_max=255},
[target_name_color["green"]] = {r_min=0, r_max=0,
g_min=1, g_max=255,
b_min=0, b_max=0},
[target_name_color["yellow"]] = {r_min=253, r_max=255,
g_min=253, g_max=255,
b_min=0, b_max=0},
[target_name_color["orange"]] = {r_min=252, r_max=255,
g_min=126, g_max=130,
b_min=0, b_max=0},
[target_name_color["red"]] = {r_min=255, r_max=255,
g_min=0, g_max=0,
b_min=0, b_max=0},
[target_name_color["purple"]] = {r_min=255, r_max=255,
g_min=0, g_max=0,
b_min=255, b_max=255},
--[target_name_color["grey"]] = {r_min=255, r_max=255,
-- g_min=255, g_max=255,
-- b_min=255, b_max=255},
}
STATUSINFOBAR_POS = {x=0, y=0};
-- Looks at pixels in the status info bar in the h/w device context,
-- to determine the status of the monster.
-- note - this has known errors, changing the color bit value, or restarting PC
-- seems to fix it.
-- @return TARGET_UNKNOWN does not have any detectable red bar.
-- TARGET_DAMAGED if some red bar exists.
-- TARGET_FULL full red bar.
function status()
local pos_1 = {x=(STATUSINFOBAR_POS["x"] + TARGET_HEALTH_BAR_PIXEL_OFFSET_1["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_HEALTH_BAR_PIXEL_OFFSET_1["y"])};
local pos_2 = {x=(STATUSINFOBAR_POS["x"] + TARGET_HEALTH_BAR_PIXEL_OFFSET_2["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_HEALTH_BAR_PIXEL_OFFSET_2["y"])};
--printf("x1:%d y1:%d x2:%d y2:%d\n", pos_1["x"], pos_1["y"], pos_2["x"], pos_2["y"]);
local l_hdc = get_hdc();
-- s(RGB) begining E(RGB) end M(RGB) middle;
local sr,sg,sb;
local er,eg,eb;
if (window_mode) then
local wx, wy = windowRect(get_win());
--debug_message(sprintf("win_x: %d, wim_y: %d\n", wx, wy));
sr,sg,sb = getPixel(l_hdc, pos_1["x"], pos_1["y"]);
er,eg,eb = getPixel(l_hdc, pos_2["x"], pos_2["y"]);
else
sr,sg,sb = getPixel(l_hdc, pos_1["x"], pos_1["y"]);
er,eg,eb = getPixel(l_hdc, pos_2["x"], pos_2["y"]);
end
--closeDC(hdc);
--debug_message(sprintf("sr: %d, sg: %d, sb: %d", sr, sg, sb));
debug_message(sprintf("er: %d, eg: %d, eb: %d", er, eg, eb));
if((er >= TARGET_BAR_COLOR["r_min"] and
er <= TARGET_BAR_COLOR["r_max"]) and
(eg >= TARGET_BAR_COLOR["g_min"] and
eg <= TARGET_BAR_COLOR["g_max"]) and
(eb >= TARGET_BAR_COLOR["b_min"] and
eb <= TARGET_BAR_COLOR["b_max"]))
then
printf("CHECK TARGET RETURNED: FULL\n");
return TARGET_FULL;
else
printf("CHECK TARGET RETURNED: DAMAGED\n");
return TARGET_DAMAGED;
end
end
-- Gets the monster difficulty color, by reading each pixel in a small fixed
-- line in the middle through the top of the lower case letters,
-- in the monster name label.
-- @return The color index of the name text on success, 0 on failure.
function get_difficulty_color()
local pos_1 = {x=(STATUSINFOBAR_POS["x"] + TARGET_NAME_COLOR_SCAN_OFFSET_1["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_NAME_COLOR_SCAN_OFFSET_1["y"])};
local pos_2 = {x=(STATUSINFOBAR_POS["x"] + TARGET_NAME_COLOR_SCAN_OFFSET_2["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_NAME_COLOR_SCAN_OFFSET_2["y"])};
local pr, pg, pb;
--local l_color = TARGET_NAME_COLOR_UNKNOWN;
--local hdc = openDC(shaiya_win);
local l_hdc = get_hdc();
for i=pos_1["x"], pos_2["x"] do
for j=pos_1["y"], pos_2["y"] do
if (window_mode) then
local wx, wy = windowRect(get_win());
--printf("win_x: %d, wim_y: %d\n", wx, wy);
pr, pg, pb = getPixel(l_hdc, wx + i, wy + j);
else
pr, pg, pb = getPixel(l_hdc, i, j);
end
--debug_message(sprintf("pr: %d, pg: %d, pb: %d", pr, pg, pb));
for k,v in pairs(target_name_color_rgb) do
--printf("v[r]: %d, v[g]: %d, v: %d\n", v["r"], v["g"], v["b"]);
if(pr >= v["r_min"] and pr <= v["r_max"] and
pg >= v["g_min"] and pg <= v["g_max"] and
pb >= v["b_min"] and pb <= v["b_max"]) then
printf("target_difficulty_color: %s\n", k);
return k;
end
end
end
end
--closeDC(hdc);
return target_name_color["unknown"];
end
----------------------------------------------------------------------------------
-- Function Detects if the HP is FULL HP else returns TARGET_DEAD
----------------------------------------------------------------------------------
function targetstatus2()
local pos_1 = {x=(STATUSINFOBAR_POS["x"] + TARGET_NAME_COLOR_SCAN_OFFSET_1["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_NAME_COLOR_SCAN_OFFSET_1["y"])};
local pos_2 = {x=(STATUSINFOBAR_POS["x"] + TARGET_NAME_COLOR_SCAN_OFFSET_2["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_NAME_COLOR_SCAN_OFFSET_2["y"])};
local pr, pg, pb;
--local l_color = TARGET_NAME_COLOR_UNKNOWN;
--local hdc = openDC(shaiya_win);
local l_hdc = get_hdc();
for i=pos_1["x"], pos_2["x"] do
for j=pos_1["y"], pos_2["y"] do
if (window_mode) then
local wx, wy = windowRect(get_win());
--printf("win_x: %d, wim_y: %d\n", wx, wy);
pr, pg, pb = getPixel(l_hdc, wx + i, wy + j);
else
pr, pg, pb = getPixel(l_hdc, i, j);
end
--debug_message(sprintf("pr: %d, pg: %d, pb: %d", pr, pg, pb));
for k,v in pairs(target_name_color_rgb) do
--printf("v[r]: %d, v[g]: %d, v: %d\n", v["r"], v["g"], v["b"]);
if(pr >= v["r_min"] and pr <= v["r_max"] and
pg >= v["g_min"] and pg <= v["g_max"] and
pb >= v["b_min"] and pb <= v["b_max"]) then
--printf("target_difficulty_color: %s\n", k);
return TARGET_FULL;
end
end
end
end
--closeDC(hdc);
return TARGET_DEAD;
end
-----------------------------------------------------------------------------------
-- Cycle Target to see if It matches your minimum and maximum color monster
-----------------------------------------------------------------------------------
function cycle_target()
target();
local target_status = status();
--printf("target_color: %d\n", target_color);
--printf("target_status=%d\n", target_status);
--logMessage(sprintf("target_status=%d", target_status));
if (target_status == TARGET_FULL) then
printf("TARGET CONFIRMED: FULL\n");
attackHit = false;
local l_color = get_difficulty_color();
local l_color_min = target_difficulty_color_min;
local l_color_max = target_difficulty_color_max;
--printf("target_color_min: %s\n", l_color_min);
--printf("target_color_max: %s\n", l_color_max);
--printf("getting difficulty Color \n");
--printf("l_color: %s\n", l_color);
if (l_color >= l_color_min and l_color <= l_color_max) then
return true;
end
end
return false;
end
------------------------------------------------
-- Variable setup
------------------------------------------------
HP = 10000;
MaxHP = HP;
MP = 10000;
MaxMP = MP;
SP = 10000;
MaxSP = SP;
------------------------------------------------
-- Other Functions
------------------------------------------------
function use_hp_potion()
keyboardPress(key_hp_potion);
keyboardPress(key_hp_potion1);
keyboardPress(key_hp_potion2);
keyboardPress(key_hp_potion3);
keyboardPress(key_hp_potion4);
keyboardPress(key_hp_potion5);
keyboardPress(key_hp_potion6);
keyboardPress(key_hp_potion7);
keyboardPress(key_hp_potion8);
keyboardPress(key_hp_potion9);
keyboardPress(key_hp_potion0);
printf("Using HP potion\n");
end
function use_mp_potion()
keyboardPress(key_mp_potion);
printf("Using MP potion\n");
end
function use_sp_potion()
keyboardPress(key_sp_potion);
printf("Using SP potion\n");
end
function sit()
if( HP_sit == 0 ) then
return;
end
printf("Sitting.\n");
local sitting = false;
while( sitting == false ) do
keyboardPress(key_sit);
yrest(1000);
sitting = memoryReadByte(proc, sitcheck_addr) ~= 0;
end
local lasthp = HP;
while( true ) do
if( HP == MaxHP and MP == MaxMP and SP == MaxSP ) then
break;
end
if( HP < (lasthp - 10) ) then
printf("Exiting rest...under attack\n");
break;
else
lasthp = HP;
end
yrest(100);
end
sitting = true;
while( sitting ) do
keyboardPress(key_sit);
yrest(1000);
sitting = memoryReadByte(proc, sitcheck_addr) ~= 0;
end
printf("Standing... Resuming bot\n");
yrest(1000);
end
function pickup2()
printf("Pickup!\n");
if( key_pickup == 0 ) then return; end
local i;
for i = 0, 5 do
keyboardPress(key_pickup);
yrest(500);
end
yrest(1000);
end
function update_vars()
HP = memoryReadIntPtr(proc, playerptr_addr, HP_offset);
MaxHP = memoryReadIntPtr(proc, playerptr_addr, MaxHP_offset);
MP = memoryReadIntPtr(proc, playerptr_addr, MP_offset);
MaxMP = memoryReadIntPtr(proc, playerptr_addr, MaxMP_offset);
SP = memoryReadIntPtr(proc, playerptr_addr, SP_offset);
MaxSP = memoryReadIntPtr(proc, playerptr_addr, MaxSP_offset);
damaged_mob = memoryReadBytePtr(proc, playerptr_addr, hitTarget_offset);
end
function have_target()
local readid = memoryReadShort(proc, targetid_addr);
return ( readid ~= 0xFFFF );
end
-----------------------------------------------------------------------------------------------============================
function checkingFullHP()
local pos_1 = {x=(STATUSINFOBAR_POS["x"] + TARGET_HEALTH_BAR_PIXEL_OFFSET_2["x"]),
y=(STATUSINFOBAR_POS["y"] + TARGET_HEALTH_BAR_PIXEL_OFFSET_2["y"])};
local l_hdc = get_hdc();
local sr,sg,sb;
if (window_mode) then
local wx, wy = windowRect(get_win());
sr,sg,sb = getPixel(l_hdc, (wx + pos_1["x"]), (wy + pos_1["y"]));
else
sr,sg,sb = getPixel(l_hdc, pos_1["x"], pos_1["y"]);
end
debug_message(sprintf("sr: %d, sg: %d, sb: %d", sr, sg, sb));
if ((sr >= TARGET_BAR_COLOR["r_min"] and
sr <= TARGET_BAR_COLOR["r_max"]) and
(sg >= TARGET_BAR_COLOR["g_min"] and
sg <= TARGET_BAR_COLOR["g_max"]) and
(sb >= TARGET_BAR_COLOR["b_min"] and
sb <= TARGET_BAR_COLOR["b_max"]))then
DAMAGED1_MOB = TARGET_FULL;
else
DAMAGED1_MOB = TARGET_DAMAGED;
end
end
function stop_Attacking()
if(damaged_mob == 1 or damaged_mob == 0) then
printf("TARGET IS HIT\n");
unregisterTimer("stop_Attacking");
attackHit = true;
end
end
-------------------------------------------------------
-- FIGHT 2
-------------------------------------------------------
function fight2()
local beginTime = os.time();
local attackTime = os.time();
local attackLoop = true;
local skillsonetime = 0;
local count = 0;
local xFlag = 0;
keyboardPress(key_attack);
printf("Attacking Target \n");
while (attackLoop) do
local targetStatus = targetstatus2();
local Tstatus = status();
if(targetStatus == TARGET_DEAD) then
printf("Target Dead \n\n");
moveBreak();
pickup();
attackLoop = false;
yrest(1000);
skill5();
skill6();
skill7();
else
local currentTime = os.time();
if( os.difftime(currentTime, beginTime) > how_many_seconds ) then
beginTime = os.time();
if (Tstatus == TARGET_FULL) then
yrest(3000);
local check_targets_hp = status();
if(check_targets_hp == TARGET_DAMAGED) then
printf("Target is damaged, continue killing \n");
else
moveBreak();
do_jump = do_jump+1;
printf("Changing Targets: Obsticle \n");
attackLoop = false;
end
end
else
if(DAMAGED1_MOB == TARGET_DAMAGED) then
if(count == 0) then
count = 1 + count;
unregisterTimer("checkingFullHP");
end
yrest(1000);
if(attackHit == false and hitFlag == 0) then
unregisterTimer("stop_Attacking");
moveBack();
continue = 0;
DAMAGED1_MOB = 2;
yrest(100);
hitFlag = 1;
attackLoop = false;
yrest(1000);
skill5();
skill6();
skill7();
printf("TARGET IS HIT BY OTHER PLAYER, SWITCH TARGET\n");
else
if(skillsonetime == 0) then
skillsonetime = 1+skillsonetime;
if(skill_switch == 1 or Use_both_skill == 1)then
skill3();
end
if(skill_swtich == 2 or Use_both_skill == 1) then
skill4();
end
else
local currentAttackTime = os.time();
if(os.difftime(currentAttackTime, attackTime) > 3) then
attackTime = os.time();
targetStatus = targetstatus2();
if(targetStatus == TARGET_FULL) then
keyboardPress(key_attack);
yrest(2000);
xFlag = 1;
end
end
end
end
end
if(xFlag == 1) then
xFlag = 0;
else
yrest(1000);
end
end
end
if( (HP/MaxHP*100) < HP_potion_use and HP_potion_use > 0 ) then use_hp_potion(); end
if( (MP/MaxMP*100) < MP_potion_use and MP_potion_use > 0 ) then use_mp_potion(); end
if( (SP/MaxSP*100) < SP_potion_use and SP_potion_use > 0 ) then use_sp_potion(); end
end
hitFlag = 0;
DAMAGED1_MOB = TARGET_FULL;
yrest(200);
end
------------------------------------------------
-- MAIN
------------------------------------------------
function main()
proc = openProcess(findProcessByExe("game.exe"));
win = findWindow("Shaiya");
attach(win);
setPriority(PRIORITY_HIGH);
init_window();
init_process();
init_hdc();
registerTimer("update_vars", 100, update_vars);
local reAttack = 0;
keyboardPress(key_buff1);
yrest(2000);
keyboardPress(key_buff2);
yrest(2000);
keyboardPress(key_buff3);
yrest(2000);
while( macro_running ) do
if(cycle_target() == true) then
yrest(300);
printf("ENGAGING\n");
registerTimer("checkingFullHP", 250, checkingFullHP);
registerTimer("stop_Attacking", 250, stop_Attacking);
fight2();
if(do_jump == 1) then
keyboardHold(key_move_down);
keyboardPress(key_jump);
yrest(1000);
keyboardPress(key_jump);
yrest(1000);
keyboardRelease(key_move_down);
keyboardHold(key_move_right);
yrest(2000);
keyboardRelease(key_move_right);
do_jump = 0;
else
keyboardPress(key_myself);
end
if(pause>0) then
yrest(pause);
end
reAttack = 0;
else
reAttack = 1 + reAttack;
end
if ( reAttack > how_many_scanTarget ) then
reAttack = 0;
keyboardPress(key_myself);
yrest(500);
keyboardHold(key_right);
yrest(500);
keyboardRelease(key_right);
end
if( (HP/MaxHP*100) < HP_potion_use and HP_potion_use > 0 ) then use_hp_potion(); end
if( (MP/MaxMP*100) < MP_potion_use and MP_potion_use > 0 ) then use_mp_potion(); end
if( (SP/MaxSP*100) < SP_potion_use and SP_potion_use > 0 ) then use_sp_potion(); end
if( (HP/MaxHP*100) < HP_sit and (HP_sit > 0) ) then sit(); end
if( (MP/MaxMP*100) < MP_sit and (MP_sit > 0) ) then sit(); end
if( (SP/MaxSP*100) < SP_sit and (SP_sit > 0) ) then sit(); end
if ((HP/MaxHP*100) <= 0) then
--user_alive = false;
printf("\n\nPlayer is DEAD");
keyboardPress(key.VK_DELETE);
--force_close();
end
end
end
startMacro(main);
yup the fighter.lua works ( buffs,attack,pick up ) but haved u notice the anti ks doesnt or just minevvayinsane wrote:I had windows xp on my laptop but it is broken and i was able to run fighter.lua just fine. Then i decited to play the game off of my windows server 2003 computer but the fighter.lua wont work. The bot is pressing the keys but nothing is working. All my character is stand around. I rank shaiya.lua and the bot works just fine. So i dont understand what the problem could be
Administrator wrote:Try this. It takes a bit of work to get it set up, but this should do the trick.