Help with macro!

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Paul
Posts: 18
Joined: 2004-12-09 13:25:07

Help with macro!

Post by Paul »

Hi,

What I'm trying to do is somewhat complex. I have a bag in my house that hold my reagents. Sometimes, I get home with 4, 5 bags with regs of others players that I've looted. So, I want to :

1.) emptycontainer all those bags to my backpack
2.) Move all the regs in my backpack to the main reagent bag in my house
3.) Transfer 50 of each reagent from the main reagent bag to my reagent bag in my backpack.

I could write the steps 2 and 3, but not the one IF AND ONLY IF THERE'S TWO BAGS OF THE SAME KIND IN MY BACKPACK. I've tried this, please, someone help me:

Code: Select all

sub restock() 
var i
dim a[8]
dim b[4]

b[0]="0x0E76"
b[1]="0x0E75"
b[2]="0x09A9"
b[3]="0x0E79"

for i = 0 to 3
UO.FindType(b[i],"-1","backpack")
if UO.FindCount() < 2 then
 UO.EmptyContainer("0", "finditem", "backpack")
 else
 for j = 1 to UO.FindCount()
 UO.EmptyContainer("0", "finditem[j]", "backpack")
end if
wait(90)
next

UO.Exec("set quiet 1")
UO.SetReceivingContainer("mainbagreg")

a[0]="0x0F86"
a[1]="0x0F7A"
a[2]="0x0F84"
a[3]="0x0F8D"
a[4]="0x0F8C"
a[5]="0x0F85"
a[6]="0x0F88"
a[7]="0x0F7B"
for i = 0 to 7
UO.FindType(a[i],"0","backpack")
UO.Grab("0","finditem")
wait(90)
next
UO.SetReceivingContainer("myregbag")
for i = 0 to 7
UO.FindType(a[i],"0","mainregbag")
UO.Grab("50","finditem")
wait(90)
next
UO.Exec("set quiet 0")

end sub
"Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation." - Oscar Wilde
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

its simple... you must find 'my' not 'backpack' like

Code: Select all

uo.findtype('reg','col','my')

now you are finding in you, on you and even in bags in your backpack, but injection cant find anything if that bag was never opened, so firstly you must find bags, open it and then you can search for reagents in your backpack :roll:
Paul
Posts: 18
Joined: 2004-12-09 13:25:07

Post by Paul »

NMY wrote:its simple... you must find 'my' not 'backpack' like

Code: Select all

uo.findtype('reg','col','my')

now you are finding in you, on you and even in bags in your backpack, but injection cant find anything if that bag was never opened, so firstly you must find bags, open it and then you can search for reagents in your backpack :roll:


The first part of the script, that:

Code: Select all

dim b[4]

b[0]="0x0E76"
b[1]="0x0E75"
b[2]="0x09A9"
b[3]="0x0E79"

for i = 0 to 3
UO.FindType(b[i],"-1","backpack")
if UO.FindCount() < 2 then
 UO.EmptyContainer("0", "finditem", "backpack")
 else
 for j = 1 to UO.FindCount()
 UO.EmptyContainer("0", "finditem[j]", "backpack")
end if
wait(90)
next


is exactly to search any backback and emptycontainer it. The problem, NMY, is if I have 2 bags of the same type, Injection will use only the first one.

I've tried do the macro with the "my" object, but I have to loop the search for reags as many times as I have bags in my backpack, because if not, the script will transfer only the first find item.

For instance, if I have a backpack with NS, GA and MR, and other with SS, BP and SA, the macro will work fine, but if I have one bag with MR, and other with MR, the macro will transfer only the reags from the first bag. So, you've helped me, but I'm still suffering from the same problem.
"Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation." - Oscar Wilde
Paul
Posts: 18
Joined: 2004-12-09 13:25:07

Post by Paul »

OK, done. Thanks, NMY. I've added a for to count the bags, and sum it to a variable. This variable holds the number of bags, and I loop as many times as needed.

Thanks =)
"Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation." - Oscar Wilde
Paul
Posts: 18
Joined: 2004-12-09 13:25:07

Post by Paul »

Hey, how can I search the bags within my bag and open it, so that Injection can count the regs within?
"Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation." - Oscar Wilde
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

Paul wrote:Hey, how can I search the bags within my bag and open it, so that Injection can count the regs within?

Code: Select all

uo.findtype('bagtype')
while uo.findcount()
uo.useobject('finditem')
wait(250)
uo.findtype('bagtype')
wend
Paul
Posts: 18
Joined: 2004-12-09 13:25:07

Post by Paul »

NMY wrote:
Paul wrote:Hey, how can I search the bags within my bag and open it, so that Injection can count the regs within?

Code: Select all

uo.findtype('bagtype')
while uo.findcount()
uo.useobject('finditem')
wait(250)
uo.findtype('bagtype')
wend


This loops forever, NMY...

ohh I forgot :roll:

Code: Select all

uo.findtype('bagtype')
while uo.findcount()
uo.useobject('finditem')
uo.ignore('finditem')
wait(250)
uo.findtype('bagtype')
wend
uo.ignorereset()
"Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation." - Oscar Wilde
Post Reply