blackdtools / Blackd-Proxy-CLASSIC

Blackd Proxy CLASSIC
MIT License
9 stars 7 forks source link

setAvoidFront not working properly #33

Open Beggari opened 8 years ago

Beggari commented 8 years ago

setAvoidFront is not working properly right now on version 37.1 for tibia 10.90 (and I think it's not working properly for a long time).

Sometimes it goes on diagonal of the monster, sometimes it doesn't. Most of the time it stands diagonal for the first time (when you go to the monster or he comes for you), but after that what happens is pretty random. Sometimes it goes diagonal for more 2~3 times with a 1~2s delay after the monster is facing you, sometimes it goes diagonal after 5~8s or it just doesn't.

I have tried MANY different ways to see if I found a way around, like using setfollow, setnofollow, setting auto follow on client on/off, changing the timer on cavebot to high/low, no delay, high delay, tried different monsters... It was the same on every way.

BUT I found something that might help. When you log in for the first time, you can't attack/be attacked for X seconds (blackd still tries to attack in this period) and while this protection lasts, the diagonal command works pretty well; after that, it goes back to normal or works for a few more seconds on that monster.

Tested it some days ago and I tested today again on 17/Jan/16 using different methods, on official Tibia, of course.

Let me know if I can help you somehow doing some tests (in game tests that would take your time, I'm not a programmer).

By the way, are you accepting proposals ?

divinity76 commented 8 years ago

also works very bad on 7.6. Daniel has very little time for BlackD Proxy these days, if this issue is important for you, i suggest you check out http://www.blackdtools.net/showthread.php?59701-New-paid-service-I-can-make-update-functions-for-your-programs , he can probably fix it fast for a resonnable fee ^^

Beggari commented 8 years ago

Yea, I know. This would take a lot of his time (I think), but it's not really worth the money, because with that money you can just buy months of windbot.

Blackd is enough for me and I really like it. It would just be a plus if it stood diagonally correctly.

Nrated commented 8 years ago

It would be much more easier to make simple function outside of cavebot(conditional event for example) if currently targeted monster is facing in your position then call some exiva function to move around

divinity76 commented 8 years ago

afaik, conditional events does not have any (easy) way to see "is the square to right available? is the square to the left available? ~", sure we could make 1 though; but better just fix the source code version of setAvoidFront ..

i have traced the code to modCavebot -> DoSpecialCavebot -> https://github.com/blackdtools/Blackd-Proxy-CLASSIC/blob/026d0496569d0ee378d2218e0bed2afcf6358b91/modCavebot.bas#L2636

    If doingAvoid = True Then
        If CavebotLastSpecialMove(idConnection) < GetTickCount() Then
            If ((xt = X + 1) Or (xt = X - 1) Or (xt = X)) And yt = y Then  '  move north or south
                cost1 = myMap.cost(X, y - 1)
                cost2 = myMap.cost(X, y + 1)
                If (cost1 < CostBlock) And _
                   ((cost1 < cost2) Or ((cost1 = cost2))) Then
                    opt1 = &H65 ' north
                End If
                If (cost2 < CostBlock) And _
                   ((cost2 < cost1) Or ((cost2 = cost1))) Then
                    opt2 = &H67 ' south
                End If
            ElseIf ((yt = y + 1) Or (yt = y - 1) Or (yt = y)) And xt = X Then '  move left or right
                cost1 = myMap.cost(X - 1, y)
                cost2 = myMap.cost(X + 1, y)
                If (cost1 < CostBlock) And _
                   ((cost1 < cost2) Or ((cost1 = cost2))) Then
                    opt1 = &H68 ' left
                End If
                If (cost2 < CostBlock) And _
                   ((cost2 < cost1) Or ((cost2 = cost1))) Then
                    opt2 = &H66 ' right
                End If
            End If
            If ((opt1 > 0) And (opt2 > 0)) Then
                If chooseFirst = True Then
                    DoManualMove idConnection, opt1
                    DoEvents
                    CavebotLastSpecialMove(idConnection) = GetTickCount() + cte_RepositionDelay
                    DoSpecialCavebot = 0
                Else
                    DoManualMove idConnection, opt2
                    DoEvents
                    CavebotLastSpecialMove(idConnection) = GetTickCount() + cte_RepositionDelay
                    DoSpecialCavebot = 0
                End If
            ElseIf opt1 > 0 Then
                DoManualMove idConnection, opt1
                DoEvents
                CavebotLastSpecialMove(idConnection) = GetTickCount() + cte_RepositionDelay
                DoSpecialCavebot = 0
            ElseIf opt2 > 0 Then
                DoManualMove idConnection, opt2
                DoEvents
                CavebotLastSpecialMove(idConnection) = GetTickCount() + cte_RepositionDelay
                DoSpecialCavebot = 0
            End If
            Exit Function
        End If

i have no idea what's wrong with it though - i might look more into it later

Nrated commented 8 years ago

Well i just tested setAvoidFront on tibia 7.6 and it works perfecly for me. Idk about higher tibia versions though

Beggari commented 8 years ago

If someone manages to find a way to fix it, I can pay like 500k on Unitera.

blackdtools commented 8 years ago

I am afraid this odd bug have no easy solution and I must admit that this part of the code is a hell. I had some diagrams of the whole cavebot logic, hand written in papers, but I lost all them so now it is hard to fix it even for me. I am afraid it does not have an easy solution.

Beggari commented 8 years ago

Damn ;c

I guess there's nothing to do then T.T