[Request] Nostale Online Scripts -UPDATED-
Posted: Wed Apr 23, 2008 7:29 am
I have been using the very very old version of minimacro for a month now and today I saw that there is a new version which allows me to perform much more complex tasks. Most of the code I saw for the PW script confused me .. so I'm still in the process of learning how to use minimacro to its full potential. Anyway, while I'm learning how to write my own script I would like to see what others come up with. So here goes.
The script might include:
Attacking monsters (if possible only attack certain monster)
Using potions when HP falls below 30%
Using potions when MP falls below 30%
Picking up items (being able to move to the item and pick it up)
Resting(sitting down) if HP is more than 30% and monster is dead
Using potions on Pets and Partners when HP falls below 30%
Respond when name is used by other player
Drop unwanted/useless items.
Hehe since Nostale(Global) was just released on April 1st for OB so not many hackers have hit it yet. So good luck to me and I hope that I can get a few examples of scripts too! Thanks in advance!
There are also a few bits of the script which I dont understand how they work
they are:
EDIT: one more thingy...how do I write the script so that I can still bot while the main game window is minimized( so I can do other stuff while I'm botting ) Thx =P
The script might include:
Attacking monsters (if possible only attack certain monster)
Using potions when HP falls below 30%
Using potions when MP falls below 30%
Picking up items (being able to move to the item and pick it up)
Resting(sitting down) if HP is more than 30% and monster is dead
Using potions on Pets and Partners when HP falls below 30%
Respond when name is used by other player
Drop unwanted/useless items.
Hehe since Nostale(Global) was just released on April 1st for OB so not many hackers have hit it yet. So good luck to me and I hope that I can get a few examples of scripts too! Thanks in advance!
This is the script i have come up with so far...I copied and edited parts from a fiesta bot script by elverion. I still have not tested the script because I am still lacking the target monster bit. I attached a photo of how the screen would look like when a monster is targeted can anyone teach me how to set the bot to target the monster?---------------------------------------------------------------------------------------------------
--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;
--partnerHP_addr = "177D2215"; --rhain
-------------------------------------------------------------------------------------------------------
--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
--updates variables from client
function update_var()
HP = memoryRead(proc, HP_addr);
HPmax = memoryRead(proc, HPmax_addr);
MP = memoryRead(proc, MP_addr);
MPmax = memoryRead(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
--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(have_target()) 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
-----------------------------------------------------------------------------------------------------------------
--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_vars", 100, update_vars);
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( have_target() ) then
can_rest = fasle;
bot_fight(); end
can_rest = true;
end
pickup();
end
detach();
closeProcess(proc);
end
StartMacro(main)
There are also a few bits of the script which I dont understand how they work
they are:
andif( math.random(100) > 92 ) then
if( math.random(100) >= 50 ) then <<what do these do?
keyboardHold(key_skill1);
yrest(50);
keyboardRelease(key_skill1);
else
keyboardHold(key_skill2);
yrest(50);
keyboardRelease(key_skill2);
end
end
andfor i = 0,8 do<<and this?
pickup();
yrest(50);
end
Sorry that I ask so many questions! Can someone please check my script and corrrect me at the places I have done wrong? Thank you!function have_target()
local r,g,b = getPixel(hdc, 540, 1); < this part
if( r >= 229 and r <= 240 and g >= 245 and g <= 255 and b >= 250 ) then<and this part
return true;
else
return false;
end
end
EDIT: one more thingy...how do I write the script so that I can still bot while the main game window is minimized( so I can do other stuff while I'm botting ) Thx =P