Select inventory backpack to move

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
runegolemsentry
Posts: 10
Joined: Mon Sep 03, 2012 1:07 pm

Select inventory backpack to move

#1 Post by runegolemsentry » Thu Nov 08, 2012 3:13 pm

I am farming a boss of an instance to get his drops.
When the inventory is full, i want the bot to open the rented bank and move the items inside the bag6 to the bank.
This is what i tryed to do:

Code: Select all

   
function BankMove()
      if inventory:itemTotalCount(0) == 0 then
         sendMacro("OpenBank()"); yrest(2000);
         item = IDUNNOWHATTUPUTHERE
         item:moveTo("bank");
         end
      end
 end
How can i make the "item" to move be a selected backpack?

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

Re: Select inventory backpack to move

#2 Post by lisa » Thu Nov 08, 2012 6:33 pm

Code: Select all

function BankMove()
      if inventory:itemTotalCount(0) == 0 then
         sendMacro("OpenBank()"); yrest(2000);
         for slot = 211,240,1 do --bag 6, i think
              item = inventory.BagSlot[slot]
              item:moveTo("bank");
         end
      end
 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

runegolemsentry
Posts: 10
Joined: Mon Sep 03, 2012 1:07 pm

Re: Select inventory backpack to move

#3 Post by runegolemsentry » Thu Nov 08, 2012 6:45 pm

lisa wrote:

Code: Select all

function BankMove()
      if inventory:itemTotalCount(0) == 0 then
         sendMacro("OpenBank()"); yrest(2000);
         for slot = 211,240,1 do --bag 6, i think
              item = inventory.BagSlot[slot]
              item:moveTo("bank");
         end
      end
 end

can i ask what is the "1" after 211,240 for?
By the way just tryed, but something goes wrong.

EDIT: when moving, it moves only one item out of 2. for example placing 18 items (the first 3 lines), 9 are moved and 9 rest there. it picks an item, swaps his place with the next one and moves this to the bank, but the first item rests in the bag

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

Re: Select inventory backpack to move

#4 Post by lisa » Thu Nov 08, 2012 6:58 pm

the 1 is to make sure it does it in increments of 1, so 211 212 213 214 215, default is usually 1 but when I use a range not starting with 1 I usually add it in just to make sure.
So if it was 1,25 I wouldn't bother with adding the increment value.

Sorry but I don't understand what you said it is doing, chances are it will just need an inventory:update() added in to make sure it isn't moving items to a spot you already moved an item to.

Code: Select all

function BankMove()
      if inventory:itemTotalCount(0) == 0 then
         sendMacro("OpenBank()"); yrest(2000);
         for slot = 211,240,1 do --bag 6, i think
              inventory:update()
              item = inventory.BagSlot[slot]
              item:moveTo("bank");
              yrest(200)
         end
      end
 end

added in a little rest aswell.
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

runegolemsentry
Posts: 10
Joined: Mon Sep 03, 2012 1:07 pm

Re: Select inventory backpack to move

#5 Post by runegolemsentry » Thu Nov 08, 2012 7:04 pm

You perfectly answered to my question, even if you didn't understand it :D
One more thing, the inventory:update works, but no totally. just did a try placing 20 items to move, the first 8 were moved to bank without troubles, but for the other 12 i had again the same problem, bot moving items in bank slots which it moved items already. maybe a "repeat" command on the inventory:update() ?

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

Re: Select inventory backpack to move

#6 Post by lisa » Thu Nov 08, 2012 7:07 pm

I added in a rest to the code, try that.
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

runegolemsentry
Posts: 10
Joined: Mon Sep 03, 2012 1:07 pm

Re: Select inventory backpack to move

#7 Post by runegolemsentry » Thu Nov 08, 2012 7:09 pm

i made it look like that

Code: Select all

inventory:update();
bank:update();
and now it works perfectly even with full bag. i don't know exactly if ";" is a sort of a rest, i'm kinda new in all this still, but this or the bank:update() made it work :)

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

Re: Select inventory backpack to move

#8 Post by lisa » Thu Nov 08, 2012 7:12 pm

it would be the bank update, the ; is just to say that is the end of that bit of code, it is obsolete now though as of like LUA 5.1 (I think).
So having it there does nothing.


I suspect the updates are just making it do that little bit of extra work which is like having a rest, if you tried it without the updates and just the rest it will probably still work.
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: Select inventory backpack to move

#9 Post by rock5 » Fri Nov 09, 2012 12:45 am

Moving is supposed to work better than that now. I just had a look. Looks like there is a line missing from the bank:findItem function that exists in the inventory:findItem and guildbank:findItem functions. This line is supposed to stop it from using empty slots more than once in a row. I don't know why it's missing. It can't possibly have worked as well as I remember with that line missing.

Anyway I added that line and it works as expected. The fix you came up with might work but I suspect it would be a lot, lot slower in comparison. Here is that bank class with that 1 line added.
bank.lua
(1.6 KiB) Downloaded 147 times
With this version you wont need to do the updates or include the yrest and it should be very fast.
  • 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

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Select inventory backpack to move

#10 Post by Cindy » Thu Dec 06, 2012 5:10 pm

Code: Select all

	--	Phirius Potion - Type D
	while inventory:itemTotalCount("Phirius Potion - Type D") > 0 do
		local x = inventory:findItem("Phirius Potion - Type D")
        if x then x:moveTo("bank")  printf("Bank deposit : "..x.Name); yrest(789); end
	end	
This doesn't work if I already have some in the bank, the one in the bank briefly turns grey, but the others do not get stacked on it. Is there any way to stack them in the bank?

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

Re: Select inventory backpack to move

#11 Post by rock5 » Thu Dec 06, 2012 11:33 pm

Try the 'bank.lua' file I posted in my previous post.
  • 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

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Select inventory backpack to move

#12 Post by Cindy » Fri Dec 07, 2012 9:51 am

Another thing I just found:

While trying to move itemshop items from the backpack to the itemshop backpack, when I had some of the items in the itemshop already it wouldn't move those in the backpack (even though there were empty spaces, though I'd prefer it stacked). As soon as I moved the items from the itemshop pack to the main backpack, the exact same command executed successfully (ie. moved the now one stack items to the itemshop).

Whatever fix you did to bank.lua may need to be made somewhere else too?

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

Re: Select inventory backpack to move

#13 Post by rock5 » Fri Dec 07, 2012 10:04 am

I'll have a look but the itemshop backpack is part of the inventory class along with the regular bags.
  • 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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Select inventory backpack to move

#14 Post by rock5 » Fri Dec 07, 2012 10:26 am

I just tested it. I took 1 of every stack of items in my itemshop bag and put them in my normal bags. That was 10 separate items. Then I just did

Code: Select all

for i = 61,70 do inventory.BagSlot[i]:moveTo("itemshop") end
and they all got moved to their respective stacks. So I'm not sure what you're doing wrong. I even took 30 from one big stack and split them into single items and filled my first bag. It stacked them all onto 1 stack in my itemshop bag, although it failed about 1 in 15 which is not bad. It only failed because it was stacking multiple items onto the same stack. 30 different types of items wouldn't have had that issue.
  • 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

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Select inventory backpack to move

#15 Post by Cindy » Fri Dec 07, 2012 6:37 pm

Ok ill run some more to see what happened. Thanks for checking rock.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 43 guests