move to itemshop bag

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

move to itemshop bag

#1 Post by lolita » Wed Jan 23, 2013 4:54 pm

why this sometime's work sometime's don't

Code: Select all

function moveitemshop()
	for i, item in pairs(inventory.BagSlot) do
		for k, v in ipairs(item_shop_bag) do
			if v == item.Name then
				printf("Moving to Item Shop bag:  "..item.Name.."\n");
				item:moveTo("itemshop")
				yrest(500)
			end
		end
	end
end

item_shop_bag = {
	"Purified Fusion Stone",
	"Master's Simple Repair Hammer",
	"Grand Golden Repair Hammer"
   }
can someone help, or is there simple way to move items in tabe to item shop bag
Life is a journey, not destination :D

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

Re: move to itemshop bag

#2 Post by lisa » Wed Jan 23, 2013 7:15 pm

It looks like it should be ok, when does it not work?
Exactly what happens.
If anything I would suguest using ID's instead of names but it should still work with the names.
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
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: move to itemshop bag

#3 Post by lolita » Wed Jan 23, 2013 9:19 pm

that function is in my userfunctions_file, and when i call it from waypoint it move items only first time, but when next time function is called i dosen't do anything.
And it try to move items that are already in item shop, should i put something like this

Code: Select all

function moveitemshop()
	for i, item in pairs(inventory.BagSlot) do
		if item.SlotNumber >= 61 then
			for k, v in ipairs(item_shop_bag) do
				if v == item.Name then
					printf("Moving to Item Shop bag:  "..item.Name.."\n");
					item:moveTo("itemshop")
					yrest(500)
				end
			end
		end
	end
end
Or is there simple way to move items to item shop bag, i need only to move 3 difrent items can i do sometihng like this

Code: Select all

if inventory:itemTotalCount("Purified Fusion Stone") > 0 then
	item:moveTo("itemshop")
end
Life is a journey, not destination :D

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

Re: move to itemshop bag

#4 Post by lisa » Wed Jan 23, 2013 10:21 pm

From the sounds of it you might need to do an inventory:update() at the start of the function.

In the second code you posted you would still need to define "item"

Code: Select all

local item = inventory:findItem("Purified Fusion Stone")
if item then
   item:moveTo("itemshop")
end
I would still use the table but also use find item.

Code: Select all

local item_shop_bag = {
   "Purified Fusion Stone",
   "Master's Simple Repair Hammer",
   "Grand Golden Repair Hammer"
   }

for k,v in pairs(item_shop_bag) do
   repeat
      local item = inventory:findItem(v)
      if item then
         item:moveTo("itemshop")
      end
   until not item
end
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: move to itemshop bag

#5 Post by rock5 » Wed Jan 23, 2013 11:43 pm

Yeah, I'd do it Lisas way because if a move fails, for whatever reason, it will try to move it again. But you don't need inventory:update() because inventory:findItem does an update already.
  • 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: move to itemshop bag

#6 Post by lisa » Wed Jan 23, 2013 11:51 pm

rock5 wrote:Yeah, I'd do it Lisas way because if a move fails, for whatever reason, it will try to move it again. But you don't need inventory:update() because inventory:findItem does an update already.
k removed the update, wasn't sure about it so added it in just in case lol

the repeat loop might need a check for space in itemshop bag though, if it gets full then the moveto will fail and stay in the loop forever.

the inventory:itemTotalCount() doesn't include item shop when calculating free space, so you would need to add in your own code to check free space of item shop.

Something like this

Code: Select all

local item_shop_bag = {
   "Purified Fusion Stone",
   "Master's Simple Repair Hammer",
   "Grand Golden Repair Hammer"
   }

for k,v in pairs(item_shop_bag) do
   repeat
	local count = 0
	for slot = 1, 50 do
		local item = inventory.BagSlot[slot]
		item:update()
		if item.Empty then
			count = count + 1
		end
	end
	if count == 0 then print("No space in item shop bag") break end
	local item = inventory:findItem(v)
	if item then
	   item:moveTo("itemshop")
	end
   until not item
end
count would be the number of available spots you can put items in, so count == 0 means you have no space to put the item.
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: move to itemshop bag

#7 Post by rock5 » Thu Jan 24, 2013 1:40 am

lisa wrote:the inventory:itemTotalCount() doesn't include item shop when calculating free space, so you would need to add in your own code to check free space of item shop.

Code: Select all

inventory:itemTotalCount(0,"itemshop")
  • 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: move to itemshop bag

#8 Post by lisa » Thu Jan 24, 2013 1:59 am

ahh you are right, I missunderstaood the code.

Code: Select all

	if first == nil then
		-- Default values - 1-240 for items, 61-240 for empties.
		if itemNameOrId == "<EMPTY>" or itemNameOrId == 0 then
			first = 61
		else
			first = 1
		end
		last = 240 -- default, search only bags
	end
I glanced at that and went, yup it defaults to just check actual bags, but first isn't nil if you specify the "itemshop" as second arg.

Code: Select all

local item_shop_bag = {
   "Purified Fusion Stone",
   "Master's Simple Repair Hammer",
   "Grand Golden Repair Hammer"
   }

for k,v in pairs(item_shop_bag) do
   repeat
      local item = inventory:findItem(v)
      if item then
         item:moveTo("itemshop")
      end
   until not item or inventory:itemTotalCount(0,"itemshop") == 0
end

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
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: move to itemshop bag

#9 Post by lolita » Thu Jan 24, 2013 9:18 am

did you tested it lisa, cose it still dont work for me :(
i just added "print" to your code

Code: Select all

function jbg()
	local item = inventory:findItem("Purified Fusion Stone")
	if item then
		printf("Moving to Item Shop bag\n");
		item:moveTo("itemshop")
	end
end
just print "Moving to Item Shop bag" and nothing happen

Code: Select all

local item_shop_bag = {
   "Purified Fusion Stone",
   "Master's Simple Repair Hammer",
   "Grand Golden Repair Hammer"
   }

for k,v in pairs(item_shop_bag) do
   repeat
      local item = inventory:findItem(v)
      if item then
         printf("Moving to Item Shop bag\n");
         item:moveTo("itemshop")
      end
   until not item or inventory:itemTotalCount(0,"itemshop") == 0
end
keep picking up item and printing

Code: Select all

Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
Moving to Item Shop bag
and again not moving items.
btw im useing RC3 version and 5.0.6 game version
Life is a journey, not destination :D

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

Re: move to itemshop bag

#10 Post by rock5 » Thu Jan 24, 2013 9:27 am

inventory:findItem finds from the whole inventory, which includes itemshop and magicbox. You need to limit the search to just "bags".

Code: Select all

local item_shop_bag = {
   "Purified Fusion Stone",
   "Master's Simple Repair Hammer",
   "Grand Golden Repair Hammer"
   }

for k,v in pairs(item_shop_bag) do
   repeat
      local item = inventory:findItem(v,"bags")
      if item then
         printf("Moving to Item Shop bag\n");
         item:moveTo("itemshop")
      end
   until not item or inventory:itemTotalCount(0,"itemshop") == 0
end
Try that.
  • 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
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: move to itemshop bag

#11 Post by lolita » Thu Jan 24, 2013 9:48 am

it's funny, it's same code lisa posted, and it work now, i dont know why wasn't working first time i tested it.

Anyway it work now, :D
ty again Rock5 and lisa

**EDIT
it's almost same, you added "bags" in this line

Code: Select all

local item = inventory:findItem(v,"bags")
Life is a journey, not destination :D

cokebot
Posts: 54
Joined: Wed Oct 19, 2011 7:47 am

Re: move to itemshop bag

#12 Post by cokebot » Sun Jul 07, 2013 8:56 am

is it possible to move every itemshopitem into the item shop bag?
like is item a itemshopitem then move to.

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

Re: move to itemshop bag

#13 Post by rock5 » Sun Jul 07, 2013 10:20 am

Yes but you would have to loop through all the items. There are no functions for it.

Code: Select all

	local item
	for slot = 61, 240 do
		item = inventory.BagSlot[slot]
		item:update()
 	    if item.Available and (not item.InUse) and item.ItemShopItem == true then
			item:moveTo("itemshop")
		end;
	end;
I think that should work.
  • 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

cokebot
Posts: 54
Joined: Wed Oct 19, 2011 7:47 am

Re: move to itemshop bag

#14 Post by cokebot » Mon Jul 08, 2013 8:19 am

works perfect Rock5, needs less then a second.
Great thanks a lot.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests