Signup Now
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Free User
    Join Date
    Dec 2013
    Posts
    10
    Reputation
    10
    Rep Power
    0

    Simulate reachcreature() with arrow keys instead of map-clicking

    The reason I made this was so I could use it together with a navigation connection to hunt on my ED + EK by only actually playing the EK just for fun.
    Because the built in reachcreature() function uses map-clicks to walk, it is a lot harder to make it cast runes with crosshairs, equip rings etc, which is something that doesn't happen if you walk with arrow keys. So well, that's about it, have fun using it or something : )

    function reachcreature_keys(cr, reachDir)
    c = getcreature(cr)
    if (c.dist > reachDir) then
    auto(50,150)
    keyevent(getMoveDir(c))
    else
    auto(200,400)
    end
    end

    function getMoveDir(c)
    walkRight = false
    walkLeft = false
    walkUp = false
    walkDown = false
    VK_LEFT = "Left"
    VK_RIGHT = "Right"
    VK_UP = "Up"
    VK_DOWN = "Down"

    if (c.posx > $posx and tilewalkable($posx+1, $posy, $posz)) then
    walkRight = true
    end
    if (c.posx < $posx and tilewalkable($posx-1, $posy, $posz)) then
    walkLeft = true
    end
    if (c.posy > $posy and tilewalkable($posx, $posy+1, $posz)) then
    walkDown = true
    end
    if (c.posy < $posy and tilewalkable($posx, $posy-1, $posz)) then
    walkUp = true
    end


    dir = math.random(1, 100)

    if (walkUp and walkLeft) then
    --print('walk up and left')
    if (dir > 50) then
    --print('walk left')
    return VK_LEFT
    elseif (dir <= 50) then
    --print('walk up')
    return VK_UP
    end
    elseif (walkUp and walkRight) then
    --print('walk up and right')
    if (dir > 50) then
    --print('walk right')
    return VK_RIGHT
    elseif (dir <= 50) then
    --print('walk up')
    return VK_UP
    end
    elseif (walkDown and walkLeft) then
    --print('walk down and left')
    if (dir > 50) then
    --print('walk left')
    return VK_LEFT
    elseif (dir <= 50) then
    --print('walk down')
    return VK_DOWN
    end
    elseif (walkDown and walkRight) then
    --print('walk down and right')
    if (dir > 50) then
    --print('walk right')
    return VK_RIGHT
    elseif (dir <= 50) then
    --print('walk down')
    return VK_DOWN
    end
    elseif (walkDown) then
    --print ('walk only down')
    return VK_DOWN
    elseif (walkUp) then
    --print ('walk only up')
    return VK_UP
    elseif (walkLeft) then
    --print ('walk only left')
    return VK_LEFT
    elseif (walkRight) then
    --print ('walk only right')
    return VK_RIGHT
    end
    end

    auto(200,400)
    reachcreature_keys('Captain Fearless', 1)

  2. #2
    Free User Donatello's Avatar
    Join Date
    Dec 2013
    Location
    Tuscany, Italy
    Posts
    398
    Reputation
    51
    Rep Power
    21
    Actually, if you have: Walk w/ arrow keys enabled, it'll walk using arrow keys.

  3. #3
    Free User L!p3's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    52
    Reputation
    21
    Rep Power
    21
    Quote Originally Posted by Donatello View Post
    Actually, if you have: Walk w/ arrow keys enabled, it'll walk using arrow keys.
    I think he said that because reachcreature() doesn't walk over magic fields.



    Mammoths X1 [30+]
    EK | RP
    Mutated Temple [80+]
    EK | RP
    Middle Vampire Crypt [90+]
    ED/MS
    Isle of Strife [140+]
    EK
    Edron Vampire Crypt [170+]
    ED/MS
    Edron Behemoths [235+]
    ED/MS
    Rathleton Sewers [240+]
    RP
    Hardcore Draken Walls [400+]
    EK

  4. #4
    Free User Donatello's Avatar
    Join Date
    Dec 2013
    Location
    Tuscany, Italy
    Posts
    398
    Reputation
    51
    Rep Power
    21
    Quote Originally Posted by L!p3 View Post
    I think he said that because reachcreature() doesn't walk over magic fields.
    It does walk, if you have these IDs on Walkable IDs.

  5. #5
    Free User
    Join Date
    Dec 2013
    Posts
    10
    Reputation
    10
    Rep Power
    0
    Quote Originally Posted by Donatello View Post
    Actually, if you have: Walk w/ arrow keys enabled, it'll walk using arrow keys.
    It doesn't, believe me, that's the first thing I tried. Or does it only use that setting if the cavebot is actually enabled? Because I set it to Walk with arrow keys and tried reachcreature() before writing this, but I didn't have cavebot enabled, maybe that's it.

  6. #6
    Free User Donatello's Avatar
    Join Date
    Dec 2013
    Location
    Tuscany, Italy
    Posts
    398
    Reputation
    51
    Rep Power
    21
    I tested by myself, you don't need to have cavebot enabled, well anyway u can test it !

  7. #7
    Free User L!p3's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    52
    Reputation
    21
    Rep Power
    21
    Quote Originally Posted by Donatello View Post
    It does walk, if you have these IDs on Walkable IDs.
    No, it doesn't.



    Mammoths X1 [30+]
    EK | RP
    Mutated Temple [80+]
    EK | RP
    Middle Vampire Crypt [90+]
    ED/MS
    Isle of Strife [140+]
    EK
    Edron Vampire Crypt [170+]
    ED/MS
    Edron Behemoths [235+]
    ED/MS
    Rathleton Sewers [240+]
    RP
    Hardcore Draken Walls [400+]
    EK

  8. #8
    Free User Donatello's Avatar
    Join Date
    Dec 2013
    Location
    Tuscany, Italy
    Posts
    398
    Reputation
    51
    Rep Power
    21
    Quote Originally Posted by L!p3 View Post
    No, it doesn't.
    Check it by yourself then

  9. #9
    Free User
    Join Date
    Dec 2013
    Posts
    10
    Reputation
    10
    Rep Power
    0
    Quote Originally Posted by Donatello View Post
    I tested by myself, you don't need to have cavebot enabled, well anyway u can test it !
    Which version are you using? WindBot beta for Tibia 11 or the one for Tibia 10? I'm using the one for Tibia 11 and it always used map-clicks when using reachcreature, even if I set it to walk with arrow keys. How do you know it isn't using map-clicks btw? Have you tried shooting runes or equipping items at the same time? If walking with arrow keys there should be no problem doing so, if walking with map-clicks it will be delayed or won't function

  10. #10
    Free User Donatello's Avatar
    Join Date
    Dec 2013
    Location
    Tuscany, Italy
    Posts
    398
    Reputation
    51
    Rep Power
    21
    Open Debug Log and call reachcreature() then you will know if it uses Arrow or Map Clicks.

    Edit: also i'm using Wb for tibia 11.

    Edit 2: Also you can set input to control mouse i.e.
    Last edited by Donatello; 01-13-2017 at 03:00 PM.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •