Page 6 of 7

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 9:38 am
by Desmond
yes

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 9:39 am
by rock5
Good.

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 9:41 am
by Desmond
right now I try to paste into your waypoint

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 9:44 am
by Desmond
rock5 works great thanks!

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 9:55 am
by Desmond
and how to make passwords for each account to others?

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 10:07 am
by rock5
I usually use the same secondary password so don't have that problem. But you could try this.

Code: Select all

accountpw = {
    [5] = "secondary passwors1",
    [6] = "secondary password2",
    [7] = "secondary password3",
}
BuyFromItemShop(829, accountpw[getAcc()], 1) 
'accountpw' is a list of account numbers and secondary passwords. In the example above, '5', '6' and '7' are the account numbers.

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 10:12 am
by Desmond
Thanks try little pozhzhe

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 10:32 am
by Desmond
why here is a code not working he true test?


if inventory:itemTotalCount("Phirius Token Coin") > 840 then
BuyFromItemShop(829, "km80673460297", 1)
end

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 10:37 am
by rock5
Are you playing with an English client? "Phirius Token Coin" will only work on English client.

Re: Rock5's BuyFromItemShop userfunction

Posted: Thu Apr 10, 2014 10:38 am
by Desmond
No ru how sorry (((

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Apr 27, 2014 7:40 am
by Jorge
Hello, sorry for my ignorance, but would like to know how to use function to be tested .. because I am beginner here in entato already used it ... Rock waypoints which the first poster of this function. What necessary for it to work?

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Apr 27, 2014 7:45 am
by Jorge
I followed your instructions, but when you know the number of items ... what to do?

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Apr 27, 2014 7:48 am
by Jorge
..

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Apr 27, 2014 9:12 am
by rock5
The guid number printed is 1148. So to buy that in a waypoint file you would use

Code: Select all

BuyFromItemShop(1148, secondaryPassword , number )
where secondaryPassword is your secondary password and number is how many you want to but but is optional.

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Apr 27, 2014 10:07 am
by Jorge
Rock .... So where to use this command to test? I'm watching and learning a lot from you ... but lost myself ... where to use the command? sorry

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Apr 27, 2014 10:17 am
by rock5
Well to test it the easiest way would be to start the commandline.xml. Then just type it in.

In the waypoint file all code must be between a <waypoint x... z .. y> and </waypoint> or the <onload> and </onload> at the top of the file. Just add it at the waypoint at which you want to do it.

Re: Rock5's BuyFromItemShop userfunction

Posted: Sat Aug 02, 2014 10:01 pm
by rock5
Updated to version 1.4:
  • - Fixed bug that made it fail first time (because it takes sooo long for the item shop items to populate the shop).
    - Added 'FindItemShopGUID' function.
A few notes about the new function:
  • - nameOrId must be the full exact name of the item being purchased or any id that yields the correct name.
    - Supported currencies are "coin", "rub", and "dia". Some other variations you can use are "coins", "ruby", "rubies", "diamond", "diamonds", "dias", among other. Also you can use the full name in the current language, eg. in English "Phirius Tokens", in German "Phiriusmarken".
    - The "amount" is the amount shown in the tooltip. Don't get confused by the name. For example "10 Arcane Transmutor Charges" is 1 item that gives you 10 charges. In the tooltip it shows "Amount: 1". Whereas "Convenient Mailbox" can be purchased 10 at a time and shows "Amount: 10". Amount is optional and defaults to 1 so you only have to include it if the amount shown is more than 1. Don't confuse "amount" with the number you wish to buy. Don't forget his is a search function so "amount" is a search criteria.
Here is a simple example to buy charges when you have enough coins.

Code: Select all

if inventory:itemTotalCount(203038) >= 200 -- Enough coin
    coinguid = FindItemShopGUID(202928,"coin")
    BuyFromItemShop(coinguid, "secondary password",1)
end

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Aug 17, 2014 10:35 am
by Rickster
Hello,

when trying to buy something from the coins store, the bot gets stuck in the loop stating "Waiting for Item Shop database to load."

It waits until I open the shop manually AND change to the coins tab, then it continues.

So I think

Code: Select all

local function commonBuy(_itemGUID, _secondaryPassword, _numberOrRecipient, _subject, _body)
	if RoMScript("ItemMallFrame.OK") ~= true then
		RoMCode("ItemMallFrame:Show() ItemMallFrame:Hide()")
		print("Waiting for Item Shop database to load.")
		repeat
			yrest(50)
		until RoMScript("ItemMallFrame.OK") == true
	end
needs to be modified, not only to open and close the shop, but also switch to the needed tab where one wants to buy item from.

I donĀ“t know myself how to code things to switch to the wanted tab :(

Ric

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Aug 17, 2014 10:57 am
by rock5
Nah, I don't think it has to open the right tab. Probably it just failed to open the item shop and got stuck in that loop waiting for ItemMallFrame.OK to become true, which it never will until the shop is opened. You probably think changing the tab made it go because it just happened to finish loading the database just as you clicked it.

What we can do to fix it is have it try and open the shop if it fails, eg.

Code: Select all

local function commonBuy(_itemGUID, _secondaryPassword, _numberOrRecipient, _subject, _body)
	if RoMScript("ItemMallFrame.OK") ~= true then   
		print("Waiting for Item Shop database to load.")
		repeat
			RoMCode("ItemMallFrame:Show() ItemMallFrame:Hide()")
			local starttime = getTime()
			repeat
				yrest(50)
			until RoMScript("ItemMallFrame.OK") == true or deltaTime(getTime(), starttime) > 1000
		until RoMScript("ItemMallFrame.OK") == true
	end

Re: Rock5's BuyFromItemShop userfunction

Posted: Sun Aug 17, 2014 1:00 pm
by Rickster
On my side it hang in the loop. Then I opened the shop and closed it, nothing happend. Then I opend it, changed to coins store and immediately the bot continues with the input of the secondary PW.

As I am doing that in a loop with several chars and all got stuck at the same point, I thought I found the problem :-/

I will try your fix and report back whats happening.

Thanx
Ric