Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
[C#]TibiaAPI Project: TP Bot.
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36

Thread: [C#]TibiaAPI Project: TP Bot.

  1. #1
    Administrator
    Join Date
    Mar 2007
    Posts
    436

    Arrow [C#]TibiaAPI Project: TP Bot.

    As of now I am putting togheter a simple bot using TibiaAPI, which will hopefully be of use to others who wants to learn how to program with TibiaAPI, and how easy it is. As of now I have probably spent 10-15 hours putting togheter the functions I've got now. It doesn't take long to figure stuff out, although I have had a lot of help with the syntax since I am not familiar with VC# from Blaster_89 and Jo3Bingham.

    The bot has the current functions:
    - Light
    - Eat food
    - Anti-Idle (dances)
    - SpellTrainer
    - Walker with: ladder, rope, walk(Still need to create the "move" feature for holes and stairs.
    - Attacker: As of now attacks everything that is attacking you. It's not very advanced.
    - Looter: Only loots, doesn't open corpses yet.
    - Healer: Only spell healer, working on potion/rune healing.

    If anyone has some code that I could implement for any of these functions would be great, please post them here or send them to me through PM.

    Upon release the project will be open source, so anyone can take use of the code. Therefore I am trying to make it as clean as possible, and I will add comments as best as I can. There will also probably be a wiki.

    So please help contribute to make this project go faster!


  2. #2

    RE: [C#]TibiaAPI Project: TP Bot.

    an example of how do I move the character
    [code=csharp]
    switch (_waypoint.Type)
    {
    //STAND
    case WaypointType.Stand:
    if (_player.Location == _l)
    {
    _index++;
    }
    else
    {
    if (!_player.IsWalking && _player.Location.Z == _l.Z)
    {
    switch (_waypoint.Direction)
    {
    case WaypointDirection.Center:
    _player.GoTo = _l;
    break;
    case WaypointDirection.North:
    _l.Y = _l.Y - 1;
    _player.GoTo = _l;
    break;
    case WaypointDirection.South:
    _l.Y = _l.Y + 1;
    _player.GoTo = _l;
    break;
    case WaypointDirection.West:
    _l.X = _l.X - 1;
    _player.GoTo = _l;
    break;
    case WaypointDirection.East:
    _l.X = _l.X + 1;
    _player.GoTo = _l;
    break;
    }
    }
    }
    break;
    }
    [/code]
    I'm not sure if this is the best way to implement the walk, but it works.

  3. #3

    RE: [C#]TibiaAPI Project: TP Bot.

    [code=vbnet]
    Private Sub WalkDirection(ByVal Direction As String)
    StatAction.Text = "Walking " & Direction
    Select Case Direction
    Case "North"
    p.Walk(Constants.Direction.Up)
    Case "North East"
    p.Walk(Constants.Direction.UpRight)
    Case "North West"
    p.Walk(Constants.Direction.UpLeft)
    Case "South"
    p.Walk(Constants.Direction.Down)
    Case "South East"
    p.Walk(Constants.Direction.DownRight)
    Case "South West"
    p.Walk(Constants.Direction.DownLeft)
    Case "West"
    p.Walk(Constants.Direction.Left)
    Case "East"
    p.Walk(Constants.Direction.Right)
    End Select

    End Sub
    [/code]

    It will walk in all directions but wont walk over a hole to go down. I don't know why. Any ideas?

  4. #4
    Administrator
    Join Date
    Mar 2007
    Posts
    436

    RE: [C#]TibiaAPI Project: TP Bot.

    I think it might be because you are using the direction and such instead of reading it from the waypoint list like,

    When you are adding waypoints to the waypoint list make sure it adds +1 or -1 to player.X or player.Y depending on the direction you want it to go.
    Then simply

    [code=csharp]player.GoTo = waypoint.Location;[/code]

  5. #5
    Super Moderator klusbert's Avatar
    Join Date
    Dec 2007
    Posts
    1,201

    RE: [C#]TibiaAPI Project: TP Bot.

    -x|+y
    -------
    -y|+x
    [code=vbnet]
    Dim Loc As Objects.Location = Core.PlayerLocation
    Select Case ComboBox1.Text
    Case "North"
    Loc.Y -= 1
    Case "South"
    Loc.Y += 1
    Case "West"
    Loc.X -= 1
    Case "East"
    Loc.X += 1
    End Select
    Core.CaveHuntForm.AddWalk("Ramp", Loc)
    [/code]

  6. #6

    RE: [C#]TibiaAPI Project: TP Bot.

    I tried using the goto with the modification but it still wont walk over the hole or ramp. It will go everywhere else tho. I am using Klusberts TibiaAPI.DLL. I already had the WalkDirection sub written for walking diagonal of a target.

  7. #7
    Senior Member
    Join Date
    Aug 2010
    Posts
    532

    RE: [C#]TibiaAPI Project: TP Bot.

    Quote Originally Posted by Aggressive Prefector
    I tried using the goto with the modification but it still wont walk over the hole or ramp. It will go everywhere else tho. I am using Klusberts TibiaAPI.DLL. I already had the WalkDirection sub written for walking diagonal of a target.
    Use a breakpoint in that function and check where is the error.

  8. #8

    RE: [C#]TibiaAPI Project: TP Bot.

    I fixed the error but I still don't fully understand it. I was slitting the waypoint each time correctly except for the last part.
    [code=vbnet]
    Dim WayPointArray() As String = WayPoint.Split(", ") 'Breaks the WayPoint List box item into an array
    [/code]
    It was reading everything right except the last one it was giving a space at the beginning. I removed all spacing in the waypoint and just used ",". By all rights there should be no difference between the first few splits and the last one.

  9. #9
    Senior Member
    Join Date
    Aug 2010
    Posts
    532

    RE: [C#]TibiaAPI Project: TP Bot.

    To remove spaces between words etc use .Trim(), it better than Split a char and a space like you did ", "

  10. #10
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: [C#]TibiaAPI Project: TP Bot.

    Even better is to not fuck around with string splitting and use a listbox like it was intended. Write a waypoint class and add an instance to the listbox, then you can use it like so:
    [code=c#]
    Waypoint wp = (Waypoint)listBox1.SelectedItem;
    [/code]

Posting Permissions

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