Blacksmithing

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Guska
Posts: 24
Joined: 2004-12-30 16:47:14

Blacksmithing

Post by Guska »

Что в скрипте не так? когда остается 1-2 инга он не берёт из сндка новю партию ингов

Code: Select all

sub Blacksmithing() 
var Exit=0, LastTimer, Container='0x4005b307', Forge='0x4023840c' ;Cундук в котором инги и форж.
var CountIng=700 ;Скока ингов поднимает чар
var MenuIron="'Blacksmithing' 'Weapons'"
var MenuOther="'Colored' 'Weapons'"
var MenuSwords="Weapons' 'Swords'"
var MenuDagger="'Swords' '(3'"
var i=0

dim ColorOfIng[6]
dim NameOre[6]

NameOre[0]="'"
NameOre[1]="'Rusty "
NameOre[2]="'Old Copper "
NameOre[3]="'Dull Copper "
NameOre[4]="'Bronze "

ColorOfIng[0]='0x0000' ; Iron
ColorOfIng[1]='0x0750' ; Rusty
ColorOfIng[2]='0x0590' ; Old Copper
ColorOfIng[3]='0x060A' ; Dull Copper
ColorOfIng[4]='0x0488' ; Bronze


uo.UseObject(Container)
while not uo.Dead()
for i=0 to 4
uo.FindType('0x1BEF',ColorOfIng[i],Container)
if uo.GetQuantity('finditem')>10 then
uo.Grab(STR(CountIng),'finditem')
wait(1000)
             
uo.Exec('automenu '+MenuDagger)
uo.Exec('automenu '+NameOre[i]+MenuSwords)
if i>0 Then
uo.Exec('automenu '+MenuOther)
end if
uo.Exec('automenu '+MenuIron)
             
While Exit<>1
uo.DeleteJournal()
LastTimer=uo.Timer()
               
uo.UseType(0x1BEF) 

while not uo.InJournal("You put") and not uo.InJournal("You have failed")
wait(100)
wend

if uo.InJournal("You have failed") then
repeat
wait(100)
until uo.Timer()>=LastTimer+100 ; Время создания дагера
end if
CheckLag()

uo.FindType('0x0F51',-1,'backpack')

if uo.GetQuantity('finditem') then
uo.WaitTargetObject('finditem')
uo.UseObject(Forge) 
wait(100)
end if

uo.FindType('0x1BEF',-1,'backpack')
if uo.GetQuantity('finditem')<10 then
uo.FindType('0x1BEF',ColorOfIng[i],Container)
if uo.GetQuantity('finditem')<10 then
uo.FindType('0x1BEF',ColorOfIng[i],'backpack')
uo.SetReceivingContainer(Container)
uo.Grab('all','finditem')
uo.UnSetReceivingContainer()
Exit=1
end if
else
wait(1000)
uo.Grab(STR(CountIng-10),'finditem')
end if
wend
Exit=0
uo.CancelMenu()
end if
next
wend   
end sub

sub CheckLag()
if uo.Waiting()>0 then
uo.Exec("canceltarget")
end if
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until uo.InJournal('backpack')
end sub
Mirage
Posts: 2802
Joined: 2009-05-28 09:58:28
Location: Иваново
Contact:

Post by Mirage »

Code: Select all

uo.FindType('0x1BEF',-1,'backpack')
if uo.GetQuantity('finditem')<10 then


на

Code: Select all

if uo.count('0x1BEF')<10 then

замени
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Post by Savage »

Коунт считает количество кучек а не количество в кучке.
Mirage
Posts: 2802
Joined: 2009-05-28 09:58:28
Location: Иваново
Contact:

Post by Mirage »

Savage wrote:Коунт считает количество кучек а не количество в кучке.


1)Возвращает суммарное количество во всех стопках обьекта указаного типа type (и цвета color если указано) в вашем бекпаке и подсумках. Учитываются только те подсумки которые хоть раз открывались, иначе их содержимое не известно.

2)работают оба варианта всегда. Скрипт тестировался 40 часов без выключения.

Code: Select all

sub main() 
   GET(log, Container, 10, 300)
   GET(saw, Container, 1, 1)
end sub


Sub GET(item, cont, min, max)          ;    предмет, откуда, минимум, сколько брать
   If UO.Count( item ) < min Then
      #       UO.Print("Кончилось сырье в рукзаке")
      UO.FindType( item, '-1', cont )
      if UO.FindCount() > 0 Then
         #        UO.Print('Сырья в сундуке: ' + Str( UO.FindCount( item ) ) )
         uo.moveitem('finditem', max, 'backpack')
         checklag()
      else
         #           UO.Print( 'Полностью кончилось сырье' )
         UO.CancelMenu()
         return
      endif
   Endif
end sub
Post Reply