[Release] "Nomad of Silver Spirit - Nostale" script

You may request or share scripts for MicroMacro in this forum.
Post Reply
Message
Author
Mesosmagnet
Posts: 37
Joined: Wed Apr 23, 2008 7:11 am

[Release] "Nomad of Silver Spirit - Nostale" script

#1 Post by Mesosmagnet » Mon Jan 19, 2009 1:58 pm

Yeay finally my script works. Thanks to Elverion, 3cmsailorfuku and everyone else that helped me slowly solve the problems in my script. So here it is

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);
Just copy and paste into notepad > save as <anyname>.lua in your MicroMacro scripts folder > log in Nostale > start MicroMacro - open <anyname>.lua > click F5 > relax go listen to some music, go outdoors, or whatever it is you fancy while your character steadily levels up.

ps. This script is not perfect and it can be improved with
- chat function ( so GMs dont ban you )
- moving function ( to increase range of botting )
- specific job functions ( to properly utilize skills of each job )
- pet/partner HP check functions ( so that your partner/pet has maximum survivability )
- others that I cant really think of right now.

So if anyone knows how to create those functions and is willing to share I would be glad to learn from you =)

tcflying
Posts: 29
Joined: Thu Dec 18, 2008 12:07 pm

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#2 Post by tcflying » Mon Jan 19, 2009 5:52 pm

wow, congrts guys, . you clear the differentces between 2 read memory functions already :)

i have also improved my nostale bot. because this game can't buy potion in shop. so i give up the potion function. and just use sit to instead. within some hours test it work quite well will release it too from this i learn more

andeux
Posts: 4
Joined: Tue Jun 02, 2009 5:07 am
Location: PH
Contact:

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#3 Post by andeux » Tue Jun 02, 2009 5:14 am

hi can anyone help me pls pls pls
Attachments
got this msg error
got this msg error

vvayinsane
Posts: 148
Joined: Fri Mar 21, 2008 9:10 pm

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#4 Post by vvayinsane » Wed Jun 03, 2009 3:10 am

Have you tried doing it on a fresh copy of micromacrol?

andeux
Posts: 4
Joined: Tue Jun 02, 2009 5:07 am
Location: PH
Contact:

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#5 Post by andeux » Wed Jun 03, 2009 4:47 am

yes... using 0.99?
fresh download from soalarstrike.net download area

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#6 Post by Administrator » Wed Jun 03, 2009 10:06 am

Try using the 1.0 beta from the 'Announcements' area in these forums.

andeux
Posts: 4
Joined: Tue Jun 02, 2009 5:07 am
Location: PH
Contact:

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#7 Post by andeux » Wed Jun 03, 2009 10:15 am

tnx admin...
it runs but still got error hmm..
Attachments
log.txt
(10.8 KiB) Downloaded 201 times

vvayinsane
Posts: 148
Joined: Fri Mar 21, 2008 9:10 pm

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#8 Post by vvayinsane » Wed Jun 03, 2009 7:37 pm

ok i see your problem. Mesosmagnet posted the bot script like 6 months ago. Since then it might of had a few patches so the memory offsets for the game had change. Your going to need to update them.

andeux
Posts: 4
Joined: Tue Jun 02, 2009 5:07 am
Location: PH
Contact:

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#9 Post by andeux » Wed Jun 03, 2009 11:06 pm

please help me T_T
Attachments
log.txt
char_Ptr = 0x01433F75;
char_target = 0x01433F75;
(10.24 KiB) Downloaded 183 times

Mesosmagnet
Posts: 37
Joined: Wed Apr 23, 2008 7:11 am

Re: [Release] "Nomad of Silver Spirit - Nostale" script

#10 Post by Mesosmagnet » Fri Jun 05, 2009 12:22 pm

andeux,
I'm really sorry for not being able to help you update the addresses and pointers but if you learn, adn try it out yourself I'm sure it will be much more satisfying. For me, I really enjoyed writing scripts for some games. I have to admit I'm an amateur, and I have much to learn but everyone has got to start somewhere. And for that reason, you should take a look at this
http://www.solarstrike.net/phpBB3/viewt ... p?f=5&t=65
thread. If you follow it step by step you should be able to get the addresses and pointers quite easily. If you encounter any problems I'll try to be of assistance. good luck!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests