Помогите с ламбером

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
sluntai
Posts: 66
Joined: 2008-05-13 17:04:26

Помогите с ламбером

Post by sluntai »

Народ помогите со скриптом плз.Сам по себе скрипт хороший вот только чар часто встает уткнувшись в камень или еще в какую нибудь гадость в лесу))Помогите пожалуйста поправить чтоб чар как нибудь обходил эти камни,кочки и т д если конечно это реально.
Спасибо.

Code: Select all

#*** ©много кто + Я ^_^
VAR mx=5907, my=2850 #0 5907 2850
VAR log= '0x1BDD'   
VAR sund= '0x400D391C';ID сундука для логов    в банке
VAR hatchet = '0x0F43'; топор проверить!
VAR MaxRange = 3; радиус рубки
VAR MaxWeight = 200; максимальный вес по классам
VAR file='D:\main.txt'; файлик с координатами
#**** НИЖЕ НИЧЕГО НЕ ПРАВИТЬ****
VAR X, Y,  k = 0, step_timeout = 800, LastTimer, i = 0, f
VAR continue    =    'chop|reach this'
VAR break        =     'You can|too far away'
#*********************************
sub main()
    f = file ( file )
    f.open()
    var cnt = f.readNumber()
    DIM tile_x[ val( str( cnt ) ) ]
    DIM tile_y[ val( str( cnt ) ) ]
    DIM tile_z[ val( str( cnt ) ) ]
    while not f.eof()
        tile_x[ i ] = f.readNumber()
        tile_y[ i ] = f.readNumber()
        tile_z[ i ] = f.readNumber()
        i = i + 1
    wend
    f.close()
repeat
    desWalker( mx, my )
    if uo.getX() <> mx && uo.getY() <> my then
        UO.Print("НЕ В ЗОНЕ РУБКИ!!!")
        MyTerminate()
    endif
    for i = 0 to cnt -1
        desWalker( tile_x[i], tile_y[i] )
        Lumder()
    next
DownWeight()
until UO.Dead()
endsub
Sub Lumder()
    for Y = -MaxRange to MaxRange
        for X = -MaxRange to MaxRange
            if Tree(UO.GetX()+X, UO.GetY()+Y) then
                repeat
                    UO.Set('quiet','0')
                    UO.DeleteJournal()
                    UO.Warmode(0)
                    wait(100)
                    If UO.Weight > MaxWeight Then
                        UO.Print('Перегруз!')
                        return 0
                    endif
                    If UO.Life < Uo.Str/10 then
                        UO.Print('А мы умираем!')
                        return 0
                    endif
         
                    UO.WaitTargetTile(Tree(UO.GetX()+X, UO.GetY()+Y), UO.GetX()+X, UO.GetY()+Y, UO.GetZ())
                    UO.UseType(hatchet)
                    LastTimer=UO.Timer()                   
                    k=k+1
                    repeat
                        wait( 100 )
                    until UO.InJournal( break + "|" + continue ) || UO.Timer()>LastTimer+200 || UO.Weight > MaxWeight || UO.Dead()
                    if k>10 then
                        UO.Print('Что-то крепкое попалось!')
                        return 0
                    endif
                    If UO.Weight > MaxWeight Then
                        UO.Print('Перегруз!')
                        return 0
                    endif
                until UO.InJournal( break ) || UO.Dead()
            endif
        next
    next
    return 0
end sub
Sub Tree(X,Y)
    var j
    DIM  R[34]
    R[1] = 3274;
    R[2] = 3275;
    R[3] = 3276;
    R[4] = 3277;
    R[5] = 3280;
    R[6] = 3283;
    R[7] = 3286;
    R[8] = 3288;
    R[9] = 3290;
    R[10] = 3293;
    R[11] = 3296;
    R[12] = 3299;
    R[13] = 3302;
    R[14] = 3320;
    R[15] = 3323;
    R[16] = 3326;
    R[17] = 3329;
    R[18] = 3393;
    R[19] = 3394;
    R[20] = 3395;
    R[21] = 3396;
    R[22] = 3415;
    R[23] = 3416;
    R[24] = 3417;
    R[25] = 3418;
    R[26] = 3419;
    R[27] = 3438;
    R[28] = 3439;
    R[29] = 3440;
    R[30] = 3441;
    R[31] = 3442;
    R[32] = 3460;
    R[33] = 3461;
    R[34] = 3462;
    for j = 1 to 34
        if uo.privategettile( x, y, -1, R[j], R[j]) then
            return R[j]
        endif
    next
    return false
end sub
##############################################
Sub DownWeight()
uo.say('bank')
    PUT(log, sund)
    UO.Print('Разгрузился.')
endsub
Sub PUT(item, cont)
    while UO.Count( item ) > 0
        UO.FindType( item, -1, -1 )
        UO.MoveItem( 'finditem', 0, cont )
        checklag()
    wend
end sub
Sub desWalker( x, y )
    var dir, key, mx, my, timer
    if x== uo.getX() && y == uo.getY() then
        return false
    endif
    repeat
        mx = uo.getX()
        my = uo.getY()
        key = getWalkDir( x-mx, y-my, 0, 0 )
        dir = getWalkDir( x-mx, y-my, 1, 0 )
        if Not uo.getDir() == dir then
            uo.press( key, 2 )
        else
            uo.press( key )
        endif
        timer = 0
        while uo.getX() == mx && uo.getY() == my && step_timeout / 100 > timer
            wait( 100 )
            timer = timer + 1
        wend
    until uo.getX() == x && y == uo.getY()
endsub
Sub getWalkDir(x, y, type, walk)
    DIM keys[8]
    if type == 0 then
        if walk == 0 then
            keys[0] = 35; End
            keys[1] = 40; Down
            keys[2] = 34; Page Down
            keys[3] = 39; Right
            keys[4] = 33; Page Up
            keys[5] = 38; Up
            keys[6] = 36; Home
            keys[7] = 37; Left
        else
            keys[0] = 33; Page Up
            keys[1] = 38; Up
            keys[2] = 36; Home
            keys[3] = 37; Left
            keys[4] = 35; End
            keys[5] = 40; Down
            keys[6] = 34; Page Down
            keys[7] = 39; Right
        endif
    else
        if walk == 0 then
            keys[0] = 4; End
            keys[1] = 3; Down
            keys[2] = 2; Page Down
            keys[3] = 1; Right
            keys[4] = 0; Page Up
            keys[5] = 7; Up
            keys[6] = 6; Home
            keys[7] = 5; Left
        else
            keys[0] = 0; Page Up
            keys[1] = 7; Up
            keys[2] = 6; Home
            keys[3] = 5; Left
            keys[4] = 4; End
            keys[5] = 3; Down
            keys[6] = 2; Page Down
            keys[7] = 1; Right
        endif
    endif
    if x==0 && y > 0 then
        return keys[0]
    endif
    if x==0 && y < 0 then
        return keys[4]
    endif
    if x > 0 && y == 0 then
        return keys[2]
    endif
    if x < 0 && y == 0 then
        return keys[6]
    endif
    if x > 0 && y > 0 then
        return keys[1]
    endif
    if x > 0 && y < 0 then
        return keys[3]
    endif
    if x < 0 && y > 0 then
        return keys[7]
    endif
    if x < 0 && y < 0 then
        return keys[5]
    endif
       if x > 0 && y > 0 then
        return keys[7]
    endif
       if x > 0 && y > 0 then
        return keys[7]
    endif
       if x > 0 && y > 0 then
        return keys[3]
    endif
endsub
Sub DeleteJournal(msg)
    While UO.InJournal(msg)
        UO.SetJournalLine(UO.InJournal(msg) - 1,'')
    wend
endsub
Sub MyTerminate()
    UO.Set('quiet','1')
    UO.IgnoreReset()
    UO.Set('quiet','0')
    UO.Exec('terminate all')
end sub
Sub checklag()
    DeleteJournal("ackpack")
    UO.Click("backpack")
    repeat
        wait(100)
    until UO.InJournal("ackpack")
end sub
Sub GMstep()
    If UO.Dead() Then
        UO.Print("You are Dead")
        Return
    End If
    If UO.GetGlobal('GMstepCheck')=='on' Then
        UO.SetGlobal('GMstepCheck','off')
        UO.Print("GM Step: Off")
        UO.Morph('0')
    Else
        UO.SetGlobal('GMstepCheck','on')
        UO.Print("GM Step: On")
        UO.Morph('0x03DB')
        Wait(100)
        UO.Msg(".resync")
    End If
end sub


Code: Select all

79
5907 2850 0
5904 2858 0
5884 2871 0
5879 2886 0
5863 2889 0
5842 2890 0
5828 2893 0
5796 2905 0
5686 2906 0
5559 2907 0
5560 2902 0
5557 2898 0
5559 2892 0
5556 2888 0
5555 2882 0
5554 2878 0
5555 2867 0
5547 2865 0
5547 2857 0
5543 2854 0
5540 2847 0
5545 2842 0
5547 2836 0
5542 2835 0
5550 2829 0
5546 2824 0
5548 2817 0
5553 2819 0
5552 2811 0
5561 2807 0
5569 2806 0
5577 2805 0
5581 2800 0
5578 2797 0
5574 2791 0
5568 2791 0
5561 2791 0
5556 2793 0
5558 2799 0
5559 2805 0
5555 2804 0
5551 2808 0
5547 2811 0
5546 2816 0
5543 2817 0
5537 2820 0
5537 2820 0
5538 2823 0
5535 2829 0
5533 2832 0
5536 2837 0
5531 2839 0
5532 2844 0
5525 2843 0
5527 2847 0
5524 2858 0
5528 2860 0
5539 2865 0
5544 2874 0
5545 2880 0
5544 2888 0
5546 2893 0
5549 2897 0
5551 2903 0
5549 2904 0
5550 2910 0
5566 2928 0
5595 2929 0
5693 2927 0
5711 2906 0
5737 2906 0
5815 2905 0
5839 2889 0
5863 2890 0
5863 2890 0
5882 2884 0
5889 2862 0
5907 2856 0
5907 2850 0
Beyonder
Expert!
Posts: 388
Joined: 2005-04-23 10:19:43
Contact:

Re: Помогите с ламбером

Post by Beyonder »

Описываю по пунктам:
1) Выбираешь ходилку которая тебе нравится отсюда: viewtopic.php?f=20&t=6743
2) Копируешь ходилку со всеми потрохами себе в конец кода.
3) Заменяешь в скрипте вызовы функции хождения "desWalker" на функцию взятую с ходилки.
Всё.

Вот переделанный твой скрипт на примере моей ходилки: http://pastebin.ca/1903722
Или в чистом виде (правда с кодировкой глюки): http://pastebin.ca/raw/1903722
Post Reply