Page 1 of 1

2 проверки

Posted: 2007-02-03 14:11:03
by z-_-
есть скрипт, но в нем не хватает двух проверок, проверка на голод и потребелние еды, и проверка стамины.
Поможете?

Posted: 2007-02-03 18:19:38
by z-_-
вот скрипт

Code: Select all

sub main()

    lumberjack(10) # В склбках указать радиус деревьев

end sub



sub lumberjack(distance)

    var this_tree, treenum=0, tree_num,x,y, hatchet

    dim tree[4]

    tree[0]="0x0DA4" # - pear tree

    tree[1]="0x0DA0" # - peach tree

    tree[3]="0x0D98" # - apple tree

    tree[2]="0x0CAA" # - banana tree

    hatchet="0x0F43" # Тип топора

    uo.disarm()

    uo.ignorereset()

    uo.set("finddistance",str(distance))

    repeat

        tree_num=0

        repeat

            uo.findtype(tree[tree_num],"-1","ground")

            this_tree=uo.getserial("finditem")

            tree_num=tree_num+1

        until tree_num>3 or this_tree<>"0x00000000"

        if this_tree<>"0x00000000" then

            treenum=treenum+1

            uo.waittargetobject(this_tree)

            uo.addobject("tree"+str(treenum))

            uo.ignore(this_tree)

        endif

    until this_tree=="0x00000000"

    uo.ignorereset()

    while not uo.dead()

        for tree_num=1 to treenum

            if uo.dead() then

                return

            endif

            this_tree=uo.getserial("tree"+str(tree_num))

            go_to(this_tree)

            uo.deletejournal()

            uo.waittargetobject(this_tree)

            uo.usetype(hatchet)

            repeat

                wait(100)

            until uo.injournal("away") or uo.injournal("stop lumberjacking.")

        next

    wend

end sub



sub go_to(what)

    var x,y,dist_x,dist_y,dx,dy

    repeat

        dist_x=uo.getx()-uo.getx(what)

        dist_y=uo.gety()-uo.gety(what)

        dx=35+sign(dist_x)

        dy=34-sign(dist_y)

        x=uo.getx()

        y=uo.gety()

        if abs(dist_x)>2 then

            uo.press(dx)

            uo.press(dx)

        endif

        if abs(dist_y)>2 then

            uo.press(dy)

            uo.press(dy)

        endif

        if abs(dist_x)==abs(dist_y) and abs(dist_y)>2 then

            if dx==36 and dy==33 then

                uo.press(38)

                uo.press(38)

            endif

            if dx==36 and dy==35 then

                uo.press(37)

                uo.press(37)

            endif

            if dx==34 and dy==33 then

                uo.press(39)

                uo.press(39)

            endif

            if dx==34 and dy==35 then

                uo.press(40)

                uo.press(40)

            endif

        endif

    until abs(dist_x)<=2 and abs(dist_y)<=2

end sub



sub abs(x)

var y

if x<0 then

y=-x

else

y=x

endif

return y

end sub



sub sign(what)

var ret

if what<0 then

ret=-1

else

ret=1

endif

return ret

end sub



sub grabs()

var what

repeat

uo.findtype("0x0E76","-1","ground")

what=uo.getserial("finditem")

if what<>"0x00000000" then

uo.waittargetobject(what)

uo.grab()

uo.ignore(what)

endif

until what=='0x00000000'

end sub


вот скрипт, надо еще 2 проверки:
на стамину -

Code: Select all

sub rest()
if UO.Stamina<stamlow then
   uo.print("Rest...")
   repeat
      uo.exec("waittargettype 0x0F43")
      uo.exec("useskill 'Arms Lore'")
      wait(10000)
      if not uo.IsOnline() then
         reconnect()
      endif
   until (UO.Stamina==uo.dex) or recd
endif
end sub

и на голод

Code: Select all

var eda=0x0D3A #Fish stakes

next
UO.DeleteJournal()
uo.say(".hungry")
wait(3000)
if not UO.InJournal("stuffed") then
UO.DeleteJournal()   
while (not (UO.InJournal("stuffed")))
uo.usetype(eda)
wait(1000)
wend
endif
wend
end sub


Помогите плиз вставить две проверки