Automatic siege merit trading

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
neveryoumind
Posts: 9
Joined: Sun Jan 16, 2011 11:17 pm

Automatic siege merit trading

#1 Post by neveryoumind » Tue Jan 25, 2011 9:46 am

I am trying to write a script for siege war, that whenever someone requests a trade, the bot will trade the merits from the first slot in his backpack. This is my code, I haven’t tested it yet, I was hoping you could tell me if I’m close or way off.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints><onLoad>

</onLoad>

<onTRADE_REQUEST>

    RoMScript("AgreeTrade();") 					--agree to trade
    yrest(500)
    ItemInfo = RoMScript("GetBagItemInfo(1);")			--get item info for item in bag slot 1
    RoMScript("PickupBagItem("..tonumber(ItemInfo)..");")	--pickup item in bag slot 1
    yrest(500)
    RoMScript("ClickTradeItem(1);")				--place item in tradeing slot 1
    yrest(800)
    RoMScript("AcceptTrade('');")				--accept the trade
    yrest(200)

</onTRADE_REQUEST>

</waypoints>

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic siege merit trading

#2 Post by rock5 » Tue Jan 25, 2011 10:18 am

Change this

Code: Select all

    ItemInfo = RoMScript("GetBagItemInfo(1);")         --get item info for item in bag slot 1
    RoMScript("PickupBagItem("..tonumber(ItemInfo)..");")   --pickup item in bag slot 1
to this

Code: Select all

    RoMScript("PickupBagItem("..inventory.BagSlot[61].BagId..");")   --pickup item in bag slot 1
Also isn't there supposed to be a double accept at the end or something?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Automatic siege merit trading

#3 Post by lisa » Tue Jan 25, 2011 10:41 am

Well it's kind of a double accept. both chars need to click ok and then after both have clicked ok then both need to click trade.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

neveryoumind
Posts: 9
Joined: Sun Jan 16, 2011 11:17 pm

Re: Automatic siege merit trading

#4 Post by neveryoumind » Tue Jan 25, 2011 10:54 am

Thanks! I can't wait until I get home to test this out:)

neveryoumind
Posts: 9
Joined: Sun Jan 16, 2011 11:17 pm

Re: Automatic siege merit trading

#5 Post by neveryoumind » Tue Jan 25, 2011 11:58 am

ok, this is what I have now:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<waypoints>
<onLoad>
	changeProfileOption("PATH_TYPE", "wander")
	changeProfileOption("WANDER_RADIUS", 0)
</onLoad>

<onTRADE_REQUEST>
    RoMScript("AgreeTrade();") 						--agree to trade
    yrest(500)
    RoMScript("PickupBagItem("..inventory.BagSlot[61].BagId..");")   	--pickup item in bag slot 1	
    yrest(500)
    RoMScript("ClickTradeItem(1);")					--place item in tradeing slot 1
    yrest(800)
    RoMScript("AcceptTrade('');")					--accept the trade
    yrest(200)
    RoMScript("AcceptTrade('');")					--accept the trade
    yrest(200)
</onTRADE_REQUEST>

</waypoints>
however the bot attempts to move to point (0,0)

User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: Automatic siege merit trading

#6 Post by Giram » Tue Jan 25, 2011 12:07 pm

Maybe like this? It would constantly check for requests if thats is right command to check trade requests.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	while(true) do
		<onTRADE_REQUEST>
			RoMScript("AgreeTrade();") 						--agree to trade
			yrest(500)
			RoMScript("PickupBagItem("..inventory.BagSlot[61].BagId..");")   	--pickup item in bag slot 1	
			yrest(500)
			RoMScript("ClickTradeItem(1);")					--place item in tradeing slot 1
			yrest(800)
			RoMScript("AcceptTrade('');")					--accept the trade
			yrest(200)
			RoMScript("AcceptTrade('');")					--accept the trade
			yrest(200)
		</onTRADE_REQUEST>
	end
</onLoad>
</waypoints>

neveryoumind
Posts: 9
Joined: Sun Jan 16, 2011 11:17 pm

Re: Automatic siege merit trading

#7 Post by neveryoumind » Tue Jan 25, 2011 1:06 pm

I gave that a try it didn't seem to work. back to reading the wiki I think.

neveryoumind
Posts: 9
Joined: Sun Jan 16, 2011 11:17 pm

Re: Automatic siege merit trading

#8 Post by neveryoumind » Tue Jan 25, 2011 1:42 pm

ok, borrowing from matt87, I now have this. it is dirty, but almost works;)

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>

    changeProfileOption("ANTI_KS", false)
    changeProfileOption("PATH_TYPE", "wander")
    changeProfileOption("WANDER_RADIUS", 0)
    changeProfileOption("AUTO_TARGET", false)
    changeProfileOption("USE_SLEEP_AFTER_RESUME", true)

while (true) do 
            yrest(200) 
            RecipientName = RoMScript("GetTradeRecipientName();")
            	if RecipientName == nil then
            	else
			if RecipientName == "" then
            		else
    				RoMScript("AgreeTrade();") 					--agree to trade
    				yrest(500)
    				RoMScript("PickupBagItem("..inventory.BagSlot[61].BagId..");")   --pickup item in bag slot 1	
    				yrest(500)
    				RoMScript("ClickTradeItem(1);")					--place item in tradeing slot 1
    				yrest(800)
               				while RoMScript("GetTradeTargetItemInfo(1)") ~= nil do
                    				RoMScript("AcceptTrade('..RecipientName..');")
                    				yrest(500)
                    				RoMScript("AcceptTrade('..RecipientName..');")
                			end
                	end
            	end
end



</onLoad>
</waypoints>
however the trade accept loop for slow traders doesn't seem to work, loops the picking up and placing of items

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic siege merit trading

#9 Post by rock5 » Tue Jan 25, 2011 8:17 pm

Firstly you can change this

Code: Select all

            	if RecipientName == nil then
            	else
		         if RecipientName == "" then
            		else
To this

Code: Select all

            		if RecipientName ~= nil and RecipientName ~= "" then
neveryoumind wrote:however the trade accept loop for slow traders doesn't seem to work, loops the picking up and placing of items
So what you want to do is wait until they put something in the tradebox after you have placed your item.

Try;

Code: Select all

               				while RoMScript("GetTradeTargetItemInfo(1)") == nil do
                    				yrest(500) -- waiting
               				end
                  			RoMScript("AcceptTrade('..RecipientName..');")
                  			yrest(500)
                  			RoMScript("AcceptTrade('..RecipientName..');")
There might need to be a check to see if they quit the trade.


If I understand this correctly, this will trade blindly with anyone. That's a bit risky isn't it? Maybe you should be checking RecipientName against a list of acceptable characters?

eg.

Code: Select all

            		local authorized = "'char 1','char 2','char 3'"
            		if RecipientName ~= nil and RecipientName ~= "" and string.find(authorized,"'"..RecipientName.."'") then
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Automatic siege merit trading

#10 Post by lisa » Tue Jan 25, 2011 8:42 pm

If I'm right I doubt he cares about who is trading, I'm guessing he will load several characters all probably lvl 1 and they are just there to purely farm merits.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic siege merit trading

#11 Post by rock5 » Tue Jan 25, 2011 8:47 pm

I probably misunderstood the situation, probably because I don't know what 'merits' are.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Automatic siege merit trading

#12 Post by lisa » Tue Jan 25, 2011 10:45 pm

with Seige characters farm merits, lower characters click on a tower and collect merit over time. The merits are used to buy and upgrade things in the seige. It's like a special currency just for seiges. You also get them by killing balloons or enemy players.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

neveryoumind
Posts: 9
Joined: Sun Jan 16, 2011 11:17 pm

Re: Automatic siege merit trading

#13 Post by neveryoumind » Wed Jan 26, 2011 10:39 am

Thank you again. My goal for this script is to automate the farming of the merits. The reason for this is that I have noticed that a number of small guilds that siege, about 0-5 players, routinely use alt-characters for farming. Also this seem to be a area not covered, so I could contribute something to a community that has saved me $1,000 in carpel tunnel treatments;-)

so indeed, the script must be able to trade with anyone who asks, mutable times in a row, while farming merits. It also must only select the merits.

Anywho, this is the script as it stands after last night.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>

    changeProfileOption("ANTI_KS", false)
    changeProfileOption("PATH_TYPE", "wander")
    changeProfileOption("WANDER_RADIUS", 0)
    changeProfileOption("AUTO_TARGET", false)
    changeProfileOption("USE_SLEEP_AFTER_RESUME", true)

while (true) do 
            yrest(2000) 
            RecipientName = RoMScript("GetTradeRecipientName();")	--checks to see if anyone wants to trade with us
            if RecipientName == nil then
            elseif RecipientName == "" then
            else


                RoMScript("AgreeTrade();")                --agree to trade
               	yrest(500)
                RoMScript("PickupBagItem("..inventory.BagSlot[61].BagId..");")   --pickup item in bag slot 1   
                yrest(500)
                RoMScript("ClickTradeItem(1);")               --place item in tradeing slot 1
                yrest(800)
                RoMScript("AcceptTrade('..RecipientName..');")	--click the ok buttion
                yrest(500)

		while RoMScript("GetTradeRecipientName();") ~= "" do
                	RoMScript("AcceptTrade('..RecipientName..');")	--loops clicking the trade buttion untill the trade is completed
                	yrest(500)
		end
		yrest(5000)
		keyboardPress(key.VK_ESCAPE);		--clears the screen of the so and so wants to trade window
            end
        end

</onLoad>
</waypoints>
I will implement your suggestion for the next version Rock5, thank you. Also I need to add a check to see if the merits are in slot one or two. What happens if you trade while collecting the merits, the ones being traded, still reserve the slot in the back pack when you pick them up, so the newly collected merits go to the next available slot. so I’m thinking I’ll set it up to see if there is anything in slot one or two and trade that, and if nothing is in either slot to cancel the trade.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Automatic siege merit trading

#14 Post by rock5 » Wed Jan 26, 2011 6:11 pm

What's stopping you from finding the merits?
Instead of

Code: Select all

RoMScript("PickupBagItem("..inventory.BagSlot[61].BagId..");")   --pickup item in bag slot 1
try

Code: Select all

local merit = inventory:findItem(meritnameorId)
if merit then
    RoMScript("PickupBagItem("..merit.BagId..");")
    -- and the rest
Or maybe you can use

Code: Select all

local merit = inventory:findItem(meritnameorId)
if merit and RecipientName ~= nil and RecipientName ~= "" then
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Automatic siege merit trading

#15 Post by lisa » Wed Jan 26, 2011 10:17 pm

206685 = Guild War Merit
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest