Page 1 of 2
buying specific items from merchant.
Posted: Thu Jan 13, 2011 12:18 pm
by lisa
I did a fare bit of searching and couldn't find much on this, which seemed weird to me. Searched thru all the setting.lua functions.lua macros.lua and couldn't find any "buy" or "merchant" mentioned anywhere.
Well anyway best I could come up with was
So would obviously need to be used as a sendmacro, I'm sure there has to be a better way to buy items, especially by name or id as opposed to the slot it is in at merchant.
Re: buying specific items from merchant.
Posted: Thu Jan 13, 2011 7:51 pm
by rock5
I've commented before that I think there should be such a function. I should add it to me todo list. Actually it's probably not that big a job, I could whip up some code now. I'll look into it.
Re: buying specific items from merchant.
Posted: Thu Jan 13, 2011 8:59 pm
by rock5
Currently we have player:merchant() that uses inventory:storeBuyConsumable() to buy items so I was thinking of creating an inventory:storeBuyItem(nameidorindex, quantity) and a player:openStore(npcname) functions. Maybe to be thorough we need to include a sell item function? eg. item = inventory:findItem("itemname") item:storeSellItem().
Re: buying specific items from merchant.
Posted: Thu Jan 13, 2011 9:07 pm
by lisa
Sounds like a good plan to me.
This was last thing on my to do list for my fully auto any human class 1-10/10.
I'm just using the storebuyitem code for now.
The "addon" does everything I want it to, some things need to be adjusted like how I use the VK_ in skills. Otherwise it works perfectly, just need to make some really good WP to go with it, ones I use atm aren't so great, takes 90 mins 1-10. About 3 hours all up for 1-10/10.
Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 2:17 am
by rock5
Ok I've added the store buy function to rev 559.
Here's the changelog
- Added function inventory:storeBuyItem(nameIdOrIndex, quantity)
- Added function player:openStore(npcname, option)
- Updated inventory:storeBuyConsumable() to use my more efficient inventory:storeBuyItem() function.
- Updated CPlayer:merchant() to use player:openStore()
- Moved parseItemLink from the CItem class to the functions.lua file.
I'll update the wiki. Something I'd like to point out, though, is buying no longer buys 1 item at a time. Now it buys upto the full stack size possible. eg. if a consumable has a stacksize of 99 and you have your settings to buy 200 then it will buy 99, 99 and then 2 instead of buying them 1 at a time. Should save stacks of time.

Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 2:45 am
by lisa
Awesome work yet again =)
rock5 wrote: Now it buys upto the full stack size possible. eg. if a consumable has a stacksize of 99 and you have your settings to buy 200 then it will buy 99, 99 and then 2 instead of buying them 1 at a time. Should save stacks of time.

Trouble is if you don't have the gold then it won't buy any? or did you put in so if it's unsuccessful at buying then to try to buy half as many? Wouldn't be an issue for most people though, so I wouldn't be too worried about making it work like this.
On a slightly related note, with the NPC detection what is the range? I have noticed a few times if char is beyond arms reach then it doesn't interact with the npc.
Any chance to have the detection distance a little further and use the attack button to run to the npc if out of interaction range?
Either that or maybe a check to see if it has targeted the npc and if not then increase the detection range and then try to move in closer.
In most of my WP I find if the bot fails to interact with NPC then it kinda messes up the whole WP. It doesn't happen often but I do notice it from time to time. The coords seem to get a little out of whack.
Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 3:32 am
by rock5
As far as I know there is no distance limitation on targeting npcs and to target them it uses RoMScript("UseSkill(1,1)") which is equivalent to using the attack key so something else is happening with you.
Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 3:47 am
by swietlowka
so now when u made the missing function i have no choice but to tweak your golde script with the futher i added to it (pet craft) to auto go out buy staff and go in

and then present to community... but not today maybe tommarow ;p
Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 6:04 am
by rock5
swietlowka wrote:so now when u made the missing function i have no choice but to tweak your golde script with the futher i added to it (pet craft) to auto go out buy staff and go in

and then present to community... but not today maybe tommarow ;p
Actually I have an updated Golden Egg script that I have been working on for awhile that I haven't uploaded yet. I'll see if that is ready to post.
No wait, I was going to add eggpet tools to the shopping options first.
Stuff is really starting to pile up.
Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 6:39 am
by swietlowka
i have lets say one that was working for some time, but some errors occurs... i could send my to you if ur intrested
Re: buying specific items from merchant.
Posted: Fri Jan 14, 2011 6:58 am
by jduartedj
personally I'm waiting on:
rock5 wrote:I was going to add eggpet tools to the shopping options first
to do that to my script.
Re: buying specific items from merchant.
Posted: Tue Mar 01, 2011 4:23 am
by Solist
Is it possible to see the durability of selected item before buying ?
Re: buying specific items from merchant.
Posted: Tue Mar 01, 2011 4:28 am
by rock5
Don't merchant bought items have a default dura?
Re: buying specific items from merchant.
Posted: Tue Mar 01, 2011 5:05 am
by Solist
I am about items being sold by traders in the Limo. These items have a random durability up to 120.
Moreover, I'm interested in items with a random stats for memento.
There is helpful to see what you are buying, before you buy

Re: buying specific items from merchant.
Posted: Tue Mar 01, 2011 7:25 am
by rock5
If you can't see the info manually then the bot is not going to be able to get it either. Probably they are added after purchase.
Re: buying specific items from merchant.
Posted: Sun Jan 20, 2013 11:16 am
by CanceR
Hello all,
i tried numerous times with "inventory:storeBuyItem(itemIDorIndex, 99);" and with "RoMScript("StoreBuyItem(5,99)");". in command prompt it works, but micromacro does not want to buy items.
i am trying to set micromacro in waypoint code to buy stack of crafting tools.
i would ask for a bit of help pls.
Re: buying specific items from merchant.
Posted: Sun Jan 20, 2013 11:46 am
by rock5
Are you opening the store first?
Maybe a look at the code you use would help.
Re: buying specific items from merchant.
Posted: Sun Jan 20, 2013 1:59 pm
by CanceR
Code: Select all
<!-- # 9 --><waypoint x="-6851" z="-3564" y="173">
player:merchant(_PetHunter);
sendMacro("ChoiceOption(1)");
for i,_minInvCount,1 do
inventory:storeBuyItem(204232, 99)
--RoMScript("StoreBuyItem(5,99)");
end
</waypoint>
this is how my waypoint looks like, where i am trying to buy 5 stacks of Small Hatchets
Re: buying specific items from merchant.
Posted: Sun Jan 20, 2013 2:10 pm
by rock5
I believe "player:merchant" opens the store, does the autosell and buying based on your profile options, then closes the store.
Try the openStore command I showed you above instead. If the option to open the store is option 1 then you don't need the ChoiceOption command.
Re: buying specific items from merchant.
Posted: Sun Jan 20, 2013 4:10 pm
by CanceR
Code: Select all
player:openStore(_PetHunter)
inventory:storeBuyItem(herbtools, 99)
in this way it works flowlessly, but in this way
Code: Select all
player:openStore(_PetHunter)
for i,_minInvCount,1 do
inventory:storeBuyItem(herbtools, 99)
end
micromacro shows error: "- scripts/rom/bot.lua:827: Failed to compile and run Lua code for waypoint #10" - i think i m writing wrong "for i" cycle, can you advice me how to repair, please.
and one more thing for now: how to choose from a list (or how to organize a list):
Code: Select all
GROUP1 = {
[1] = {Name = TEXT("Sys200335_name"), ID = 200335, Lvl = 1, Value = 2},
[2] = {Name = TEXT("Sys202552_name"), ID = 202552, Lvl = 1, Value = 3},
[3] = {Name = TEXT("Sys200334_name"), ID = 200334, Lvl = 8, Value = 4},
}
meaning: if item name is in list do: craftItem( ItemNameOrID, "all");