About the script
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
About the script
I put the script on the micromacro-->script and name it Nostale.lua
after that i open the Micromacro then i put Nostale.lua then it said theres no file in that name..
i put the scipt in file document...like notepad..
Theres something wrong?
after that i open the Micromacro then i put Nostale.lua then it said theres no file in that name..
i put the scipt in file document...like notepad..
Theres something wrong?
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
When you saved the file, you probably left the file type as "Text file", so it saved it as Nostale.lua.txt. Enable the showing of file extensions and check that. I have no idea what was going through the heads of the people at Microsoft when they thought not showing file extensions was a good idea.
Re: About the script
U and I both, I think it made a generation of Computers users not understand what a file extension is. :OAdministrator wrote:When you saved the file, you probably left the file type as "Text file", so it saved it as Nostale.lua.txt. Enable the showing of file extensions and check that. I have no idea what was going through the heads of the people at Microsoft when they thought not showing file extensions was a good idea.
Re: About the script
What i'm gonna do now?
I save my file Nostale.lua.txt.
but its error..it cannot find..
I save my file Nostale.lua.txt.
but its error..it cannot find..
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
No. You misunderstood. You are supposed to save it as Nostale.lua, but you DID save it as Nostale.lua.txt. When you go to save it (I'm assuming you're using Notepad), change the "Save as type:" to "All files", and put "Nostale.lua" into the File Name field.
Re: About the script
Sir i do the All files and Nostale.lua then save then if i type Nostale.lua in micromacro theres no file in that name..
I don't have a Notepad i only have Text Document..
I don't have a Notepad i only have Text Document..
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
And Nostale.lua is inside "scripts" inside the "micromacro" folder?
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
Sounds pretty strange to me. Attach the Nostale.lua file and your log.txt for inspection.
Re: About the script
Nostale.lua
Log.txt
Sun Apr 19 01:11:42 2009 : MicroMacro v0.99
Sun Apr 19 01:11:42 2009 : Processor Type: 586, OS: Windows XP Service Pack 2
Sun Apr 19 01:11:42 2009 : Lua initialized successfully.
Sun Apr 19 01:11:42 2009 : Lua libs opened successfully.
Sun Apr 19 01:11:42 2009 : LuaCoco is available.
Sun Apr 19 01:11:42 2009 : Lua glues exported.
Sun Apr 19 01:11:42 2009 : Keyboard layout: US English
Sun Apr 19 01:11:42 2009 : Configurations run.
Sun Apr 19 01:11:48 2009 : Executing script "Nostale.lua".
==================================================
Sun Apr 19 01:11:48 2009 : ...d Settings\MUEGA LINK\Desktop\micromacro\lib\lib.lua:335: Timer not found: 'fight_timer'
Sun Apr 19 01:11:48 2009 : Execution of Nostale.lua complete.
Sun Apr 19 01:11:48 2009 : Execution error: Runtime error
Sun Apr 19 01:11:48 2009 : Collecting garbage...
Sun Apr 19 01:11:48 2009 : 47KB freed.
Code: Select all
---------------------------------------------------------------------------------------------------
--SETTINGS
---------------------------------------------------------------------------------------------------
HP_potion = 500;
MP_potion = 50;
HP_restatm = 1000;
MP_restatm = 300;
key_attack = key.VK_SPACE;
key_pickup = key.VK_TILDE;
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;
char_Ptr = 0x00784D70;
HP_Ptr_offset = 0xAC;
curHP_offset = 0x4C;
maxHP_offset = 0x48;
MP_Ptr_offset = 0xB0;
curMP_offset = 0x4C;
maxMP_offset = 0x48;
char_target = 0x00784D70;
target_Ptr_offset = 0xBC;
target_offset = 0x18;
HP_Ptr = 0;
MP_Ptr = 0;
target_Ptr = 0;
HP = 0;
HPmax = 0;
MP = 0;
MPmax = 0;
target = 0;
-------------------------------------------------------------------------------------------------------
--FUNCTIONS
-------------------------------------------------------------------------------------------------------
--pickup items
function pickup()
keyboardPress(key.VK_TILDE);
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( target == 1 ) then
return true;
else
return false;
end
end
--updates variables from client
function update_var()
HP_Ptr = memoryReadIntPtr(proc, char_Ptr, HP_Ptr_offset);
HP = memoryReadInt( proc , HP_Ptr + curHP_offset);
HPmax = memoryReadInt(proc, HP_Ptr + maxHP_offset);
MP_Ptr = memoryReadIntPtr(proc, char_Ptr, MP_Ptr_offset);
MP = memoryReadInt(proc, MP_Ptr + curMP_offset);
MPmax = memoryReadInt(proc, MP_Ptr + maxMP_offset);
target_Ptr = memoryReadIntPtr(proc, char_target, target_Ptr_offset);
target = memoryReadInt(proc, target_Ptr + target_offset);
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 MP == MPmax ) then
buff();
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_6);
yrest(1000);
end
--use mp potion
function mp_potion()
keyboardPress(key.VK_7)
yrest(1000);
end
--bot fight
function bot_fight()
registerTimer("fight_timer", 3000, fight_timer);
if( HP < HP_potion) then hp_potion(); end
if( MP < MP_potion) then mp_potion(); end
if( target == 1 ) then
keyboardPress(key.VK_2);
yrest(200);
keyboardPress(key.VK_3);
yrest(200);
keyboardPress(key.VK_SPACE);
end
if( math.random(100) > 60 ) then
keyboardPress(key.VK_4);
yrest(1000);end
end
unregisterTimer("fight_timer");
for i=0, 8 do
pickup();
yrest(50);
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
-- buff
function buff()
keyboardPress(key.VK_0);
yrest(1000);
keyboardPress(key.VK_9);
yrest(1000);
end
-----------------------------------------------------------------------------------------------------------------
--MAIN BOT FUNCTIONS
-----------------------------------------------------------------------------------------------------------------
function main()
win = findWindow("Nomad of Silver Spirit - 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( findProcessByExe("NostaleX.dat") );
attach(win);
setPriority(PRIORITY_HIGH);
registerTimer("update_var", 100, update_var);
while( true ) 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
if( HP > HP_restatm and can_rest == true ) then buff();end
yrest(100);
target_monster();
yrest(200);
if( target == 1 ) then
can_rest = fasle;
if( target == 1 ) then bot_fight();
while( target == 1 ) do
if( HP < HP_potion) then hp_potion(); end
if( MP < MP_potion) then mp_potion(); end
if( math.random(100) > 0 ) then
keyboardPress(key.VK_2);
yrest(200);
keyboardPress(key.VK_3);
yrest(200);
keyboardPress(key.VK_SPACE);
end
if( math.random(100) > 60 ) then
keyboardPress(key.VK_4);
yrest(1000);end
end
for i=0, 8 do
pickup();
yrest(50);
end
can_rest = false;
end
can_rest = true;
end
pickup();
end
detach();
closeProcess(proc);
end
startMacro(main);
Log.txt
Sun Apr 19 01:11:42 2009 : MicroMacro v0.99
Sun Apr 19 01:11:42 2009 : Processor Type: 586, OS: Windows XP Service Pack 2
Sun Apr 19 01:11:42 2009 : Lua initialized successfully.
Sun Apr 19 01:11:42 2009 : Lua libs opened successfully.
Sun Apr 19 01:11:42 2009 : LuaCoco is available.
Sun Apr 19 01:11:42 2009 : Lua glues exported.
Sun Apr 19 01:11:42 2009 : Keyboard layout: US English
Sun Apr 19 01:11:42 2009 : Configurations run.
Sun Apr 19 01:11:48 2009 : Executing script "Nostale.lua".
==================================================
Sun Apr 19 01:11:48 2009 : ...d Settings\MUEGA LINK\Desktop\micromacro\lib\lib.lua:335: Timer not found: 'fight_timer'
Sun Apr 19 01:11:48 2009 : Execution of Nostale.lua complete.
Sun Apr 19 01:11:48 2009 : Execution error: Runtime error
Sun Apr 19 01:11:48 2009 : Collecting garbage...
Sun Apr 19 01:11:48 2009 : 47KB freed.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
You're not properly closing one of your functions.
Actually, you're not closing that for loop, so the 'end' you have after it was intended to close the function, but is closing the for loop. Add an 'end' after that, and it should work.
Code: Select all
for i=0, 8 do
pickup();
yrest(50);
Re: About the script
Sir what im gonna do now?
im newbie in this script..
im newbie in this script..
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
I just told you exactly what to do. Add "end" after the code segment in my last reply.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: About the script
Saw the first bit of it where you comment the spacebar action out, probably because you thought it's the same as targetting nearby monsters?Administrator wrote:I just told you exactly what to do. Add "end" after the code segment in my last reply.
Anyway, he gotta remove the -- infront of it, or it won't attack.
Or replace everything with this:
Code: Select all
while (true) do
keyboardPress(key.VK_SPACE);
keyboardPress(key.VK_TILDE);
end
... It's quite not correct though lmao.
Re: About the script
@Sir Admin..
every function it have the end ..then im gonna put end again?
@3cmSailorfuku
What do you mean by that?I can't understand..
every function it have the end ..then im gonna put end again?
@3cmSailorfuku
What do you mean by that?I can't understand..
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
Look at this function:
See how you open the 'for' near the end, but do not have an 'end' after it? It's messing up the code. Change
To
Code: Select all
--bot fight
function bot_fight()
registerTimer("fight_timer", 3000, fight_timer);
if( HP < HP_potion) then hp_potion(); end
if( MP < MP_potion) then mp_potion(); end
if( target == 1 ) then
keyboardPress(key.VK_2);
yrest(200);
keyboardPress(key.VK_3);
yrest(200);
keyboardPress(key.VK_SPACE);
end
if( math.random(100) > 60 ) then
keyboardPress(key.VK_4);
yrest(1000);end
end
unregisterTimer("fight_timer");
for i=0, 8 do
pickup();
yrest(50);
can_rest = false;
-- registerTimer("can_rest_timer", 3000, can_rest_timer);
end
Code: Select all
for i=0, 8 do
pickup();
yrest(50);
Code: Select all
for i=0, 8 do
pickup();
yrest(50);
end
Re: About the script
i do that but it cannot find the file name..
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: About the script
It's not a file name. It's a timer name. It can't find it because many of your if statements are left open, which is placing functions inside if statements inside other functions, which means they cannot be found at global scope.
That whole script is a mess. Just start from scratch.
That whole script is a mess. Just start from scratch.
Re: About the script
What program can bot in nostale global?
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: About the script
Just go with something like this:ransuer wrote:What program can bot in nostale global?
Code: Select all
function main()
attach(findWindow("NosTale"));
while(true) do
keyboardPress(key.VK_SPACE);
keyboardPress(key.VK_2);
rest(300);
end
end
startMacro(main, true);
They all just bash on two buttons. Healing is unecessary anyway.
Because the script you've posted is probably lacking updated adresses anyway, which you won't understand, keeps you from doing more work.
@Elverion: Spacebar in NosTale does automatically select a monster that has been alive for the longest time and automatically attacks it.
So spacebar bashing is the way to go, lol.
Who is online
Users browsing this forum: No registered users and 2 guests