--------------------------------------------------------------------------------------------------- --SETTINGS --------------------------------------------------------------------------------------------------- HP_potion = 100; MP_potion = 50; HP_restatm = 150; MP_restatm = 100; key_attack = key.VK_SPACE; key_pickup = key.VK_X; key_skill1 = key.VK_1; keyskill2 = key.VK_2; keyskill3 = key.VK_3; key_hppotion = key.VK_4; key_mppotion = key.VK_5; ----------------------------------------------------------------------------------------------------- --ADDRESSES ----------------------------------------------------------------------------------------------------- proc = 0; win = 0; HP_addr = "022575EC"; HPmax_addr = "022575E8"; MP_addr = "02257664"; MPmax_addr = "02257660"; HP = 1000; HPmax = HP; MP = 1000; MPmax = MP; ------------------------------------------------------------------------------------------------------- --FUNCTIONS ------------------------------------------------------------------------------------------------------- --pickup items function pickup() keyboardPress(key.VK_X); end --select nearby monster function target_monster() keyboardPress(key.VK_SPACE); end --fight timer function fight_timer() keyboardPress(key.VK_SPACE); end --check if you have a target function have_target() if( 10 == 10 ) then return true; else return false; end end --updates variables from client function update_var() HP = memoryReadInt(proc, HP_addr); HPmax = memoryReadInt(proc, HPmax_addr); MP = memoryReadInt(proc, MP_addr); MPmax = memoryReadInt(proc, MPmax_addr); end -- toggle can_heal to true, disable timer function can_rest_timer() unregisterTimer("can_rest_timer"); can_rest = true; end --rest until healed function rest_heal() if( can_rest == false ) then return; end printf("Entering rest state\t%s\n", os.date("%X")); keyboardPress(key.VK_T); need_heal = true; last_hp = HP; while( need_heal ) do yrest(100); if( HP == HPmax and SP == SPmax ) then need_heal = false; end if( HP < last_hp ) then print("Under attack! Exiting rest."); can_rest = false; registerTimer("can_rest_timer", 3000, can_rest_timer); break; else last_hp = HP; end end end --use hp potion function hp_potion() keyboardPress(key.VK_4); end --use mp potion function mp_potion() keyboardPress(key.VK_5) end --bot fight function bot_fight() registerTimer("fight_timer", 3000, fight_timer); while(10 == 10) do if( HP < HP_potion) then hp_potion(); end if( MP < MP_potion) then mp_potion(); end if( math.random(100) > 50 ) then keyboardPress(key.VK_1); end end unregisterTimer("fight_timer"); for i = 0,8 do pickup() end can_rest = false; registerTimer("can_rest_timer", 3000, can_rest_timer); end --can_rest_timer function can_rest_timer() unregisterTimer("can_rest_timer"); can_rest = true; end ----------------------------------------------------------------------------------------------------------------- --MAIN BOT FUNCTIONS ----------------------------------------------------------------------------------------------------------------- function main() win = findWindow("Nostale"); local wx,wy,ww,wh = windowRect(win); if( win == 0 ) then printf("Error! Could not locate Nostale window!\n"); return; end; hdc = openDC(win); proc = openProcess( findProcess("Nostale") ); attach(win); registerTimer("update_var", 100, update_var); while( 1 ) do if( HP < HP_potion ) then hp_potion(); end if( MP < MP_potion ) then mp_potion(); end if( HP < HP_restatm and can_rest == true ) then rest_heal(); end if( MP < MP_restatm and can_rest == true ) then rest_heal(); end yrest(100); target_monster(); yrest(200); if( 10 == 10) then can_rest = fasle; if( 10 == 10 ) then bot_fight(); end can_rest = true; end pickup(); end detach(); closeProcess(proc); end startMacro(main);