Page 1 of 1

Useful macros

Posted: Sun Aug 30, 2009 7:54 pm
by droppen
Here's a lot of useful macros, a lot of you don't even know that this is possible with a macro.

Use the worst healing potion you have. Please help me finish the list, and make a list for mana potions too

Code: Select all

/script UseItemByName("Simple First Aid Potion");
/script UseItemByName("Basic First Aid Potion");

With these 2, you don't need streamline addon to auto repair

When talking to NPC, this function brings up the screen where you can repair or buy.

Code: Select all

/script ChoiceOption(1);
This is a cool function too

Code: Select all

/script ClickRepairAllButton();

Okay then, lets see.. What else could you do while chatting with an NPC. Buy potions?
Well, first we need to make some space for them, if our inventory is full.
The number inside () is your bag slot. 1=first bag first slot.

Code: Select all

/script PickupBagItem(GetBagItemInfo(1)); 
/script DeleteCursorItem();
Pick it up, then delete from cursor.

Then, we might want to buy some potions.

Code: Select all

/script StoreBuyItem(1)
Buy 1 of the first item that the merchant has.


Therefore, we can do this

Code: Select all

/script local bag, icon, name, count = GetBagItemInfo(1) for i=1, 10, 1 do if GetStoreSellItemInfo(i) == icon then for a=98, count, -1 do StoreBuyItem(i) end end end
This macro buys a full stack of the item that you have on your first slot in your first bag. You need to have at least 1 Health Potion or Mana Potion on that slot to have it buy.



Imagine what we could do if we could edit macros with mircomacro.

Re: Useful macros

Posted: Sun Aug 30, 2009 8:43 pm
by Glopo
thanks

Re: Useful macros

Posted: Sun Aug 30, 2009 8:48 pm
by droppen
droppen wrote:Imagine what we could do if we could edit macros with mircomacro.
Omfg, 033B0110 is the address for the first macro text, and it is a static address, so you can write anything from 033B0110 to 033B0210 as text and press it! This makes everything a lot easier!

I'm all w00ted out.

off to write a
function RoMScript(script)
end

This is important for me that the function's name will be RoMScript

Re: Useful macros

Posted: Wed Sep 02, 2009 10:37 am
by master121
This macro is for when your throwing weapons are low....

Code: Select all

local count = RoMScript('GetInventoryItemCount("player",9)');
if( count > 20 ) then
         
else
    load_paths("repair.xml");
end
This macro is for when your potions are low
itemName = "Regenerationsmixtur" // this is the name of your potion

Code: Select all

local itemTotal = 0;
itemName = "Regenerationsmixtur"
for k = 1, 60, 1 do
    local bagid, icon, name, itemCount = RoMScript("GetBagItemInfo("..k..");");
    if (itemName == name) then
       itemTotal = itemTotal + itemCount;
    end
end
if( itemTotal > 20 ) then
       
else
    load_paths("repair.xml");
end
This macro is for when your weapons durability is low

Code: Select all

local durab , durabmax = RoMScript("GetInventoryItemDurable('player', 15);");
a = durab/durabmax
if( a >= 0.51 ) then
         
else
     load_paths("repair.xml");
end
Enjoy botting :)

Re: Useful macros

Posted: Tue Sep 22, 2009 11:43 am
by S3v3n11
droppen wrote:
droppen wrote:Imagine what we could do if we could edit macros with mircomacro.
Omfg, 033B0110 is the address for the first macro text, and it is a static address, so you can write anything from 033B0110 to 033B0210 as text and press it! This makes everything a lot easier!

I'm all w00ted out.

off to write a
function RoMScript(script)
end

This is important for me that the function's name will be RoMScript
This ever go anywhere? Seems like an awesome idea!

Re: Useful macros

Posted: Tue Sep 22, 2009 3:17 pm
by d003232
S3v3n11 wrote:This ever go anywhere? Seems like an awesome idea!
Yes. He did the work! The actual bot is using that new function for all the inventory stuff and much more.

Re: Useful macros

Posted: Thu Sep 24, 2009 7:23 pm
by ToreDeLoro
master121 wrote: This macro is for when your weapons durability is low

Code: Select all

local durab , durabmax = RoMScript("GetInventoryItemDurable('player', 15);");
a = durab/durabmax
if( a >= 0.51 ) then
         
else
     load_paths("repair.xml");
end
Enjoy botting :)
thank you
but i'm a noob with this :P



where i have to use it exactly?, in the waipoint file? in a macro? if it is a macro from rom... how i use it from micromacro?

thanks


P.D. sorry for my bad english :P

Re: Useful macros

Posted: Fri Oct 23, 2009 2:37 am
by raff
Hi,

Code: Select all

GetInventoryItemDurable('player', 10);
is for ranged weapons, maybe it can be added to the inventory functions? there is only a function for mainhand weapons in there

Re: Useful macros

Posted: Mon Oct 26, 2009 1:21 am
by d003232
raff wrote:Hi,

Code: Select all

GetInventoryItemDurable('player', 10);
is for ranged weapons, maybe it can be added to the inventory functions? there is only a function for mainhand weapons in there
In SVN 379 your can use

Code: Select all

inventory:getDurability(_slot)
to get values back for any slot. Return value is in percentages from 0 - 100.

Re: Useful macros

Posted: Sat Jan 23, 2010 10:20 pm
by VoiD
Hi I'm new to the forums, but I've been haunting them for a while now and experimenting with the bot ! :P

So, is it be possible to manipulate strings in the bots waypoint files ? Like using the GetBagItemInfo(1), then put it into a table and use something like the strcmp function from string.h (in C) ?
My guess is that xml and lua manipulates strings kinda differently then C or C++... :/

Would be useful for things like:
if(--the strings match) then
--do stuff with that item
end

Also, is there a good way to move items in inventory and from the inventory ? I was thinking of picking up an item (probably with PickupBagItem()) and then drop in either somewhere else in the inventory or into the Transmutor or into the mail.

Well basically I'm interested in moving an item into the Transmutor (but I think ill stick with the Fusion addon since its more reliable for stones) and mailing stuff to my alts w/o having to use left mouse clicks and sending keyboard letters 1 by 1 for the recipients name... I don't suppose the rom guys are as good as to give us a SendMail(recipient, subject, body_text, COD_or_normal, item, money) command right ? :P
(since like 90% of those commands look like they where made for bots)

Also, I've seen ways to detect item count in the inventory, but is there one for the gold quantity ? :S

PS: Just a taught since I'm too lazy to find a thread about this, it would be awesome if the bot could change characters... (for lvl 10 farming) I would make an AutoIt script that does that, but sadly the game doesn't recognise clicks and keyboard keys from autoit... the only way would be to write in memory (what the bot already does)... but I'm a bit noob to do that w/o any help... any suggestions ? :P

Re: Useful macros

Posted: Sat Jan 23, 2010 10:35 pm
by Administrator
VoiD wrote: So, is it be possible to manipulate strings in the bots waypoint files ? Like using the GetBagItemInfo(1), then put it into a table and use something like the strcmp function from string.h (in C) ?
My guess is that xml and lua manipulates strings kinda differently then C or C++... :/

Would be useful for things like:
if(--the strings match) then
--do stuff with that item
end
See here. For simple equality checks, just use string1 == string2.

See here for RoM's API functions to move items or get the player's money count.
PS: Just a taught since I'm too lazy to find a thread about this, it would be awesome if the bot could change characters... (for lvl 10 farming) I would make an AutoIt script that does that, but sadly the game doesn't recognise clicks and keyboard keys from autoit... the only way would be to write in memory (what the bot already does)... but I'm a bit noob to do that w/o any help... any suggestions ? :P
People have done it by having a script position the mouse above each character's button on the right side of the screen, causing a left click, and then clicking the "Start Game" button. It's around the forum somewhere, but I don't recall the thread title offhand.

Re: Useful macros

Posted: Sat Jan 23, 2010 10:57 pm
by VoiD
Thanks for the lua link, will come in handy ! :P
I've already been to the RoM functions wiki... but they have waaaaaay too many undocumented functions... :/
Administrator wrote:People have done it by having a script position the mouse above each character's button on the right side of the screen, causing a left click, and then clicking the "Start Game" button. It's around the forum somewhere, but I don't recall the thread title offhand.
Ok I see... I bet they just used char A for botting then made the bot (at a certain waypoint) logout from char A, then clicked on a new character (char B) and then start game and then loaded a new waypoint file for char B.... but wont there be any problems with the profile file since the character name changed, maybe also the class (different skills)... :/
Or is it possible to use "profile:profile_name" inside a waypoint file ? xD

Re: Useful macros

Posted: Sun Jan 24, 2010 12:31 am
by Administrator
VoiD wrote: Ok I see... I bet they just used char A for botting then made the bot (at a certain waypoint) logout from char A, then clicked on a new character (char B) and then start game and then loaded a new waypoint file for char B.... but wont there be any problems with the profile file since the character name changed, maybe also the class (different skills)... :/
Or is it possible to use "profile:profile_name" inside a waypoint file ? xD

Code: Select all

<waypoint x="x" z="z">
  -- do the logout/switch character/log back in sequence here

  -- reload information
  settings.loadProfile("profile_name");
  player:update();
  __WPL:load("waypoints_name");
</waypoint>

Re: Useful macros

Posted: Sun Jan 24, 2010 8:08 am
by VoiD
Hmmm... yeah that is nice... one step closer to full automation ! :P
I might even make him change accounts ! xD

Just one thing, I always use loadPaths("waypoint_file_name"), how different is it from __WPL:load("waypoints_name") ? Is it just the fact that we can specify the folder of our choice with: __WPL:load(getExecutionPath() .. "/waypoints/waypoint_name.xml") or something else ? :S

Re: Useful macros

Posted: Sun Jan 24, 2010 1:18 pm
by Exempt
Is there anyway to get a list of all the functions?

Re: Useful macros

Posted: Sun Jan 24, 2010 4:58 pm
by VoiD
The RoM API or the BOT functions ? :S

RoM API -> http://theromwiki.com/index.php/List_of_Functions
BOT -> open the file (...)interface/addons/micromacro/rom/functions.lua or the RoM BOT Wiki (or some place else ? :S)

As for what they do, that's a bit more tricky... if u don't know what a bot function does, just search it on the forums, if its not there then post a thread about it...

As for RoM API functions, its harder... not all the functions on the wiki are explained and there are TOO MANY of them... so u could also search the forums and see if ppl have used that function b4 or you could get also post a thread... :P

Re: Useful macros

Posted: Sun Jan 24, 2010 8:11 pm
by Exempt
Thanks for the info. :)

Re: Useful macros

Posted: Sun Jan 24, 2010 10:26 pm
by Administrator
VoiD wrote:Hmmm... yeah that is nice... one step closer to full automation ! :P
I might even make him change accounts ! xD

Just one thing, I always use loadPaths("waypoint_file_name"), how different is it from __WPL:load("waypoints_name") ? Is it just the fact that we can specify the folder of our choice with: __WPL:load(getExecutionPath() .. "/waypoints/waypoint_name.xml") or something else ? :S
That's pretty much it, yeah. loadPaths() should also print out some information to the console.
Is there anyway to get a list of all the functions?
Well, no, there really isn't a central location where you can find all functions. There really are a ton of undocumented functions as-is, and it would take a lot of work to get it completed. It would certainly be nice if people would donate a little bit of time by adding missing functions here.