Looping

Ask for help

Moderators: Murderator+, Murderator

Post Reply
sylar
Posts: 7
Joined: 2007-12-12 10:33:30

Looping

Post by sylar »

Hey, I'd like to know how to loop a certain part of your script, and than make it continue, here's what I have and what I want done to it.

sub drag_newts()
VAR Eye= '0x0F87'
VAR Bottles= '0x0F0E'
VAR Bag= '0x0E76'
VAR Bag1= '0x416C7DCC'
VAR Bag2= '0x416C7DC9'
VAR Bag3= '0x416C7DDC'
VAR Bag4= '0x416C7DCE'
VAR Bag5= '0x416C7DD4'
VAR Bag6= '0x416C7DD2'
VAR Bag7= '0x416C7DCA'
VAR Bag8= '0x416C7DD8'
VAR Bag9= '0x416C7DCF'
VAR Bag10= '0x416C7DD3'
VAR Bag11= '0x402BCECA'
VAR Bag12= '0x40020AA3'
VAR Bag13= '0x416C7DCB'
VAR Bag14= '0x416C7DDB'
VAR Bag15= '0x416C7DD0'
VAR Bag16= '0x416C7DD1'
VAR Bag17= '0x416C7DDA'
VAR Bag18= '0x416C7DD6'
VAR Bag19= '0x416C7DD5'
VAR Bag20= '0x416C7DCD'

while Uo.Life >= 1

uo.findtype ( Eye, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '400', 'backpack')
endif
wait(600)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(600)
uo.findtype ( Bag, '0', Bag1 )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
***************(LOOP HERE)****************
uo.usetype("0x0F87")
wait(9000)

uo.findtype( '0x0F09', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', '0x405CC7F2')
end if
wait(600)
wend
*********(LOOP HERE)***********

uo.findtype( '0x0E76', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', 0x408D2DE8)
endif
wait(600)
wend
endsub

So I'd like to know if someone can tell me how to loop a specific part of ur script for a specific amount of times.

I'd like to loop that area 100 times, If someone can tell me what to add in, or if someone can copy/paste that area with a loop in it for me i'd be very thankfull...

This is my first script, took me over 2 hours to put this together, I know pathetic, but i need this script and i need your help now guys :(.

Thanks

endsub
sylar
Posts: 7
Joined: 2007-12-12 10:33:30

Post by sylar »

up
Kynep
Expert!
Posts: 1348
Joined: 2006-02-07 08:51:40
Location: г. Старый Оскол
Contact:

Post by Kynep »

sylar wrote:up


Add 'a' in start of script

Code: Select all

VAR a = 0

and try this

Code: Select all

***************(LOOP HERE)**************** 
repeat
uo.usetype("0x0F87")
wait(9000)

uo.findtype( '0x0F09', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', '0x405CC7F2')
end if
wait(600)
a = a + 1
until a == 100

wend
***************(LOOP HERE)****************
sylar
Posts: 7
Joined: 2007-12-12 10:33:30

Post by sylar »

Hey Kynep, what you gave me seems to work very well as a loop and I did it and it all worked except one thing.

What my script is intended to do is, Grab 700 ginsang, and 100 bottles, make 100 healing potions, with the loop you showed me, make 100 healing potions and after every time it makes a potion it moves it to a bag, which I named "smallbag1"

then grab another 700 ginsang and another 100 bottles and repeats the process and after it makes every potion it puts it in "smallbag2"

and so on for 20 smallbags I have.

The problem is, it does one full bag of 100, then when I go for the second bag, it doesnt stop at 100 it continues making it till theres no more ginsang and it doesnt switch bags.

What it did for me is, the first "smallbag1" it made 100, then it switched and it made more then 100 potions in smallbag2 and didn't pick up the resources.

I hope you understand what I mean, I'll show you my script.

sub Gheal_Pot_Macro()
VAR Gin= '0x0F85'
VAR a = 0
VAR Bottles= '0x0F0E'
VAR Bag= '0x0E76'
VAR Bag1= '0x416C7DCC'
VAR Bag2= '0x416C7DC9'
VAR Bag3= '0x416C7DDC'
VAR Bag4= '0x416C7DCE'
VAR Bag5= '0x416C7DD4'
VAR Bag6= '0x416C7DD2'
VAR Bag7= '0x416C7DCA'
VAR Bag8= '0x416C7DD8'
VAR Bag9= '0x416C7DCF'
VAR Bag10= '0x416C7DD3'
VAR Bag11= '0x402BCECA'
VAR Bag12= '0x40020AA3'
VAR Bag13= '0x416C7DCB'
VAR Bag14= '0x416C7DDB'
VAR Bag15= '0x416C7DD0'
VAR Bag16= '0x416C7DD1'
VAR Bag17= '0x416C7DDA'
VAR Bag18= '0x416C7DD6'
VAR Bag19= '0x416C7DD5'
VAR Bag20= '0x416C7DCD'
VAR Smallbag1= '0x4005633A'
VAR Smallbag2= '0x40056335'
VAR Smallbag3= '0x4005633E'
VAR Smallbag4= '0x40056340'
VAR Smallbag5= '0x40056337'
VAR Smallbag6= '0x404B2F20'
VAR Smallbag7= '0x404B2F18'
VAR Smallbag8= '0x405CFC11'
VAR Smallbag9= '0x405CFC0C'
VAR Smallbag10= '0x405CFC17'
VAR Smallbag11= '0x405CFC13'
VAR Smallbag12= '0x405CFC16'
VAR Smallbag13= '0x40056338'
VAR Smallbag14= '0x40056339'
VAR Smallbag15= '0x40056341'
VAR Smallbag16= '0x40056336'
VAR Smallbag17= '0x40056334'
VAR Smallbag18= '0x40056335'
VAR Smallbag19= '0x4005633A'
VAR Smallbag20= '0x4005633D'

uo.findtype ( Gin, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '700', 'backpack')
endif
wait(2000)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(2000)

repeat
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag1)
endif
wait(1500)
a = a + 1
until a == 100

uo.findtype ( Gin, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '700', 'backpack')
endif
wait(2000)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(2000)

repeat
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag2)
endif
wait(1500)
a = a + 1
until a == 100

uo.findtype ( Gin, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '700', 'backpack')
endif
wait(2000)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(2000)

repeat
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag3)
endif
wait(1500)
a = a + 1
until a == 100

uo.findtype ( Gin, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '700', 'backpack')
endif
wait(2000)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(2000)

repeat
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag4)
endif
wait(1500)
a = a + 1
until a == 100

uo.findtype ( Gin, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '700', 'backpack')
endif
wait(2000)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(2000)

repeat
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag5)
endif
wait(1500)
a = a + 1
until a == 100

uo.findtype ( Gin, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '700', 'backpack')
endif
wait(2000)
uo.findtype ( Bottles, '0', '0x408D1619' )
if uo.findcount() then
uo.moveitem( 'finditem', '100', 'backpack')
endif
wait(2000)

repeat
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag6)
endif
wait(1500)
a = a + 1
until a == 100
endsub

(and so on for 20smallbags)

What Im tryin to make is a script which makes me 1 potion, moves it to a smallbag, then continues till 100, then moves to the second bag. (as you can see from my script)

any idea why it wont continue after smallbag 2??? something i'm doing wrong?

Thanks a lot and I really hope you can help me, ive tried to figure it out but I dont have the skill in scripting and ive looked all over the yoko page,.
Kynep
Expert!
Posts: 1348
Joined: 2006-02-07 08:51:40
Location: г. Старый Оскол
Contact:

Post by Kynep »

sylar wrote:Hey Kynep, what you gave me seems to work very well as a loop and I did it and it all worked except one thing.


Look:

Code: Select all

repeat 
uo.usetype("0x0F85")
wait(28000)

uo.findtype( '0x0F0C', '-1', 'backpack' )
if uo.findcount() then
uo.moveitem( 'finditem', '0', Smallbag1)
endif
wait(1500)
a = a + 1
until a == 100

a = 0

You need add "a = 0" after all sections of repeat-until. Try.
sylar
Posts: 7
Joined: 2007-12-12 10:33:30

Post by sylar »

yeah worked perfectly, thanks again man.
Post Reply