Results 1 to 3 of 3

Thread: Actions

  1. #1
    Administrator Jonatas's Avatar
    Join Date
    Feb 2012
    Posts
    1,193
    Mentioned
    452 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    220 Post(s)
    Reputation
    272
    Rep Power
    10

    Post Actions

    Por favor visite o tópico atualizado contendo toda a documentação:
    http://www.tibiaibot.com/forum/showthread.php?10378



    Events in iBot are operations that ultimately will perform some kind of action in the Tibia client be it by mouse or keyboard. The following functions create these events in order to achieve a particular purpose.
    The iBot uses the Lua language for creating scripts for their actions.
    The Lua scripts will be used in iBot in the following categories: HotKeys, Actions, cavebot, Hud.


    Actions em iBot são operações que vão realizar algum tipo de ação no Tibia seja por mouse ou teclado. As seguintes funções criam esses acontecimentos afim de atingir uma determinada finalidade.
    O iBot utiliza a linguagem Lua para criação de suas actions em scripts.
    Os scripts Lua serão utilizados no iBot nas seguintes categorias : HotKeys, Actions, CaveBot, Hud.
    Last edited by Raphael; 08-20-2012 at 12:00 AM.

  2. #2
    Administrator Jonatas's Avatar
    Join Date
    Feb 2012
    Posts
    1,193
    Mentioned
    452 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    220 Post(s)
    Reputation
    272
    Rep Power
    10
    Variables / Variáveis

    [Player]
    The following variables return information about your character.
    name (string): Returns the name of your character.
    id (int): Returns the creature Id of your character.
    hp (int): Returns your current amount of hit points.
    maxhp (int): Returns your maximum amount of hit points.
    mp (int): Returns your current amout of mana points.
    maxmp (int): Returns your maximum amount of mana points.
    cap (int): Returns your remaining capacity.
    stamina (int): Returns the remaining stamina in minutes.
    soul (int): Returns the remaining soul points.
    exp (int): Returns your total amount of experience points.
    level (int): Returns the level of your character.
    hppc (int): Returns the percentage of your character's hp.
    mppc (int): Returns the percentage of your character's mp.
    posx (int): Returns the x position of your character.
    posy (int): Returns the y position of your character.
    posz (int): Returns the z position of your character.

    [Skill]
    The following variables return information pertaining to your character's skills.
    mlevel (int): Returns the level of your magic skill.
    mlevelpc (int): Returns the percentage learnt of the magic skill.
    fist (int): Returns the level of your fist skill.
    club (int): Returns the level of your club skill.
    sword (int): Returns the level of your sword skill.
    axe (int): Returns the level of your axe skill.
    distance (int): Returns the level of your distance skill.
    shielding (int): Returns the level of your shielding skill.
    fishing (int): Returns the level of your fishing skill.
    fistpc (int): Returns the percentage learnt of the fist skill.
    clubpc (int): Returns the percentage learnt of the club skill.
    swordpc (int): Returns the percentage learnt of the swords skill.
    axepc (int): Returns the percentage learnt of the axe skill.
    distancepc (int): Returns the percentage learnt of the distance skill.
    shieldingpc (int): Returns the percentage learnt of the shielding skill.
    fishingpc (int): Returns the percentage learnt of the fishing skill.

    [Status]
    The following variables return information on your character's various states.
    battlesigned (bool): Returns true if your character is battle signed, false otherwise.
    drunk (bool): Returns true if your character is drunk, false otherwise.
    hasted (bool): Returns true if your character is hasted, false otherwise.
    manashielded (bool): Returns true if your character is mana shielded, false otherwise.
    paralyzed (bool): Returns true if your character is paralyzed, false otherwise.
    poisoned (bool): Returns true if your character is poisoned, false otherwise.
    pvpsigned (bool): Returns true if your character is pvp signed, false otherwise.
    pzone (bool): Returns true if your character is in a protection zone, false otherwise.

    [Equipaments]

    helmet (int): Returns the id of the item in your head slot.
    amulet (int): Returns the id of the item in your neck slot.
    back (int): Returns the id of the item in your back slot.
    armor (int): Returns the id of the item in your chest slot.
    shield (int): Returns the id of the item in your shield slot.
    weapon (int): Returns the id of the item in your weapon slot.
    weaponamount (int): Returns the amount of the item in your ammo slot.
    legs (int): Returns the id of the item in your legs slot.
    boots (int): Returns the id of the item in your feet slot.
    ring (int): Returns the id of the item in finger slot.
    ammo (int): Returns the id of the item in your ammo slot.
    mmoamount (int): Returns the amount of the item in your ammo slot.

    [Client Info]
    The following variables return various information relating to the game client.
    battleopen (bool): Returns true if the battle window is open, false otherwise.
    connected (bool): Returns true if connected to a server, false otherwise.
    focused (bool): Returns true if client is focused, false otherwise.
    minimized (bool): Returns true if client is minimized, false otherwise.
    openmenuname (string): Returns the name of the currently open menu/window or 'Context' if it's a context menu (with options like Attack/Use/Open etc).
    tradeopen (bool): Returns true if the trade window is open, false otherwise.

    [Bot Info]
    The following variables return various information calculated by the bot.
    balance (int): Returns the last bank balance amount reported by an NPC.
    cavebot (bool): Returns true if cavebot is enabled, false otherwise.
    expgained (int): Returns the exp gained since exp counter has been reset.
    exphour (int): Returns the average experience per hour since it's been reset.
    lootbodies (int): Returns the amount of loot bodies not yet looted being queued up for looting.
    looting (bool): Returns true if looting is enabled, false otherwise.
    standtime (int): Returns the time in milliseconds that your character has been standing still.
    targeting (bool): Returns true if targeting is enabled, false otherwise.
    timehunt (int): Returns the time in milliseconds that the exp counter has been running.
    timems (int): Returns the time in milliseconds since the system has started. Can be used for creating timers.
    wpt (pointer): Returns the data structure for current waypoint.

    [Waypoint properties]
    The following properties can be appended to a wpt pointer (ie: wpt.type) and return a value as defined.
    .id (int): Returns the id of the current waypoint.
    .type (string): Returns the type of the current waypoint.
    .x (int): Returns the x position of the current waypoint.
    .y (int): Returns the y position of the current waypoint.
    .z (int): Returns the z position of the current waypoint.

    [Creature]
    target (pointer): Returns the creature data structure of the creature you have attacked.
    follow (pointer): Returns the creature data structure of the creature you have followed.

    [Creature properties]
    The following properties can be appended to a creature pointer (ie: target.speed) and return a value as defined.
    .id (int): Returns the unique id of the creature.
    .name (string): Returns the creature's name.
    .posx (int): Returns the creature's x coordinate.
    .posy (int): Returns the creature's y coordinate.
    .posz (int): Returns the creature's z coordinate.
    .hppc (int): Returns the creature's health percentage.
    .speed (int): Returns the creature's speed.
    .dist (int): Returns the biggest distance in either x or y between the creature and your character.
    .isshootable (bool): Returns true can be shot from your position, false otherwise.
    .isreachable (bool): Returns true can be reach from your position, false otherwise.
    .skull (int): Returns the creature's skull type id.
    .party (int): Returns the creature's party type id.
    .warbanner (int): Returns the creature's warbanner type id.
    .ignored (bool): Returns true if creature is being ignored by the targeting system (if ignorecreature() was used on it), false otherwise.
    .isattackme (bool): Returns tru if creature is attacking, false otherwise.
    .ismonster (bool): Returns true if creature is a monster, false otherwise.
    .isplayer (bool): Returns true if creature is a player, false otherwise.

    [B][Position variables]
    The following variables return a pointer to a window rectangle or point data structure for which you can access various properties which will be outlined in the next two sections.
    clientwin (pointer): Returns the rectangle containing the measurements of the client window.
    worldwin (pointer): Returns the rectangle containing the measurements of the world window.


    [B][Tile properties]
    The following properties can be appended to a tile pointer (ie: gettile(7, 7, 7).count) and return a value as defined.
    .count (int): Returns the count of items on the tile.
    .items (pointer): Returns the data structure for an items on the tile.

    [B][Container properties]
    The following properties can be appended to a container pointer (ie: getcontainer(0).isopen) and return a value as defined.
    .id (int): Returns the item id of the container window.
    .name (string): Returns the name of the container window.
    .open (bool): Returns true if the container is open and false otherwise. Always check if a container is open before accessing it's other elements because values stay in memory even after the container has been closed.
    .items (pointer): Returns the data structure for an item in the container. You must index item with a value ranging from 1 to .itemcount to specify which item you want to access (ex: .item[1]).
    .usedslots (int): Returns the count of items in the container.
    .maxslots (int): Returns the maximum count of items that can be stored in the container.
    .index (int): Returns the index of the container window.

    [B][Item properties][B]
    The following properties can be appended to an item pointer (ie: gettile(7, 7, 7).items[1].id ) and return a value as defined.
    .id (int): Returns the id of the item.
    .count (int): Returns the amount of the item.


    More to come...

  3. #3
    Administrator Jonatas's Avatar
    Join Date
    Feb 2012
    Posts
    1,193
    Mentioned
    452 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    220 Post(s)
    Reputation
    272
    Rep Power
    10
    Functions / Funções

    [Functionality]

    • islocation(optional int range)
      Returns true if the action script is executed at the location where the action waypoint was set and false otherwise. If the optional parameter range is specified, return true/false if you are standing within range tiles of the waypoint location in x or y.

    • wait(int time, optional time2)
      Pauses execution of the current script for time milliseconds and resumes once that interval has elapsed. If the optional parameter time2 is specified, waits random amount between time and time2.

    • updateworld()
      Synchronization of all variables in bot with Lua.


    [Bot Control]

    • flashclient()
      Flashes the client window for around 5 seconds.

    • focusclient()
      Gives focus to the client window.

    • logout()
      Logs you out by pressing Ctrl+L if you are not battlesigned.

    • string getsetting(string settingpath)
      Gets the value of any setting in the bot as a string representation. The string settingpath must contain the full path of the setting such as "Settings/Healer/Healer/Enabled".

    • setsettings(string path, string value)
      Set the value of any setting in then bot as a string representation. string settingpath must contain the full path of the setting such as "Settings\\Healer\\Healer\\Enabled".

    • playsound(string filename)
      Plays sound filename (ex: "alert.wav") found in the bot's "\sounds" directory.

    • screenshot(optional string filename)
      Takes a screenshot of the entire client window. If filename is not specified, a filename with the character name and the current date and time will be created.

    • setalarms(string value)
      Set Alarms 'yes' or 'no'.

    • settargeting(string value)
      Set Targeting 'yes' or 'no'.

    • setlooting(string value)
      Set Looting 'yes' or 'no'.

    • setcavebot(string value)
      Set Cavebot'yes' or 'no'.


    [Access]

    • int exptolevel(optional int level)
      If level is not specified, returns the amount of exp left for next level. Otherwise, returns the amount of exp left for level level.

    • int itemid(string itemname)
      Returns the id of item.

    • string itemname(int itemid)
      Returns the name of the item.

    • int itemcount(string item, optional backpack)
      Returns the count of item with name/id as seen in open backpacks.

    • int servercountitem(string item)
      Returns the count of item with name/id as seen in the latest 'Using one of itemname...' message. It's called a server count because the server is counting the items for you while they don't have to be visible.

    • int windowcount(optional string locationname)
      Returns the count of windows that are currently open. Optionally, you can specify which windows to consider by providing the locationname parameter.


    [Client Information]

    • int toptileitem(int x, int y, int z)
      Returns the id of the tile's top item at given coordinates.

    • pointer itemproperty(id)
      Returns a pointer to the item datastructure.


    [Display HUD]

    • addtext(string text, int x, int y)
      Adds a text element with the previously specified font style to the current display at position x and y within the display.

    • setfontcolor(string color)
      Sets the color of the font to color.

    • setfontstyle(string name, int size, string style)
      Sets the name, size and style of the font.

    • setposition(int x, int y)
      Sets the top-left corner of the display to position x and y.

    • setposition(int width, int heigh)
      Sets the width and heigh of the display.

    • int rgbcolor(int red, int green, int blue)
      Return the rgb color used in setfontcolor.


    [CaveBot]

    • gotolabel(string labelname)
      Sets the next waypoint to be the waypoint with the label labelname. A label can be created by right clicking on a waypoint entry and typing a custom name for it.

    • reachgrounditem(string item)
      Moves your character to stand next to the closest item of id itemid found on the screen.
      Alternate invocations:
      reachgrounditem("depot"): reaches the closest depot box of you, this will make things easier.

    • openitem(string item, optional string locationfrom, optional bool new, optional int index)
      Opens item.
      Alternate invocations:
      openitem("depot"): opens a depot box next of you.

    • resizewindows()
      Resizes all windows to minimum size.

    • resizewindow(string item, int size)
      Resize window. Can be used item name, item id or BackPack index.

    • buyitems(string item, int count)
      Buys count amount of items named itemname, which must be exactly the way it appears in the trade list. A trade window must be open.

    • buyitemsupto(string item, int amount, optional int currentamount)
      Buy all amount of items.

    • sellitems(string itemname, int count)
      Sells count amount of items named itemname, which must be exactly the way it appears in the trade list. A trade window must be open.

    • sellitemsupto(string item, int amount, optional int currentamount)
      Sell all amount of items.

    • sellflasks()
      Try sell all visible flasks. A trade window must be open.

    • moveitems(string item, string from, optional string onto, optional in count)
      Move item of id or name in location.

    • closewindows()
      Close all windows.

    • closewindow(string item)
      Close window in description of item, can be item id / name or backpack index.

    • useitemon(string item, int x, int y, int z)
      Uses backpack item with id / name in sqm.

    • useitem(string item, int x, int y, int z)
      Uses ground item with id / name.

    • turn(string direction)
      Faces your character to the specified direction. direction can be: "n", "e", "s" or "w".

    • levitate(string direction, string updown)
      Faces your character to the specified direction and levitate up or down.

    • moveitemsonto(string item, string from, string to, int amount, int index)
      Move item of id or name in to another item.

    • depotdeposit(string backpack, items)
      This function is a help to deposit loots in depot.

    • cast(string spell)
      Cast check if you have the spell in hotkeys and use it, if not he try write the spell.


    [Communication]

    • say(string text)
      Says text in default channel.

    • npcsay(string text)
      Says text in the 'NPCs' channel.

    • opentrade()
      Open trade using say and npcsay functions.

    • depositall()
      Uses say and npcsay to deposit all.



    More to come...

Posting Permissions

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