1. NEOBOT HELP FILES BACKUP 30/09/11
  2.  
  3. --------------------------------------------
  4. ---------------HELP FILES INPROGRAM---------
  5. --------------------------------------------
  6.  
  7. ----------------------NEOBOT SETTINGS-------------------
  8.  
  9. NeoBot Settings
  10.  
  11. Every setting in NeoBot is organized in a settings tree, in which you must expand a section to access its subsections and to change values. This form of interface has many benefits to it over a traditional GUI. It is for instance much easier to group and access similar settings together and to have a common way to change a setting for almost anything in the bot. Other benefits include being able to export any selected settings parts to a file for others or yourself to make use of, or changing and accessing any setting of the bot through a script command by providing its tree path. For the developer, me, it is also much easier to add features since an addition won't require a relayout of a dialog window so things can be added more quickly, and a collapsed tree can hold many more settings than a fixed size window. It is also possible to change the order of the sections or items within the entire tree, and to have multiple settings views open and make changes on both of them at once.
  12. Expanding a section is done by clicking on the small arrows next to the section's name. The top-categories are Alerts, Cavebot, Healer, Hotkeys, Hud, Input and Targeting. They each contain settings and probably other subcategories related to them and will be detailed in the sections that follow. It is recommended that you at least quickly skim through them as it will ensure that you understand the dynamics properly.
  13. To change the value of a setting, you can double-click on the corresponding value field and a custom editor will pop up allowing you to pick from a set of predefined values for the field or to type your own, depending on the circumstances. Some sections, such as the healer, waypoints or hotkeys, require you to insert additional entries which contain a set of settings of their own. You may tell where you can insert entries by looking for the ".." text (without the quotes) located in a value field. Double-clicking on this field will cause a "New Entry" button to appear which if clicked on creates the desired entry. The entry that you have created will also have a ".." string as it's value, which will cause a "Remove" button to appear if double-clicked on and lets you remove the entry if so is what you wish.
  14.  
  15. Menu Options
  16.  
  17. The file menu on a settings window contains options that perform indispensable tasks. They will be outlined here.
  18. File Menu: Contains methods to save and load setting to the currently selected slot or custom file. The current slot or file is being shown in the window title.
  19.  
  20. Slot Menu: Contains methods to pick a slot or a custom file to save settings to/from. No actual saving/loading takes place here.
  21.  
  22. Examples: Contains a growing list of example which are ready to plug and play into your settings. The examples appear in your settings in the corresponding category.
  23.  
  24. Exchange Menu: Contains methods to export selected settings (press control or shift to select multiple settings) to clipboard/file or to import them back in from the clipboard/file. You can use this for instance to export cavebot and targeting scripts in order to share them. When importing waypoints in, be sure to clear the waypoints list first or the waypoints in the file will be appended. Importing data from ElfBot's cavebot and targeting files can also be done here.
  25.  
  26. Clear Menu: Contains methods to clear all entries within a certain list. This can be used before importing parts of settings from another file.
  27.  
  28.  
  29. Input, Events and Priorities
  30.  
  31. All actions which NeoBot is capable of doing end up being translated into a series of mouse moves, mouse clicks and key presses which get sent to the client. Though unlike the ancient bots which modify the client heavily and send packets which are instantaneous, moving the mouse and pressing keys takes up a significant amount of time to perform which cannot be ignored. Since you cannot do several things at once with the keyboard and mouse (like trying to equip an amulet and attack a monster at the same time), a priority and queue systems need to be introduced to allow an organized and smooth flow of these input methods.
  32. Each action that the bot wants to perform on the client is called an event. An event has different properties to it which allow it to coexist with other events in harmony. This becomes crucial if for instance you are trying to loot a creature when suddenly your health goes low and you also want to be healing. Even though the bot started to loot the creature first, you still want it to quit doing that immediately and start healing you because staying alive obviously takes priority. This is possible by assigning different priorities to events which will control their importance. A bot with a priority system also has an advantage over bots without one since restoring mana for instance won't cancel the opening of a corpse if executed at the same time and cause your character to miss out on its contents.
  33. As you might have seen if you have already scouted the settings a little, often times there are priority blocks provided for either entries or categories as a whole which let you specify their importance. This whole notion may seem a bit tricky and confusing at first due to being an innovation, but you need not even worry about it for the time being since all of it is already pre-configured for you for general use.
  34. A priority block consists of the following fields:
  35. Priority: Specifies the priority level of the event to be issued. If two or more events are waiting in the event queue and have not started executing yet, the one with the higher priority will start first. An event with a higher priority won't interrupt events with a lower priority that have already started executing.
  36.  
  37. OverridePriority: Specifies a priority level to override the execution of other running events. If you want the event to run anyway even if another event is currently executing, you can specify an override priority to interrupt a currently running event lower in priority than the override priority of this event. This is crucial in healing for example since you don't want to keep on doing something less important before finally being able to heal.
  38.  
  39. ExpireTime: Specifies an expire time in milliseconds for the event. If the event has not started executing after this interval of time has elapsed, it will be deleted. An event may have not been able to start if other events are still executing or because more important ones keep coming in.
  40.  
  41. LifeTime: Specifies a life time in milliseconds for the event. If the event takes more time to execute than this interval of time, it will be terminated and deleted. This is a precautionary measure to end events which may be bugged or defeating their purpose if they take so long to finish. For scripts, this can also be changed for each event by using the 'setlifetime(...)' command.
  42.  
  43. EventType: Specifies the type for the event. A normal event functions normally and exactly like it was explained so far. An event can also be flagged as urgent. Urgent events are more important that normal events. If an urgent event is placed in queue, it will be picked over normal events even if it's priority is lower and it also cannot be overridden by normal events. Furthermore, other options in the bot may be set up to behave specially when an urgent event occurs. For example, you can setup the bot to force focus on the client when an urgent event gets issued.
  44.  
  45.  
  46. Client F1-F12 Hotkeys
  47.  
  48. An important part of interfacing with the client is the use of the client's F1-F12 hotkeys. When the bot does its events, it first looks at all the hotkeys you have defined in the client and presses the hotkey if it finds one compatible with the event it is doing. If a hotkey is not found, it does the action in long, such as typing text into the client or moving the mouse to click on items. This is fine for talking to NPCs for example or for using a rope on a rope spot since these actions aren't time critical. For things like healing or targeting runes on monsters however, it is almost required that you have a hotkey with the action in one of your hotkeys.
  49. The F hotkeys can also be used in combination with the Shift and Control keys, but there is an additional delay since the bot has to press the control/shift key before it can press the F key, and then release the Ctrl/Shift key. You should therefore have all crucial spells such as healing on regular F hotkeys and less important ones on control/shift F hotkeys. For additional security, you can also set up healing hotkeys on at least the Shift key since if you are holding down the shift key on your keyboard, the bot cannot press the regular F hotkey since the client will press the Shift+Fxx hotkey. You can do so for the Control key aswell, but if both Shift and Control are pressed then the Shift+Fxx hotkey will run on the client.
  50.  
  51. Alerts Category
  52.  
  53. The alerts category contains precisely what its name suggests. Several alert mechanisms are provided for you and they each contain a set of actions to perform when the alert triggers.
  54.  
  55. The different alerts are:
  56. PlayerOnScreen: Triggers if a player is present on screen on the same level as yourself.
  57.  
  58. PlayerAttacking: Triggers if a player is currently attacking you.
  59.  
  60. DefaultMessage: Triggers when a default message other than from yourself gets posted.
  61.  
  62. PrivateMessage: Triggers when you receive a private message.
  63.  
  64. GmDetected: Triggers if a GM or CM is detected on any level.
  65.  
  66. Disconnected: Triggers if you get disconnected from the game.
  67.  
  68. CrashedFroze: Triggers if the bot is not responding for a long time or if it has crashed.
  69.  
  70. The options for the alerts are:
  71. PlaySound: Plays an unique sound file for the alert found in the sounds folder.
  72.  
  73. FlashClient: Flashes the client window and taskbar icon to let you visually see that the alert is being triggered.
  74.  
  75. PauseBot: Pauses the bot. The bot can be resumed from the main NeoBot Window or by using the pausebot() script command.
  76.  
  77. Disconnect: Force closes the TibiaClient so that your character can log off.
  78.  
  79. SafeList: Ignore the players listed in this list. Only one name must be entered per line.
  80.  
  81. FreezeTime: The amount of time in milliseconds after which the bot hasn't responded to consider the bot as frozen. For the CrashedFroze alert only.
  82.  
  83.  
  84. Cavebot Category
  85.  
  86. The cavebot category contains most of the features related to cavebotting, such as looting and waypoints.
  87. Looting: This section contains various settings related to the looting of monsters. The looter works in conjunction with the cavebot, but it can also be used if the cavebot is turned off. In that case, it will eat food and move items once a body is opened.
  88.  
  89. ItemList: This is a list made up of item entries which are used by the looter when looting bodies.
  90.  
  91. An item entry consists of the following fields:
  92.  
  93. ItemId: The id of the item to be looted. If you name the looter entry with a valid item name and ItemId is empty or 0, the id will be entered here automatically.
  94.  
  95. Destination: A string describing the destination of the looted item. If this is left blank, the item is looted to the first empty space found in opened containers. You can specify a designated window id ranging from 0-15 to loot to that window only or one range of windows (ex: 4-6). You can also specify the window name to be looted to(ex: 'key ring' or 'yellow backpack') or a combination of the two options (ex: 'pirate backpack 2-8'). This can also be 'ground' if you wish to drop the item to the ground.
  96.  
  97. MinQuantity: The quantity of this item a corpse must have at a minimum to be considered for looting. A random value will be picked between this range for each corpse. This only matters if your looting condition is 'Open corpses with listed items'.
  98.  
  99. OntoContainer: If you want the bot to drop items on containers located in your windows instead of into the windows themselves, specify a container itmeid/name or put 'any' without the quotes to indicate that the item should be dropped on any container. If this option is used, the 'Destination' field of the loot entry will indicate the location of the containers instead. The bot will remember which container was full and will place items in the next container in sequence. If you want the bot to forget which containers were full, which you need to do after you have sold items, changed backpacks layout, or deposited money, you need to call the 'clearlootingonto()' after doing these things in your script. Each item has it's own backpacks fullness memory because you may have different destinations/ontocontainers for each item. However if both of these are exactly the same for two or more items, they will share their memory together in order to avoid unnecessary moves to check for fullness.
  100.  
  101. AlarmOn: Lets you enable an alarm for the item if it gets announced (ex: 'Loot of a rat: x') or an alarm if it gets announced, but the looter wasn't able to loot it successfully. You must have the 'Show info messages in console' client option enabled for this to work.
  102.  
  103. OpenBodyPriority: The priority block for the opening of bodies events.
  104.  
  105. LootBodyPriority: The priority block for looting the contents of bodies.
  106.  
  107. MoveItemsQuickly: Choose if you want the bot to hold down ctrl when moving stacks of items to move them all without the count menu popping up.
  108.  
  109. OpenBodyTime: Specifies how long the bot should wait for a body to open after clicking on it before deciding to move on.
  110.  
  111. LootingCondition: Choose if you want to loot every dead corpse, only those that are chosen to be looted in the targeting settings or only corpses for which at least one of the items in your loot list appears in the corpse contents green announce message. For this to work properly, you must name all your loot entries exactly as they appear in the contents message ('gold coin', 'mace', ...). You also need to have the 'Show Info Messages in Console' option enabled in your client.
  112.  
  113. LootingPolicy: Choose to either loot the monster right away if he died next to you or to wait until all monsters are dead before commencing the looting process.
  114.  
  115. LootingFlashOnAlert: Choose if you want the looting alarms to additionally flash the client on top of playing a sound.
  116.  
  117. LootingRange: Choose how many squares around you to consider dead bodies dropping as being your loot.
  118.  
  119. LootingEatFood: Choose whether to eat food from the corpses or not.
  120.  
  121. LootingEnabled: Choose whether looting is enabled or not.
  122.  
  123. Waypoints: This list contains all the waypoints that were created. It is possible to create waypoints by double clicking on the ".." value where more options will pop up, by using the 'addwaypoint' script command or by using the 'Add Waypoint' view which can be opened from the main bot window. After you have created a waypoint, you can double click on its name to set a label for it which can be referenced via script with the 'gotolabel(...)' command.
  124.  
  125. The following is a list of waypoint types and properties:
  126.  
  127. Stand: The bot will try to stand at this position even if it gets interrupted along the way. Make sure to use these when walking on stairs, ramps and holes (by placing the waypoint on those locations by changing the emplacement) because you don't want these key locations to be skipped.
  128.  
  129. Node: The bot will try to stand at this position, unless it has already walked near this position recently, the near range being specified by the 'NodeRange' setting.
  130.  
  131. Walk: The bot will try walking towards this position. If it gets interrupted along the way, it will not retry but instead move on to the next waypoint in sequence.
  132.  
  133. Rope: The bot will move next to this position and use a rope on it, either by a hotkey if present or find it in your container windows. You should not place a stand waypoint near the rope spot preceding the rope waypoint like it was necessary in Elfbot seeing as the bot now automatically does that and does it better.
  134.  
  135. Shovel: The bot will move next to this position and use a shovel on it if the spot is closed, either by a hotkey if present or find it in your container windows. You should not place a stand waypoint near the shovel spot preceding the shovel waypoint like it was necessary in Elfbot seeing as the bot now automatically does that and does it better.
  136.  
  137. Ladder: The bot will move next to this position and use the ladder on it. You should not place a stand waypoint near the ladder location preceding the ladder waypoint like it was necessary in Elfbot seeing as the bot now automatically does that and does it better.
  138.  
  139. Use: The bot will move next to this position and use the topmost item on it. You should not place a stand waypoint near the use location preceding the use waypoint seeing as the bot automatically does that.
  140.  
  141. Action: The bot will run the supplied action script. You can do stuff such as boating, depositing money and items, buying items, or doing conditional branching by using labels and the 'gotolabel' script command.
  142.  
  143. Emplacement: Change this if you want the waypoint to be set around your location (ie: north or south of you). This is necessary to place waypoints directly on holes, stairs and ramps. Remember to set this back to normal when placing regular waypoints again.
  144.  
  145. Pathfinding: This section contains some settings that let you specify how you want the bot to walk your character from waypoint to waypoint.
  146.  
  147. SpecialAreas: Designates special areas on the map where the bot should apply special handling such as blocking them off from walking or walking slower on them.
  148.  
  149. Coordinates: Specifies the coordinates for the area. The coordinates are set to your current location when a new entry is made.
  150.  
  151. Dimensions: Specifies the horizontal and vertical sizes of the area who's top left corner is defined by the coordinates. The horizontal size thus extends to the right and the vertical size extends down. Placing '2, 3' here makes the box 2 tiles wide and 3 tiles tall.
  152.  
  153. Avoidance: Specifies how many extra squares you're willing to walk at maximum to avoid each square of this area. Set this to 0 to disregard them or to any value higher than 250 to avoid them completely.
  154.  
  155. WaitTime: Specifies how long you want to wait after walking on each square on this area before moving on.
  156.  
  157. ConsideredBy: Choose which systems of the bot should consider this special area.
  158.  
  159. WalkThroughPlayers: Specifies if you want the bot to walk through players like it is possible on non-pvp servers or not.
  160.  
  161. WalkingMethod: Specifies the preferred method of the bot to perform it's movements. You can choose between walking with arrow keys or map clicks.
  162.  
  163. MapWalkDistance: Specifies a random range that specifies the distance to perform with every click when moving with the mouse on the minimap.
  164.  
  165. CreatureMemoryTime: Specifies for how long in milliseconds creatures that leave your field of view are remember as blocking the path at the location they were last seen standing at.
  166.  
  167. EnergyAvoidance: Specifies how many extra squares you're willing to walk at maximum to avoid an energy field. Set this to 0 to walk through them or to any value higher than 250 to avoid them completely. The first number is for weak fields and the second is for strong fields.
  168.  
  169. FireAvoidance: Specifies how many extra squares you're willing to walk at maximum to avoid a fire field. Set this to 0 to walk through them or to any value higher than 250 to avoid them completely. The first number is for weak fields and the second is for strong fields.
  170.  
  171. PoisonAvoidance: Specifies how many extra squares you're willing to walk at maximum to avoid a poison field. Set this to 0 to walk through them or to any value higher than 250 to avoid them completely. The first number is for weak fields and the second is for strong fields.
  172.  
  173. WalkableIds: Specifies a list of ids which you want the bot to walk through even though auto-walk blocks these on the client. Only one id or range of ids (xxxx-yyyy) should be placed per line.
  174.  
  175. Settings: This section contains general settings for the cavebot system.
  176.  
  177. RopeToUse: Select which rope to use with the rope waypoint.
  178.  
  179. ShovelToUse: Select which shovel to use with the shovel waypoint.
  180.  
  181. NodeRange: Select the range to skip nearby nodes at.
  182.  
  183. OpenNextBp: Select if you want the bot to open the next backpack in your open containers if one window is full and has only one container within it. You can also choose for this to be enabled only when the cavebot is enabled to prevent some annoyances.
  184.  
  185. OpenBpsAtLogin: Select if you want the bot to open all your backpack in the 'back' slot and all the containers within it in new windows when logging in.
  186.  
  187. PauseBotOnDeath: Select if you want to pause the bot (cavebot and targeting) if your character dies. This has been put in place so that your character doesn't go running out of the temple if he for example sees a targetable monster outside and gets you killed.
  188.  
  189. RefillAmmoCount: Specify a range to refill ammunition in your hands and belt slot. If you specify a range such as '20 to 65', the bot will pick a random value between this range, let's say 45, and refill ammo when the item count is below 45. After it has refilled ammo successfully, it will pick a different value within that range again.
  190.  
  191. CavebotPriority: The priority block for all the events issued by the cavebot system such as roping and waypoint actions.
  192.  
  193. CavebotEnabled: Choose whether the cavebot is enabled or not.
  194.  
  195.  
  196. Healer Category
  197.  
  198. The healer category contains settings related to healing and mana training.
  199. HealRules: This section contains a list of as many healing rules as you want. Entries at the top of the list take priority in that if, for example, a spell is being cast by an item on top, a spell of a lower item will be ignored even if all conditions are satisfied. A potion in a lower item can still be used though since its of a different exhaust category.
  200.  
  201. A heal rule entry consists of the following fields:
  202.  
  203. HealthRange: Specifies a health range requirement for this heal rule. A range of '0 to 500' for example will be able to fulfill itself only when your health is below 500. It is also possible to specify a percentage if you select the 'percent' drop-down instead of 'exact' in which case you must input values between 0 and 100.
  204.  
  205. ManaRange: Specifies a mana range requirement for this heal rule. A range of '25 to 1000' for example will be able to fulfill itself only when your mana is between 25 and 1000. For convenience, it is possible to specify a lower bound and setting the upper bound to 0 (ex: 25 to 0). This will change the field to '25 and above' and indicates that the condition is satisfied if mana is higher than 25. It is also possible to specify a percentage if you select the 'percent' drop-down instead of 'exact' in which case you must input values between 0 and 100.
  206.  
  207. HealMethod: Lets you choose a heal method for this heal rule. It can either be a spell, a potion or a rune.
  208.  
  209. ExtraCondition: Lets you choose an extra condition for the heal rule. You can for example add the condition that this heal rule will only work when paralyzed so that you can heal it off. Your hp range in this case might need to be (1 and above), your mana range (25 and above) combined with the spell 'Light Healing'. Placing this entry on the bottom of the list will make sure it will not be issued if other healing spells need to be casted, which will remove the paralysis anyways.
  210.  
  211. SpamRate: Specifies how often to repeat execution of the heal rule until conditions are no longer satisfied. A random value is picked within the specified range. Setting this too low might prevent you from moving since pressing F hotkeys in the client stops your movement, unless you keep tapping on your arrow keys.
  212.  
  213. MethodPriority: Specifies the priority for the event created by this heal rule. You don't really need to set a priority setting with a purpose to act over other heal rules, since rules located higher in the list have higher priority in the healer, but more so to describe the priority behavior amongst other events in the bot.
  214.  
  215. ManaTraining: This section contains a random mana training subsystem that lets you burn mana once it is close to being full.
  216.  
  217. ManaMissing: Specifies a random range of mana that must at most be missing. If the range is for example '4 to 25', a random value will be obtained from within this range, say 15. Then if you have 15 or less mana missing, the bot will cast the selected spell provided you have enough mana to cast it.
  218.  
  219. TrainSpell: Pick the spell you want to train your mana with. The bot automatically checks if you have enough mana to cast the spell.
  220.  
  221. SpamRate: Specifies how often to repeat execution of the spell until conditions are no longer satisfied.
  222.  
  223. Enabled: Specifies whether the mana trainer is to be enabled or not.
  224.  
  225. SpellPriority: Specifies the priority of the events issued by the mana trainer.
  226.  
  227. Settings: This section contains general settings for the healer system.
  228.  
  229. PingCompensation: This setting specifies which percentage of your ping the healer should account for when casting spells. For example, if ping compensation is at 30% and your average ping is 200, then the healer will cast spells and use potions 60 milliseconds before they appear cooled down. You generally won't want to set this to anything over 50%, which is half of your ping (because ping is the time for the information to be sent to the server and then arrive back, but you only care about the time it takes to arrive to the server). If set too high, you will exhaust more when casting spells.
  230.  
  231. HealerEnabled: Specifies whether the healer system of the bot is enabled or not.
  232.  
  233.  
  234. Hotkeys Category
  235.  
  236. The hotkeys section is where most of the customization takes place. Hotkeys are custom scripts which execute at the press of a button, or actively running scripts that get activated and deactivated at the press of a button if their mode is set to auto.
  237. HotkeyList: Lists all currently available hotkeys. You can create new hotkeys by doing the usual clicking on the corresponding ".." value.
  238.  
  239. A hotkey entry consists of the following fields:
  240.  
  241. Script: Specifies the script for the hotkey. Read the Scripting help sections for more details on how to write these.
  242.  
  243. MainKey: The key to be pressed for this hotkey to execute, or turn on/off in the case of an auto hotkey.
  244.  
  245. ComboKey: If you want more than one key to be held to activate this hotkey, specify a second key here. This is irrelevant if you're not working with key combinations.
  246.  
  247. ComboType: Specifies the type of the combo key. It must either be pressed or unpressed. The combo key 'shift' has to be unpressed if you're for example trying to activate a 'b' only hotkey, and pressed if you are trying to activate the 'shift+b' hotkey. This is irrelevant if you're not working with key combinations.
  248.  
  249. PersistentList: Lists all currently available persistent hotkeys. They are just like hotkeys, but run continuously without a key being needed to turn them on/off. A persistent script will execute once if it has no auto command inside its body, which is useful for defining global variables and functions.
  250.  
  251. A persistent entry consists of the following fields:
  252.  
  253. Script: Specifies the script for the persistent entry. Read the Scripting help sections for more details on how to write these.
  254.  
  255. Enabled: Specifies whether this script is enabled or disabled.
  256.  
  257. CavebotList: Lists all currently available cavebot hotkeys. They are just like persistent hotkeys, but will only run when the cavebot is enabled and if the bot is not currently paused.
  258.  
  259. A cavebot entry consists of the following fields:
  260.  
  261. Script: Specifies the script for the cavebot entry. Read the Scripting help sections for more details on how to write these.
  262.  
  263. Enabled: Specifies whether this script is enabled or disabled.
  264.  
  265. HotkeyCondition: Specifies whether the client needs to be focused or not necessarily for hotkeys to respond to key presses.
  266.  
  267. DefaultEventPriority: Specifies the default event priority block for all script commands that issue events. This can be changed individually for each script by using the 'setpriority' command.
  268.  
  269. ChatPopupPriority: Specifies the event priority for messages typed into the chat popup (Enter key). Set the priority to 0 if you want to disable the chat popup.
  270.  
  271.  
  272. Hud Category
  273.  
  274. The Hud section deals with all of the on-screen displaying capabilities of NeoBot. Things to display are written in script form, so people can change and improve on their functionality if they can or download modifications.
  275. DisplaysList: Lists all currently available displays. You can create anew display by doing the usual clicking on the corresponding ".." value. Unfortunately, displays are only transparent on Windows Vista and 7 (possibly Aero must be enabled). Windows Xp users will have a black background in the back of the text. This is a limitation which can't be helped.
  276.  
  277. A display entry consists of the following fields:
  278.  
  279. Script: Specifies the script for the display. Read the Scripting help sections for more details on how to write these.
  280.  
  281. RefreshRate: Specifies how often the script will run and redraw itself. A redraw occurs only if the contents have actually changed. Setting this too low may cause a lot of processing power being used up.
  282.  
  283. Enabled: Specifies whether this display is enabled or disabled.
  284.  
  285. HudPolicy: Choose whether you want the Hud to be shown, hidden or shown only when the client or the bot has focus.
  286.  
  287. Included Huds: The following is a description of the 4 Huds included in NeoBot. You can modify them at will since the changes will only be reflected in the current settings for your character.
  288.  
  289. GeneralInfo: Displays general information about your character such as ping/latency, experience per hour and time to level in the top left part of the screen.
  290.  
  291. SpellTimers: Displays remaining spell time when a haste/invisibility/mana shield spell is cast in the top left corner of the screen.
  292.  
  293. ActiveHotkeys: Displays the active hotkeys or other scripts that are being ran in the bottom left part of the screen.
  294.  
  295. RecentLoot: Displays the recent loot acquired from monsters in the bottom right part of the screen. Rare loot can be setup to appear in red which can be listed by editing the script following the example format.
  296.  
  297.  
  298. Input Category
  299.  
  300. The input section houses all of the settings which define how NeoBot should interface with the client.
  301. Keyboard: Lists several settings related to issuing keystrokes.
  302.  
  303. KeyboardMode: Specifies the keyboard mode. If control keyboard is used, the bot will press keys on your keyboard as if you were pressing them yourself and for this the client must have focus. Simulate keyboard will send keystrokes to the client and for this focus is not needed. The window must still however not be minimized. It is recommended that you use the control keyboard method because it is the most natural form of interfacing with the client.
  304.  
  305. StuckCtrlShiftPolicy: Specifies if and when you want the bot to release stuck control/shift keys should they not have been released properly or promptly.
  306.  
  307. TypeWaitTime: Specifies a random interval between each character when typing long amounts of text into the client.
  308.  
  309. PressWaitTime: Specifies a random interval between pressing hotkeys or other buttons.
  310.  
  311. Mouse: Lists several settings related to mouse control.
  312.  
  313. MouseMode: Specifies the mouse mode. If control mouse is used, the bot will move the mouse cursor as if you were moving it yourself and for this the client must have focus. The /permit option will not move the mouse if the user is currently trying to position it somewhere while the /resist option will resist the user and forcefully do its work. Simulate mouse will send mouse positioning and clicks to the client and for this focus is not needed. The window must still however not be minimized. It is recommended that you use the control mouse method because it is the most natural form of interfacing with the client.
  314.  
  315. ScrollMode: Specifies if you want the bot to be clicking on the scroll bars or using the mouse wheel for scrolling.
  316.  
  317. StuckCursorPolicy: Specifies if you want the bot to restore a cursor being held down or active before starting the next event and when.
  318.  
  319. MoveSpeed: Specifies the move speed for the mouse.
  320.  
  321. ClickWaitTime: Specifies the interval of time between mouse clicks.
  322.  
  323. FocusPolicy: Since the control methods need focus of the client, this designates when the bot should set focus on the client if its not currently in focus. It is possible to do so whenever any event occurs, when any event except for walking occurs or only when an urgent event occurs.
  324.  
  325. OpenMenuPolicy: Because sometimes the bot can miss click or some unexpected window can pop up, you can set it up to do something in this case. Confirming will press the 'Enter' key while closing will press the 'Esc' key. You can specify the interval of time to wait before performing the closure in case you are the one creating the menus. If you select one of the 'mouse idle' options, it will only close the menu if the user hasn't moved the mouse for more than 4 seconds (if the client isn't focused, it will close/confirm instantly).
  326.  
  327.  
  328. Navigation Category
  329.  
  330. The navigation section houses settings which are used by the Navigation feature of NeoBot. To use the Navigation feature, you must first setup and connect to a server, something which can be done from within the Navigation dialog accessible by navigating the menu from the main bot window to 'Options >> Navigation'.
  331. Lists: Various lists which classify characters into certain categories and store pertinent information about them. These lists are used by the navigation system to colorify these player's location on the minimap, or by the 'isfriend', 'isenemy' and 'isleader' script commands.
  332.  
  333. Enemies: Lists enemy names. One name must be inserted per line. It is also possible to specify the vocation and level for this name in the following manner: Player 1, 130 EK
  334.  
  335. Friends: Lists friend names. One name must be inserted per line. It is also possible to specify the vocation and level for this name in the following manner: Player 2, 77 MS
  336.  
  337. Leaders: Lists leader names. One name must be inserted per line. It is also possible to specify the vocation and level for this name in the following manner: Player 3, 340 P
  338.  
  339. Settings: This section contains various settings related to the Navigation feature.
  340.  
  341. AutoConnect: Specifies if you want to automatically connect to the currently setup Navigation server. If this is enabled, NeoBot will automatically connect you when you load settings that have this setting enabled.
  342.  
  343.  
  344. Targeting Category
  345.  
  346. The Targeting section defines how the bot should handle attacking monsters. This works regardless of the cavebot being enabled or not.
  347. Monsters: Lists all currently defined monsters. Only a brief description will be provided here for the time being since it is very similar in functionality to ElfBot. View ElfBot's Targeting tutorial for more details.
  348.  
  349. A monster entry consists of the following fields:
  350.  
  351. Name: Name of the monster to be targeted.
  352.  
  353. Categories: The categories the monster belongs to if you plan on creating categorized entries. In most cases you will be leaving this empty.
  354.  
  355. Count: How many monsters must be on the screen for this entry to be considered.
  356.  
  357. Setting1: Additional settings that depend on the monster hp percentage.
  358.  
  359. Setting2: Additional settings that depend on the monster hp percentage.
  360.  
  361. Setting3: Additional settings that depend on the monster hp percentage.
  362.  
  363. Setting4: Additional settings that depend on the monster hp percentage.
  364.  
  365. Each setting section contains the following entries:
  366.  
  367. HpRange: The health percentage range for this setting to be chosen. If creating one setting only, this should be '0 to 100'.
  368.  
  369. Danger: The danger level of the monster. A monster with a higher danger level will be prioritized and stood away from the most. This should remain within the 0 to 10 range.
  370.  
  371. MonsterAttacks: Choose this accordingly if the monster has a beam or a wave attack and the bot will try situating itself out of the area of effect of such an attack.
  372.  
  373. DesiredStance: The stance to use for this monster. Stances are what defines how your character will move or position himself to the monster, be it charge at it (reach stance) or stay at a distance.
  374.  
  375. CustomDistance: Choose if you want this setting to use a custom range distance. If you want to use the default range distance as specified in your Stance Options, set this to 'default'.
  376.  
  377. DesiredAttack: Choose if you want to attack or follow the monster.
  378.  
  379. FirstSpell: Choose which spell or rune to cast first on the monster if the spell isn't on cooldown.
  380.  
  381. SecondSpell: Choose which spell or rune to cast second on the monster if the spell isn't on cooldown.
  382.  
  383. ThirdSpell: Choose which spell or rune to cast third on the monster if the spell isn't on cooldown.
  384.  
  385. FourthSpell: Choose which spell or rune to cast fourth on the monster if the spell isn't on cooldown.
  386.  
  387. SpellRate: Choose how often to cast the desired spell.
  388.  
  389. SyncSpell: Enabling this will sync spells with attacks. In other words, it will shoot the spell right after you have dealt regular damage.
  390.  
  391. AttackMode: Choose which attack mode to use when fighting this monster.
  392.  
  393. LootMonster: Choose if you want the monster to be looted or not. This only has an effect if your LootingCondition is set to 'Open targeting corpses'.
  394.  
  395. MustAttackMe: Choose if you want to target this monster only if it has attacked you.
  396.  
  397. OnlyIfTrapped: Choose if you want to target this monster only if you are surrounded and can't move out.
  398.  
  399. PlayAlarm: Choose if you want to play an alarm if this monster is on screen.
  400.  
  401. StanceOptions: Lists some stance options.
  402.  
  403. RangeDistance: The distance to keep from the monster when using the distance stance. It will be possible to set this for each monster in the future.
  404.  
  405. DiagonalMovement: If enabled, targeting will also consider side steps as possible movements in its calculations. This makes the calculations more CPU intensive so disable it if you have an older computer or are experiencing slowdowns.
  406.  
  407. LureIntensity: This defines how intensely your character should try to reach the lure location when using one of the lure stances. You should select a value from 0 (favor avoiding monsters) to 100 (favor going to lure location), but you can go higher than 100 too. You can try different values to see what works best for you particular script.
  408.  
  409. TargetSelection: Defines which creatures the bot should prioritize over others. These should remain within the 0 to 100 range.
  410.  
  411. ListOrder: Target selection will be favored to the targets appearing the higher on the monster list.
  412.  
  413. Health: Targets selection will be favored to the targets having the least amount of hp percentage.
  414.  
  415. Proximity: Target selection will be favored to the targets being the closest to you.
  416.  
  417. Danger: Target selection will be favored to the targets for which you have specified the highest Danger level.
  418.  
  419. Random: Target selection will have a random element favoring some targets more than others.
  420.  
  421. Stick: Target selection will tend to stick on the target it has previously chosen. This is very sensitive and stickiness will be conserved for an even small values.
  422.  
  423. MustBeReachable: If enabled, targeting will only consider selecting a target if it can be reached by foot.
  424.  
  425. MustBeShootable: If enabled, targeting will only consider selecting a target if a projectile aimed from you towards it will not be obstructed.
  426.  
  427. TargetingPriority: The priority block for events issued by the targeting system.
  428.  
  429. TargetingEnabled: Specifies whether targeting is enabled or not.
  430.  
  431.  
  432.  
  433.  
  434.  
  435. ---------------------SCRIPTING-----------------------------
  436.  
  437. NeoBot's script system
  438.  
  439. The scripting system in NeoBot is inspired by ElfBot's hotkeys and script commands. People that have used ElfBot in the past should be able to adapt quickly so long as they pay attention to the subtleties of the new syntax.
  440. In NeoBot, scripting is implemented through a popular and powerful scripting language called Lua. This upgrade adds additional flexibility and allows you to implement much more powerful and customized scripts. Lua already comes pre-packed with several libraries containing useful general-use functions such as for math or string manipulation, thus much can be done with small amounts of effort.
  441. This of course does not mean that the simplicity of ElfBot's scripts is gone. On the contrary. It's probably even easier to create scripts now that the format has been thought over. If it seems harder then that's most likely only due to the difference in dynamics of the bot which queues keyboard and mice events instead of instantly sending out packets.
  442.  
  443. Lua documentation
  444.  
  445. A comprehensive programming introduction to Lua is available at this link. Please note that some things such as console input from the user or running scripts from the command line is irrelevant, since we don't have a console window to type in input for a running script and since scripts are ran from within NeoBot.
  446. For a more in depth read, a reference manual which covers some more advanced notions can be viewed here. This reference manual is also available in several other languages such as portuguese and spanish. There you will find everything from the full scripting syntax to all of the library calls included in lua. For anyone wishing to master scripting, that's another read in the right direction.
  447. The fastest way to learn scripting for NeoBot can probably be achieved by analyzing ready-made scripts made by others or those already included in the bot and trying to modify them slightly without breaking the syntax. Over time, the familiarity will increase.
  448.  
  449. Lua changes
  450.  
  451. Several changes have been implemented to Lua in order to make it safe and friendly to use for our purposes.
  452. In terms of functionality, some of the notable changes are foreach statements which allow you to iterate through all monsters, messages received or other things. For clarity, all native bot variables are prefixed with a $ symbol (such as $hp) and it is not possible to create variables containing the $ symbol. All user-declared variables must start with a letter or underscore. The possibility of defining an init section has also been added, but that will be explained in a later sub-section.
  453. In terms of safety, several library calls were removed such as access to command line, loading dll files and changing system settings. File access is limited to NeoBot's /neofiles/directory. Accessing any file outside of that directory (other than a temporary file) or creating a file other than with the .txt extension is not possible. This should secure any unwanted things from occurring when downloading scripts made by other users.
  454. As for functions and variables implemented by NeoBot, you can find a full description of them in the help sections 'Script Variables', 'Script Functions' and 'Script Events'.
  455.  
  456. Lua Variables
  457.  
  458. Unlike ElfBot which treats any unknown word with a $ symbol that it encounters as a variable, all additional variables which you intend to use in Lua must be defined before they can be used.
  459. Two types of variables can be made in Lua: global and local variables. Making a global variable in a script will also make it accessible to any other script within the bot. A local variable will only exist in the script that it is being ran, or to be more precise, as far as only in the block that it has been defined in. If it was defined in an if statement, then it will only exist within that if statement and not beyond it. Always use local variables if you don't need to share values between scripts. Refer to the programming manual for a more detailed explanation.
  460. Having to define variables causes a small problem for us when we want to store information in a variable across several invocations of a script. For example, the following script resets the variable j every time it is started:
  461.  
  462. local j
  463. print(j)
  464. j=j+1
  465. print(j)
  466. j=j+1
  467.  
  468. since the local j directive defines and initializes the variable back to nil (or 0) every time the script is ran and will hence output 0, 1, 0, 1... every time. This is fine for most situations where we just want to use a variable for the life time of one script run, such as for loop counts or parameter passing.
  469. In order to preserve the contents of a variable, the possibility of using an init statement has been provided for you. The script:
  470.  
  471. init start
  472. local j
  473. init end
  474.  
  475. print(j)
  476. j=j+1
  477.  
  478. will correctly print an incremented count (0, 1, 2...) each time the script is ran, since the code in the init block is ran only once when the script is first created. The init block must be located as the first statement of the script in order to be considered.
  479. It is also possible to share functions across scripts using the init block. To do so, create a persistent hotkey, call it 'general functions' or anything you like and place any function you want accessible from anywhere between an init block. Don't forget to enable this persistent hotkey and do not set an auto repeat rate for it. Example:
  480.  
  481. init start
  482. function openbag() openitem(2853) end
  483. init end
  484.  
  485. If a function is not declared within an init block, it will only be accessible in the script it was defined in.
  486.  
  487.  
  488. --------------------------------SCRIPT VARIABLES-----------------------------------
  489.  
  490. Stats variables
  491.  
  492. The following variables return information about your character.
  493. $name (string): Returns the name of your character.
  494. $id (int): Returns the creature Id of your character.
  495. $hp (int): Returns your current amount of hit points.
  496. $maxhp (int): Returns your maximum amount of hit points.
  497. $mp (int): Returns your current amout of mana points.
  498. $maxmp (int): Returns your maximum amount of mana points.
  499. $cap (int): Returns your remaining capacity.
  500. $stamina (int): Returns the remaining stamina in minutes.
  501. $soul (int): Returns the remaining soul points.
  502. $exp (int): Returns your total amount of experience points.
  503. $level (int): Returns the level of your character.
  504. $mlevel (int): Returns the level of your magic skill.
  505. $mlevelpc (int): Returns the percentage learnt of the magic skill.
  506. $hppc (int): Returns the percentage of your character's hp.
  507. $mppc (int): Returns the percentage of your character's mp.
  508. $posx (int): Returns the x position of your character.
  509. $posy (int): Returns the y position of your character.
  510. $posz (int): Returns the z position of your character.
  511.  
  512. Status effects
  513.  
  514. The following variables return information on your character's various states.
  515. $battlesigned (bool): Returns true if your character is battle signed, false otherwise.
  516. $drunk (bool): Returns true if your character is drunk, false otherwise.
  517. $hasted (bool): Returns true if your character is hasted, false otherwise.
  518. $manashielded (bool): Returns true if your character is mana shielded, false otherwise.
  519. $paralyzed (bool): Returns true if your character is paralyzed, false otherwise.
  520. $poisoned (bool): Returns true if your character is poisoned, false otherwise.
  521. $poisondmg (int): Returns the last amount of poison damage incurred.
  522. $pvpsigned (bool): Returns true if your character is pvp signed, false otherwise.
  523. $pzone (bool): Returns true if your character is in a protection zone, false otherwise.
  524.  
  525. Skill variables
  526.  
  527. The following variables return information pertaining to your character's skills.
  528. $fist (int): Returns the level of your fist skill.
  529. $club (int): Returns the level of your club skill.
  530. $sword (int): Returns the level of your sword skill.
  531. $axe (int): Returns the level of your axe skill.
  532. $distance (int): Returns the level of your distance skill.
  533. $shielding (int): Returns the level of your shielding skill.
  534. $fishing (int): Returns the level of your fishing skill.
  535. $fistpc (int): Returns the percentage learnt of the fist skill.
  536. $clubpc (int): Returns the percentage learnt of the club skill.
  537. $swordpc (int): Returns the percentage learnt of the swords skill.
  538. $axepc (int): Returns the percentage learnt of the axe skill.
  539. $distancepc (int): Returns the percentage learnt of the distance skill.
  540. $shieldingpc (int): Returns the percentage learnt of the shielding skill.
  541. $fishingpc (int): Returns the percentage learnt of the fishing skill.
  542.  
  543. Equipment variables
  544.  
  545. The following variables return a pointer to an item for which you can access various properties which will be outlined in the next section.
  546. $head (pointer): Returns the data structure of the item in your head slot.
  547. $neck (pointer): Returns the data structure of the item in your neck slot.
  548. $back (pointer): Returns the data structure of the item in your back slot.
  549. $chest (pointer): Returns the data structure of the item in your chest slot.
  550. $lhand (pointer): Returns the data structure of the item in your left hand slot (appears on the right side).
  551. $rhand (pointer): Returns the data structure of the item in your right hand slot (appears on the left side).
  552. $legs (pointer): Returns the data structure of the item in your legs slot.
  553. $feet (pointer): Returns the data structure of the item in your feet slot.
  554. $finger (pointer): Returns the data structure of the item in finger slot.
  555. $belt (pointer): Returns the data structure of the item in your belt slot.
  556.  
  557. Item properties
  558.  
  559. The following properties can be appended to an item pointer (ie: $lhand.id) and return a value as defined.
  560. .id (int): Returns the id of the item.
  561. .count (int): Returns the count of the item.
  562.  
  563. Client info variables
  564.  
  565. The following variables return various information relating to the game client.
  566. $battleopen (bool): Returns true if the battle window is open, false otherwise.
  567. $connected (bool): Returns true if connected to a server, false otherwise.
  568. $focused (bool): Returns true if client is focused, false otherwise.
  569. $minimized (bool): Returns true if client is minimized, false otherwise.
  570. $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).
  571. $tradeopen (bool): Returns true if the trade window is open, false otherwise.
  572. $typedtext (string): Returns the currently typed-in text in the chat window.
  573. $writtentext (string): Returns the currently written in text in the 'Edit text' window, like for letters or labels.
  574. $writtentextinfo (string): Returns the author and message date of the currently open 'Edit text' window, like for letters or labels. The information is separated by colons (':').
  575.  
  576. Bot info variables
  577.  
  578. The following variables return various information calculated by the bot.
  579. $balance (int): Returns the last bank balance amount reported by an NPC.
  580. $cavebot (bool): Returns true if cavebot is enabled, false otherwise.
  581. $cureventid (int): Returns the internal id of the currently executing event, 0 otherwise.
  582. $cureventtype (int): Returns the internal type of the currently executing event, 0 otherwise.
  583. $curevent (int): Returns a table containing internal data about the currently executing event.
  584. $expgained (int): Returns the exp gained since exp counter has been reset.
  585. $exphour (int): Returns the average experience per hour since it's been reset.
  586. $exptime (int): Returns the time in milliseconds that the exp counter has been running.
  587. $idlerecvtime (int): Returns the time in milliseconds since the last packet was received from the server. Good for detecting connection freezes.
  588. $lastlabel (string): Returns the last non-empty label name before the current waypoint that the cavebot has went through.
  589. $lastonto (int): Returns the last container which had space during the last moveitemsonto(...) event. To reset, after you have emptied/shuffled the relevant containers, call 'clearlastonto()'.
  590. $lootbodies (int): Returns the amount of loot bodies not yet looted being queued up for looting.
  591. $looting (bool): Returns true if looting is enabled, false otherwise.
  592. $neoid (int): Returns the id number of the bot as specified if starting the bot using the -id x command line option.
  593. $openmenutime (int): Returns the time in milliseconds that a menu in the client has been open.
  594. $openingbps (bool): Returns true if the open backpacks at login or open next backpack system is currently opening backpacks, false otherwise. You can for example avoid doing other events in the meantime or make the bot 'pauswalking(x)' while it is working.
  595. $ping (int): Returns the last calculated ping value.
  596. $pingaverage (int): Returns the average of the 6 last obtained ping values.
  597. $popupchatopen (bool): Returns true if a popup chat box is open, false otherwise.
  598. $standtime (int): Returns the time in milliseconds that your character has been standing still.
  599. $targeting (bool): Returns true if targeting is enabled, false otherwise.
  600. $timems (int): Returns the time in milliseconds since the system has started. Can be used for creating timers.
  601. $windowsxp (bool): Returns true if the bot is running on windows xp, false otherwise.
  602. $clientctrltime (int): Returns the time in milliseconds that the control key has been held for in the client.
  603. $clientshifttime (int): Returns the time in milliseconds that the shift key has been held for in the client.
  604. $ctrltime (int): Returns the time in milliseconds that the control key was physically held for by the bot.
  605. $shifttime (int): Returns the time in milliseconds that the shift key was physically held for by the bot.
  606. $wptid (int): Returns the id of the current waypoint.
  607. $wpttype (string): Returns the type of the current waypoint.
  608. $wptx (int): Returns the x position of the current waypoint.
  609. $wpty (int): Returns the y position of the current waypoint.
  610. $wptz (int): Returns the z position of the current waypoint.
  611.  
  612. Navigation variables
  613.  
  614. The following variables return various information related to your navigation session.
  615. $navon (bool): Returns true if you are logged into a navigation channel, false otherwise.
  616.  
  617. Timer variables
  618.  
  619. The following variables return various timer-related values.
  620. $hastetime (int): Returns the time in milliseconds remaining on the haste spell.
  621. $mshieldtime (int): Returns the time in milliseconds remaining on the mana shield spell.
  622. $invistime (int): Returns the time in milliseconds remaining on the invisibility spell.
  623. $strenghtentime (int): Returns the time in milliseconds remaining on the strenghten spell.
  624.  
  625. Creature variables
  626.  
  627. The following variables return a pointer to a creature for which you can access various properties which will be outlined in the next section.
  628. $attacked (pointer): Returns the creature data structure of the creature currently red boxed.
  629. $followed (pointer): Returns the creature data structure of the creature currently green boxed.
  630. $mattacker (pointer): Returns the creature data structure of the monster that has last attacked you within 3 seconds.
  631. $pattacker (pointer): Returns the creature data structure of the player that has last attacked you within 3 seconds.
  632. $self (pointer): Returns the creature data structure of your character.
  633. $target (pointer): Returns the creature data structure of the last creature you have attacked.
  634. $targetingtarget (pointer): Returns the target of the targeting system.
  635. foreach loop (pointer): A special type of loop that cycles through all creatures and lets you script various operations on each one of them.
  636.  
  637. Example of a creature foreach loop:
  638.  
  639. foreach creature c "ms" do
  640. if c.name == "Rotworm" then
  641. say("Rotworm is on screen!")
  642. break
  643. end
  644. end
  645.  
  646. The 2nd parameter (here c) is the name that you wish to give to the local variable which will hold each of the creatures iterated in turn. To make scripts execute faster and for simplicity, the 3rd parameter (optional, and here "ms") is a string which acts as a filter and lists a combination of conditions defined as follows:
  647.  
  648. p: creature must be a player
  649. m: creature must be a monster
  650. f: creature must be on the same floor as you
  651. s: creature must be on the same floor as you and on the visible portion of the screen
  652.  
  653. The above loop iterates through all the creatures that are monsters and which appear on your screen. The optionally placed break command exits the loop once one rotworm has been found and the say command has been executed in order to prevent doing so multiple times should there be more than one rotworm on the screen.
  654.  
  655. Creature properties
  656.  
  657. The following properties can be appended to a creature pointer (ie: $self.speed) and return a value as defined.
  658. .name (string): Returns the creature's name.
  659. .id (int): Returns the unique id of the creature.
  660. .posx (int): Returns the creature's x coordinate.
  661. .posy (int): Returns the creature's y coordinate.
  662. .posz (int): Returns the creature's z coordinate.
  663. .dir (string): Returns the creature's direction as either 'n', 'e', 's' or 'w'.
  664. .outfit (int): Returns the creature's outfit id.
  665. .color1 (int): Returns the creature's head color id.
  666. .color2 (int): Returns the creature's primary color id.
  667. .color3 (int): Returns the creature's secondary color id.
  668. .color4 (int): Returns the creature's detail color id.
  669. .addons (int): Returns the creature's addons as a number.
  670. .mount (int): Returns the creature's mount as a number.
  671. .lightintensity (int): Returns the intensity of the creature's light.
  672. .lightcolor (int): Returns the color id of the creature's light.
  673. .hppc (int): Returns the creature's health percentage.
  674. .speed (int): Returns the creature's speed.
  675. .updated (int): Returns 1 if the creature is being updated by server.
  676. .skull (int): Returns the creature's skull type id.
  677. .party (int): Returns the creature's party type id.
  678. .warbanner (int): Returns the creature's warbanner type id.
  679. .walkblock (bool): Returns true if the creature can't be walked through, false otherwise.
  680. .dist (int): Returns the biggest distance in either x or y between the creature and your character.
  681. .ignored (bool): Returns true if creature is being ignored by the targeting system (if ignorecreature() was used on it), false otherwise.
  682. .ismonster (bool): Returns true if creature is a monster, false otherwise.
  683. .isplayer (bool): Returns true if creature is a player, false otherwise.
  684. .isshootable (bool): Returns true can be shot from your position, false otherwise.
  685. .lastattacked (int): Returns the time in milliseconds since the creature last performed any attack on you. Always check if this is smaller than the amount of time you are considering (ex: if m.lastattacked
  686.  
  687. Message variables
  688.  
  689. The following variables return a pointer to a message for which you can access various properties which will be outlined in the next section.
  690. $lastmsg (pointer): Returns the data structure of the latest message received in the client.
  691. foreach loop (pointer): A special type of loop that cycles through all newly received messages and lets you script various operations on each one of them.
  692.  
  693. Example of a message foreach loop:
  694.  
  695. foreach newmessage m do
  696. if m.sender == "Light Princess" then
  697. pausebot(true)
  698. end
  699. end
  700.  
  701. The 2nd parameter (here m) is the name that you wish to give to the local variable which will hold each of the messages iterated in turn. The above loop iterates through all newly received messages and pauses the bot when a message from the character "Light Princess" is received.
  702.  
  703. Message properties
  704.  
  705. The following properties can be appended to a message pointer (ie: $lastmsg.content) and return a value as defined.
  706. .sender (string): Returns the message's sender's name.
  707. .content (string): Returns the message's content.
  708. .level (int): Returns the message's sender's level.
  709. .type (int): Returns the message's channel id.
  710.  
  711. Position variables
  712.  
  713. 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.
  714. $clientwin (pointer): Returns the rectangle containing the measurements of the client window.
  715. $worldwin (pointer): Returns the rectangle containing the measurements of the world window.
  716. $cursor (pointer): Returns the point containing the position of the mouse cursor on your monitor screen.
  717.  
  718. Rectangle properties
  719.  
  720. The following properties can be appended to a rectangle pointer (ie: $clientwin.left) and return a value as defined.
  721. .left (int): Returns the rectangle's left x coordinate.
  722. .right (int): Returns the rectangle's right x coordinate.
  723. .top (int): Returns the rectangle's top y coordinate.
  724. .bottom (int): Returns the rectangle's bottom y coordinate.
  725. .centerx (int): Returns the rectangle's center x coordinate.
  726. .centery (int): Returns the rectangle's center y coordinate.
  727.  
  728. Point properties
  729.  
  730. The following properties can be appended to a point pointer (ie: $cursor.x) and return a value as defined.
  731. .x (int): Returns the point's x coordinate.
  732. .y (int): Returns the point's y coordinate.
  733.  
  734. Tile properties
  735.  
  736. The following properties can be appended to a tile pointer (ie: gettile(7, 7, 7).itemcount) and return a value as defined.
  737. .itemcount (int): Returns the count of items on the tile.
  738. .item (pointer): Returns the data structure for an item on the tile. You must index item with a value ranging from 1 to .itemcount to specify which item you want to access (ex: .item[1]).
  739.  
  740. Container properties
  741.  
  742. The following properties can be appended to a container pointer (ie: getcontainer(0).isopen) and return a value as defined.
  743. .hashigher (bool): Returns true if the container is inside another container and you can press the 'up arrow' button to go back to it, false otherwise.
  744. .isopen (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.
  745. .item (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]).
  746. .itemcount (int): Returns the count of items in the container.
  747. .itemid (int): Returns the item id of the container window.
  748. .maxcount (int): Returns the maximum count of items that can be stored in the container.
  749. .name (string): Returns the name of the container window.
  750.  
  751.  
  752.  
  753.  
  754. -------------------------------SCRIPT FUNCTIONS-----------------------------------
  755.  
  756. Script functions
  757.  
  758. The following are functions that either control the bot or aid in scripting. You won't find functions here that interface with the client such as opening an item. Those are categorized as events and you can find them in the 'Script Events' section.
  759. A general tutorial about this functional reference will however be given here. In Lua, the scripting language that NeoBot utilizes, a function is cast in script by writing down it's name followed by a pair of parentheses. For example: ourfunction(). If the function takes no additional parameters to describe it's behavior, nothing is added in between.
  760. There are 4 notable parameter types we can pass to functions if required to specify how we want it to behave. For instance, we might want to pass an item id to the openitem() function to specify which item we want it to open; in which case we would write: openitem(3031). The 4 types are: int which is a number, string which is a series of characters like letters and digits, booleans which are either true or false, and pointers which are datastructures containing a specific object.
  761. As you will notice, the function reference lists the parameters and their types for each function. Some parameters are optional, meaning that they describe a default behavior if not passed as parameters. You can however specify them if you want a different behavior than the default one. A return type preceding the function name may also be specified. This means that the function returns a value of a certain type which you can make use of later on (ex: function "string time(int times) " returns a formatted string for a big amount of seconds).
  762.  
  763. Functionality functions
  764.  
  765. The following are fundamental functions that modify the general behavior of scripts.
  766. auto(int interval)
  767.  
  768. Puts the script into auto-mode for interval milliseconds. A script that is in auto-mode will execute itself every certain interval of time. If the command is executed in a hotkey, that hotkey, when pressed, will enable the repetitive execution and disable it if pressed again. If 0 is passed for interval and the hotkey is currently running on auto, the hotkey is taken off auto-mode.
  769.  
  770. Alternate invocations:
  771. auto(int from, int to): repeats after a random interval between from and to.
  772.  
  773. table geteventbyid(int eventid)
  774.  
  775. Returns a table containing information about the input event of id eventid and null if such event was not found.
  776.  
  777. islocation(optional int range)
  778.  
  779. 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.
  780.  
  781. iskeypressed(int vkey)
  782.  
  783. Returns true if virtual key code vkey is pressed (system-wide), and false otherwise.
  784.  
  785. printerror(optional anytype item1, optional anytype item2, ...)
  786.  
  787. Prints the arguments specified to the console in red text. The console will also pop out if it is closed.
  788.  
  789. setlifetime(optional int lifetime)
  790.  
  791. Sets the lifetime to timems for every subsequent event created by the script. If timems is not provided, the default lifetime is set.
  792.  
  793. setpriority(int priority, int override, int expiretime, int lifetime, int type)
  794.  
  795. Sets the priority settings for every subsequent event created by the script. If this function is not called, the default settings defined in the bot apply. type can be 0 (regular event) or 1 (urgent event).
  796.  
  797. setwarning(int warning, bool enabled)
  798.  
  799. Sets whether the script will issue warnings and pop-up the console when an error occurs for a particular warning. warning can be WARNING_ITEM and enabled dictates if the warning is enabled or not.
  800.  
  801. wait(int time)
  802.  
  803. Pauses execution of the current script for time milliseconds and resumes once that interval has elapsed.
  804.  
  805. Alternate invocations:
  806. wait(int from, int to): waits random amount between from and to.
  807.  
  808. waitforevents(bool wait)
  809.  
  810. Lets you select if you want to wait until the events you issue finishes, or to continue running the script. If wait is false, the event function will return the event id of the issued event. Remember to change it back afterwards if you don't want all your events in the current script to use that same setting.
  811.  
  812.  
  813. Bot control functions
  814.  
  815. The following functions modify settings or behavior of the bot.
  816. addhotkey(string name, string script, optional string key, optional string combokey, optional string combotype)
  817.  
  818. Adds a hotkey with name name, script script, optional key key, optional combo key combokey and optional combo key type combotype ('Must be pressed' or 'Must be depressed'). This function is not available in the trial version.
  819.  
  820. addpersistent(string name, string script, optional bool enabled)
  821.  
  822. Adds a persistent with name name, script script and enabled state enabled which is either true or false. This function is not available in the trial version.
  823.  
  824. addwaypoint(string type, optional int offsetx, optional int offsety)
  825.  
  826. Adds a waypoint of type type ("Stand", "Node", ...) at the location you are currently standing to the end of the list. Optionally, you can specify an offset to your position (1, -1 or so) in parameters offsetx and offsety to make waypoints around your location.
  827.  
  828. clearlastonto()
  829.  
  830. Clears the last onto index so that 'moveitemsonto(...)' starts putting items on the first backpack again. See $lastonto for more information.
  831.  
  832. clearlootingonto()
  833.  
  834. Clears the remembered onto backpacks (which were full or not) by the looter. You need to call this function in script after you have changed backpack positioning/added new backpacks/sold items/deposited money so that the bot knows some could be empty again.
  835.  
  836. flashclient()
  837.  
  838. Flashes the client window for around 5 seconds.
  839.  
  840. focusclient()
  841.  
  842. Gives focus to the client window.
  843.  
  844. string getsetting(string settingpath)
  845.  
  846. 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 "Healer/HealerEnabled".
  847.  
  848. ignorecreature(string or pointer or int creature, optional bool unignore)
  849.  
  850. Instructs the targeting system to ignore creature creature (name, pointer, or id) completely. Optionally, you can pass true as the second parameter to unignore a creature if it was previously ignored.
  851.  
  852. importsettings(string name)
  853.  
  854. Imports the settings file with filename name (ex: MyHotkeys or MyHud) from the '/neoscripts/' folder located in your main NeoBot directory. Importing settings doesn't clear your current settings but rathers adds or overwrites the contents to it. This function is not available in the trial version.
  855.  
  856. listas(string listname)
  857.  
  858. Sets the name for the script to listname for appearance when active. To prevent a script from being listed, invoke it as follows: listas('dontlist').
  859.  
  860. listcolor(int listcolor)
  861.  
  862. Sets the color for the script to listcolor for appearance when active.
  863.  
  864. loadsettings(string name)
  865.  
  866. Loads the settings file with filename name (ex: Charname1 or HydrasHunt) from the '/neosettings/' folder located in your main NeoBot directory. This function is not available in the trial version.
  867.  
  868. minimizeclient()
  869.  
  870. Minimized the client.
  871.  
  872. pausebot()
  873.  
  874. Toggles pause on both the cavebot and targeting engines of the bot.
  875.  
  876. Alternate invocations:
  877. pausebot(bool paused): pauses if paused is true, unpauses if false.
  878.  
  879. pauseinput(int timems)
  880.  
  881. Prevents the bot from sending input in the form of mouse clicks/moves and key presses for timems milliseconds. You can use this if the bot is stubbornly trying to do something and you want it to stop while you can do something else. Be careful as this will pause healing aswell! The bot will resume sending input after the specified delay has expired or if 0 is passed as timems.
  882.  
  883. pausewalking(int timems)
  884.  
  885. Prevents the bot from walking for timems milliseconds. You can use this for example to skin/stake bodies. This does not pause walking if it was issued by script commands such as reachgrounditem or moveto. The bot will resume walking after the specified delay has expired or if 0 is passed as timems.
  886.  
  887. popupchat(string channel)
  888.  
  889. Shows a popup chat box for channel channel so that you can type in text without the bot interrupting you. If channel is 'Navigation', a popup chat for navigation chat is opened and messages will be sent to players present in the currently connected to navigation room. To close the popup chat, call this functional with no parameters.
  890.  
  891. playsound(string filename)
  892.  
  893. Plays sound filename (ex: "monster.wav") found in the bot's "\sounds" directory.
  894.  
  895. resetexph()
  896.  
  897. Resets the experience per hour counter of the bot.
  898.  
  899. restoreclient()
  900.  
  901. Restores the client from its minimized state.
  902.  
  903. screenshot(optional string filename, optional bool worldonly, optional int quality)
  904.  
  905. 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. Optionally, you can pass the worldonly parameter as true to only save the game world portion of the screen. Optionally, you can specify a quality level from 1-99 if you want the screenshot to be saved in JPEG format. On Windows Vista/7, the client does not need focus for the screenshot to work. On Windows Xp, the client is made the topmost window before the screenshot is being taken and then it is returned to normal. In both cases, NeoBot's displays will not be visible on the screenshot and the client must also not be minimized. The screenshot will be stored in the /neofiles/ folder.
  906.  
  907. setsetting(string settingpath, string value, optional bool updategui)
  908.  
  909. Sets any setting of the bot to the value specified by value. The string settingpath must contain the full path of the setting such as "Healer/HealerEnabled" and value must be one of the possible values for that field typed in exactly as it appears in the settings, in this case either "yes" or "no". You can copy the complete invocation of this function, including the current value, by right-clicking on any setting of the bot and selecting 'Copy setsetting'. Optionally, you can pass false as the third paramater to prevent the value from updating in the GUI until you move your mouse over the setting. This is to speed things up since redrawing GUIs can be expensive on the CPU.
  910.  
  911. showbot()
  912.  
  913. Toggles the display state of the main bot window.
  914.  
  915. Alternate invocations:
  916. showbot(bool show): shows if paused is true, hides if false.
  917.  
  918. showconsoleinput()
  919.  
  920. Toggles the display state of the console input window.
  921.  
  922. Alternate invocations:
  923. showconsoleinput(bool show): shows if shows is true, hides if false.
  924.  
  925. showsettings()
  926.  
  927. Toggles the display state of a settings window.
  928.  
  929. Alternate invocations:
  930. showsettings(bool show): shows if show is true, hides if false.
  931.  
  932. bool terminateevent(int eventid)
  933.  
  934. Terminates input event of id eventid and returns true if successful.
  935.  
  936. traymessage(string title, string text, optional int timems)
  937.  
  938. Displays a message in the system tray with title title and text text which causes the bot to show up if clicked on. Title can be an empty string in which case it will take less space. You can specify how long the message should last in milliseconds in the timems parameter. If you don't, the message will last 10000 ms. Tray messages replace each other so only one can be shown at a time.
  939.  
  940. traytooltip(string text)
  941.  
  942. Sets NeoBot's tray icon's tooltip to text which will appear when howevered on. This function must be called every 2000 ms or less because the default tooltip takes over after 2 seconds.
  943.  
  944.  
  945. Access functions
  946.  
  947. The following functions return values tracked internally by the bot.
  948. int exptolevel(optional int level)
  949.  
  950. If level is not specified, returns the amount of exp left for next level. Otherwise, returns the amount of exp left for level level.
  951.  
  952. int timetolevel(optional int level)
  953.  
  954. If level is not specified, returns the time left for next level in seconds. Otherwise, returns the amount of time left for level level. Use the time function to convert into a legible time.
  955.  
  956. int emptycount(optional string locationname)
  957.  
  958. Returns the count of empty/free slots in your open container windows. Optionally, you can specify which windows to consider by providing the locationname parameter.
  959.  
  960. int itemcost(string itemname)
  961.  
  962. Returns the cost of item with name itemname as defined in the '/neolibs/itemlist.txt' file.
  963.  
  964. Alternate invocations:
  965. int itemcost(int itemid): returns cost of item with id itemid
  966.  
  967. int itemcount(int itemid, optional string locationname)
  968.  
  969. Returns the count of the item with id itemid that is present in your equipment and open windows. The bot counts it instantly by going through all the visible items and returns the count. Optionally, you can specify which windows to consider by providing the locationname parameter.
  970.  
  971. int itemid(string itemname)
  972.  
  973. Returns the id of item with name itemname as defined in the '/neolibs/itemlist.txt' file.
  974.  
  975. Alternate invocations:
  976. int itemid(int itemid): to simplify scripts which let the user store either an item id or an item name in a variable, this will simply return back the item id if an item id is specified
  977.  
  978. string itemname(int itemid)
  979.  
  980. Returns the name of the item with id itemid as defined in the '/neolibs/itemlist.txt' file.
  981.  
  982. Alternate invocations:
  983. string itemname(string itemname): to simplify scripts which let the user store either an item id or an item name in a variable, this will simply return back the item name if an item name is specified
  984.  
  985. int itemvalue(string itemname)
  986.  
  987. Returns the value of item with name itemname as defined in the '/neolibs/itemlist.txt' file.
  988.  
  989. Alternate invocations:
  990. int itemvalue(int itemid): returns value of item with id itemid
  991.  
  992. float itemweight(string itemname)
  993.  
  994. Returns the weight of item with name itemname as defined in the '/neolibs/itemlist.txt' file.
  995.  
  996. Alternate invocations:
  997. float itemweight(int itemid): returns weight of item with id itemid
  998.  
  999. int servercount(string itemname)
  1000.  
  1001. Returns the count of item with name itemname 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.
  1002.  
  1003. table spellinfo(string spell)
  1004.  
  1005. Returns a table containing various information about spell spell which can be the spell name or the incantation words as defined in the '/neolibs/spelllist.txt' file.
  1006.  
  1007. int tradecount(string tradetype, string itemname)
  1008.  
  1009. Returns the count of item of type tradetype ('buy' or 'sell') with name itemname. This is the count available for purchase (limited by money/cap) or sale (amount carrying) given by the trade items window. If the trade window is closed, the return value is 0.
  1010.  
  1011. Alternate invocations:
  1012. int tradecount(string tradetype, int itemid): takes an itemid instead of an item name
  1013.  
  1014. int windowcount(optional string locationname)
  1015.  
  1016. Returns the count of windows that are currently open. Optionally, you can specify which windows to consider by providing the locationname parameter.
  1017.  
  1018.  
  1019. Client Information functions
  1020.  
  1021. The following functions return information gathered from the client.
  1022. string clientitemhotkey(int itemid, optional string type)
  1023.  
  1024. Looks for a hotkey in the game client which is bound to the item with id itemid and returns it as a string representation of the keys in the format 'F1', 'Shift+F5', or 'Ctrl+F12', and 'not found' if there is no such hotkey. Optionally, you can specify a type by passing 'self', 'target' or 'crosshair' as the type paramter if you're looking for a certain type specifically. Otherwise, any type will be looked for.
  1025.  
  1026. string clientspellhotkey(string incantation, optional string type)
  1027.  
  1028. Looks for a hotkey in the game client which is bound to a spell with incantation similar to incantation and returns it as a string representation of the keys in the format 'F1', 'Shift+F5', or 'Ctrl+F12'. Optionally, you can specify a type by passing 'manual' or 'automatic' as the type paramter if you're looking for a certain type specifically. Otherwise, any type will be looked for.
  1029.  
  1030. string clienttexthotkey(string text, optional string type)
  1031.  
  1032. Looks for a hotkey in the game client which is bound to text text and returns it as a string representation of the keys in the format 'F1', 'Shift+F5', or 'Ctrl+F12'. Optionally, you can specify a type by passing 'manual' or 'automatic' as the type paramter if you're looking for a certain type specifically. Otherwise, any type will be looked for.
  1033.  
  1034. int cooldown(string spell)
  1035.  
  1036. Return the amount of time in milliseconds until you can cast spell spell or 0 if you can cast it right away. The spell parameter can be either the spell name or the incantation. It can also be 'attack', 'healing', 'support' or 'special'.
  1037.  
  1038. int cooldownmax(string spell)
  1039.  
  1040. Return the total cooldown time for spell spell. The spell must be currently cooling down for the bot to be aware of this value. The spell parameter can be either the spell name or the incantation. It can also be 'attack', 'healing', 'support' or 'special'.
  1041.  
  1042. pointer getcontainer(int containerid)
  1043.  
  1044. Returns a pointer to the container datastructure for the specificed container with id containerid ranging from 0-15.
  1045.  
  1046. table getobjectarea(pointer creature)
  1047.  
  1048. Returns a table with the coordinates of the rectangular area (.left, .right, .top, .bottom, .centerx and .centery) for the specified creature.
  1049.  
  1050. Alternate invocations:
  1051. table getobjectarea(int x, int y, int z): returns the rectangular area of the tile at the specified location.
  1052.  
  1053. pointer gettile(int x, int y, int z)
  1054.  
  1055. Returns a pointer to the tile datastructure for the following position. Currently, you can only check tiles on the same level as yourself.
  1056.  
  1057. Alternate invocations:
  1058. pointer gettile(int rx, int ry, int rz): returns the tile for the relative position to the top left edge of screen for rx (0-17), ry (0-13), rz
  1059.  
  1060. bool ischannel(string channelname)
  1061.  
  1062. Returns true if channel with name channelname is opened and false otherwise. The channel name must be provided exactly as it appears in the client (ex: 'Bubble's private...').
  1063.  
  1064. bool isitemontile(int itemid, int x, int y, int z)
  1065.  
  1066. Returns true if item of id itemid can be found on the tile at given coordinates and false otherwise.
  1067.  
  1068. int itemflags(int itemid)
  1069.  
  1070. Returns bitwise properties of item with id itemid.
  1071.  
  1072. bool itemproperty(int itemid, int propertyid)
  1073.  
  1074. Returns true if property id propertyid for itemid is set. This is used to see if items can be opened, can stack, etc
  1075.  
  1076. int maround(optional int range, optional string name1, optional string name2, ...)
  1077.  
  1078. Returns the amount of monsters around you within distance range. If range is 0 or not specified, the entire screen is considered. Optionally, you can specify as many names as you want to only be considered as the following namex parameters.
  1079.  
  1080. int paround(optional int range)
  1081.  
  1082. Returns the amount of players around you within distance range. If range is 0 or not specified, the entire screen is considered.
  1083.  
  1084. bool tilereachable(int x, int y, int z, optional bool FullReach)
  1085.  
  1086. Returns true if you are able to reach the specified location by walking there and false otherwise. Only the tiles on screen are considered unless you set the optional parameter FullReach to true in which case the bot will try to find a path trough the tiles in a 256x256 box around your location, which is much slower.
  1087.  
  1088. bool tileshootable(int x, int y, int z)
  1089.  
  1090. Returns true if nothing is obstructing the throw/shoot path between you and the tile at provided location and false otherwise.
  1091.  
  1092. pointer topitem(int x, int y, int z)
  1093.  
  1094. Returns the data structure of the tile's top item at given coordinates. You can access its id or count by appending the .id or .count properties. Any information accessing on the item datastructure must be performed right away or stored elsewhere because a call to wait() or any script event may invalidate it.
  1095.  
  1096.  
  1097. Display functions
  1098.  
  1099. The following functions can only be used in HUD displays to print information on the screen.
  1100. addgradcolors(float pos1, int color1, float pos2, int color2, ...)
  1101.  
  1102. Adds any amount of ARGB colors to a gradient each at position ranging from (0.0 to 1.0).
  1103.  
  1104. setbordercolor(int color)
  1105.  
  1106. Sets the ARGB color for the border to be drawn around shapes or as text outline when a border width has been specified in the 'setfontstyle(...)' function. If you don't want a border for shapes, pass -1 as the color.
  1107.  
  1108. setcompositionmode(int mode)
  1109.  
  1110. Sets the composition mode for blending objects/text. The default composition mode is 3 (Source). You can read more about composition modes here
  1111.  
  1112. setfillstyle(string filltype, ...)
  1113.  
  1114. Sets the fill style for drawing shapes.
  1115.  
  1116. Alternate invocations:
  1117. setfillstyle("color", int color): fill the draw shapes with color color
  1118. setfillstyle("image", string imagename): fills the drawn shapes with image imagename (ex: myimg.png) located in the /neoimages/ folder
  1119. setfillstyle("map", int startx, int starty, int z, int transparency): fills the draw shapes with minimap data starting at startx, starty and z and transparency level transparency (255 is fully transparent).
  1120. setfillstyle("gradient", "linear", int spreadtype, int startx, int starty, int finalx, int finaly): fills the drawn shapes with a linear gradient. spreadtype can be 0 (PadSpread), 1 (ReflectSpread) or 2 (RepeatSpread).
  1121. setfillstyle("gradient", "radial", int spreadtype, int centerx, int centery, int focalx, int focaly, int radius): fills the drawn shapes with a radial gradient
  1122. setfillstyle("gradient", "conical", int spreadtype, int centerx, int centery, int angle): fills the drawn shapes with a conical gradient
  1123.  
  1124. You can read this page for more information on gradients
  1125.  
  1126. int addshape(string shapetype, int x, int y, int width, int height, ...)
  1127.  
  1128. Adds a shape element with the previously specified color to the current display at position x and y within the display. A unique ElementId for this display is returned which can be compared to the v3 parameter in mouse click input events if the mouse click hits the shape.
  1129.  
  1130. Alternate invocations:
  1131. int addshape("rect", int x, int y, int width, int height): creates a rectangle
  1132. int addshape("roundrect", int x, int y, int width, int height, int xRadius, int yRadius): creates a rectangle with rounded corners. xRadius and yRadius specify the radii of the ellipsis defining the corners of the rounded rectangle.
  1133. int addshape("circle", int x, int y, int width, int height): creates a circle (or ellipsis)
  1134. int addshape("line", int x, int y, int width, int height): creates a line
  1135. int addshape("pie", int x, int y, int width, int height, int startangle, int spanangle): creates a pie that starts at startangle and goes for spanangle degrees
  1136. int addshape("chord", int x, int y, int width, int height, int startangle, int spanangle): creates a chord that starts at startangle and goes for spanangle degrees
  1137. int addshape("arc", int x, int y, int width, int height, int startangle, int spanangle): creates an arc that starts at startangle and goes for spanangle degrees
  1138.  
  1139. addtext(string text, int x, int y)
  1140.  
  1141. Adds a text element with the previously specified font style to the current display at position x and y within the display. The first element should start near position (0,0).
  1142.  
  1143. int, int, int, int calcstringsize(string text)
  1144.  
  1145. Calculates and returns the size that a text element will take using the currently set font, font size and font width. This returns 4 values: width, height and left, right, because sometimes fonts that are very decorated draw beyond the designated rectangle and at negative values.
  1146.  
  1147. table getposition()
  1148.  
  1149. Returns a table with the x and y coordinates of the display.
  1150.  
  1151. setantialiasing(bool enabled)
  1152.  
  1153. Choose whether to enable or disable the anti-aliased painting of rounded shapes to make them appear smoother. Keep in mind that this slows down rendering a little.
  1154.  
  1155. setbkgcolorxp(int color)
  1156.  
  1157. Sets the background color of the element to color. Values should be passed in hexadecimal format 0x00RRGGBB (0xFF0000 -> red).
  1158.  
  1159. setfontcolor(int color)
  1160.  
  1161. Sets the color of the font to color. Values should be passed in hexadecimal format 0xAARRGGBB (0xFF0000 -> red).
  1162.  
  1163. setfontname(string name)
  1164.  
  1165. Sets the name of the font to name.
  1166.  
  1167. setfontsize(int size)
  1168.  
  1169. Sets the size of the font to size.
  1170.  
  1171. setfontstyle(string name, int size, int color, optional int bordersize)
  1172.  
  1173. Sets the name, color, size and border size of the font to name, size, color and bordersize.
  1174.  
  1175. setfontweight(int weight)
  1176.  
  1177. Sets the weight/thickness of the font to weight. A weight of 50 stands for normal thickness while 75 is for bold. Maximum possible weight is 99.
  1178.  
  1179. setjustify(string justify)
  1180.  
  1181. Sets the justification of the font to justify. Possible values are: 'right' and 'center'. By default, text is positioned at the location provided by the element. If justification is enabled, the x coordinate for the element is ignored and text will appear right-aligned or center-aligned in the display.
  1182.  
  1183. setmaskcolorxp(int color)
  1184.  
  1185. Makes pixels of color color completely see-through on Windows Xp. This can be used to draw irregular shapes in a display and not make them have a rectangular background covering their whole height and width. Set color to -1 to disable.
  1186.  
  1187. setposition(int x, int y)
  1188.  
  1189. Sets the top-left corner of the display to position x and y. Use this to define the placement of the display on the screen. All elements added will be situated relative to this position. If justification is enabled, the x coordinate will specify the right side of the display in the case of right-justification or the center of the display in the case of center-justification.
  1190.  
  1191. isscript(string scripttype, int index)
  1192.  
  1193. Returns true if script of scripttype with index index exists and nil/false otherwise. Possible values for scripttype are: 'hotkey', 'persistent', 'cavebot' and 'display'.
  1194.  
  1195. string scriptlistname(string scripttype, int index)
  1196.  
  1197. Returns the list name of the script with type scripttype at index index. The list name is the name of the script or the custom string passed to the listas function. If the script is not actively running, "" is returned.
  1198.  
  1199. int scriptlistcolor(string scripttype, int index)
  1200.  
  1201. Returns the list color of the script with type scripttype at index index.
  1202.  
  1203. filterinput(bool keys, bool mouseclicks, bool mousemoves, bool stealfocus)
  1204.  
  1205. Enables or disables the filtering of input events through the inputevents(bool type, int v1, int v2, int v3) function which must be defined in the init block of the current script. If keys is set to true, key presses on a HUD will call the input function with type IEVENT_KEYDOWN or IEVENT_KEYUP and v1 set to the virtual key code of the key. If mouseclicks or mousemoves is set to true, mouse clicks or moves on a HUD will call the input function with type IEVENT_LMOUSEDOWN, IEVENT_LMOUSEUP, IEVENT_RMOUSEDOWN, IEVENT_RMOUSEUP, IEVENT_MMOUSEDOWN, IEVENT_MMOUSEUP, IEVENT_MOUSEMOVE, IEVENT_MOUSEENTER or IEVENT_MOUSELEAVE and v1 & v2 will contain the local x & y positions of the event within the HUD, except for the last 2. For mouse clicks, v3 will contain the unique element id hit by the click which is returned by the 'addshape(...)' function for each shape. If type is IEVENT_MOUSEWHEEL, v1 contains packed coordinates of the event and v2 contains a negative or positive delta value of the distance the wheel has traveled in either direction. If stealfocus is true, the HUD window will become focused after being clicked on and the client will lose keyboard focus. Focus is necessary to be able to capture keys.
  1206.  
  1207. requestint(int rid, string question, int default)
  1208.  
  1209. Requests an integer number from the user. This can only be called from the inputevents(bool type, int v1, int v2) function. The question parameter is the question to ask the user and the defalult parameter is the default value to be shown. A request id can be specified in the rid parameter. This request id will be passed to the inputevents function as the v1 parameter to identify later on what was requested. The type parameter will be IEVENT_REQUESTINT and v2 will represent the chosen integer number.
  1210.  
  1211. requestfloat(int rid, string question, float default)
  1212.  
  1213. Requests a decimal point number from the user. This can only be called from the inputevents(bool type, int v1, int v2) function. The question parameter is the question to ask the user and the defalult parameter is the default value to be shown. A request id can be specified in the rid parameter. This request id will be passed to the inputevents function as the v1 parameter to identify later on what was requested. The type parameter will be IEVENT_REQUESTFLOAT and v2 will represent the chosen float number.
  1214.  
  1215. requesttext(int rid, string question, string default)
  1216.  
  1217. Requests a text string from the user. This can only be called from the inputevents(bool type, int v1, int v2) function. The question parameter is the question to ask the user and the defalult parameter is the default value to be shown. A request id can be specified in the rid parameter. This request id will be passed to the inputevents function as the v1 parameter to identify later on what was requested. The type parameter will be IEVENT_REQUESTTEXT and v2 will represent the text string.
  1218.  
  1219. requestlist(bool rid, string question, int defaultindex)
  1220.  
  1221. Requests a text string out of a list from the user. This can only be called from the inputevents(bool type, int v1, int v2) function. The question parameter is the question to ask the user and the defaultindex parameter is the default index in the list to be shown. A request id can be specified in the rid parameter. This request id will be passed to the inputevents function as the v1 parameter to identify later on what was requested. The type parameter will be IEVENT_REQUESTLIST and v2 will represent the chosen or written text string. List items must be added using the requestlistitem(..) function.
  1222.  
  1223. requestlistitem(string text)
  1224.  
  1225. Adds the text option to a request list. This must be called after calling requestlist(..).
  1226.  
  1227. requestmenu(bool rid)
  1228.  
  1229. Requests a text string out of a popum menu from the user. This can only be called from the inputevents(bool type, int v1, int v2) function. A request id can be specified in the rid parameter. This request id will be passed to the inputevents function as the v1 parameter to identify later on what was requested. The type parameter will be IEVENT_REQUESTMENU and v2 will represent the chosen text string. Menu items must be added using the requestmenuitem(..) function.
  1230.  
  1231. requestmenuitem(string text)
  1232.  
  1233. Adds the text option to a request popup menu. This must be called after calling requestmenu(..).
  1234.  
  1235.  
  1236. Cavebot functions
  1237.  
  1238. The following functions change the behavior of the cavebot in some way.
  1239. gotolabel(string labelname)
  1240.  
  1241. Sets the next waypoint to be the waypoint with the label labelname. A label can be created by clicking on a waypoint entry and typing a custom name for it.
  1242.  
  1243. Alternate invocations:
  1244. gotolabel(int waypointid): goes to waypoint with id waypointid.
  1245.  
  1246. int, int, int getlurelocation()
  1247.  
  1248. Returns the current lure location.
  1249.  
  1250. setlurelocation(int x, int y, int z)
  1251.  
  1252. Sets the current lure location to x, y and z. This is equivalent to having the cavebot traversing a lure waypoint.
  1253.  
  1254.  
  1255. String functions
  1256.  
  1257. The following functions are used for manipulating strings in special ways.
  1258. string ground(int posx, int posy, int posz)
  1259.  
  1260. Returns a formatted string for passing a ground location to certain script events. It returns a string in the following format: "ground posx posy posz".
  1261.  
  1262. string num(int number)
  1263.  
  1264. Returns a string representation of a number number in the format "x,yyy,zzz,www" depending on lenght.
  1265.  
  1266. string time(int times)
  1267.  
  1268. Returns a string representation of a second time interval times in the format "dd:hh:mm:ss" depending on lenght.
  1269.  
  1270. string timeshort(int timems)
  1271.  
  1272. Returns a string representation of a millisecond time interval timems in the format "mm:ss.d" depending on lenght.
  1273.  
  1274. string tohex(int n)
  1275.  
  1276. Returns a string representation of number n in hexadecimal format.
  1277.  
  1278.  
  1279. Navigation functions
  1280.  
  1281. The following functions for navigation related purposes.
  1282. bool isenemy(string name, option bool fullinfo)
  1283.  
  1284. Returns true if player named name is in the enemy list, or false otherwise. If fullinfo is true, a table containing the entries 'level', 'vocation' and 'priority' is returned if the player is found to be in the list, nil otherwise.
  1285.  
  1286. bool isfriend(string name, option bool fullinfo)
  1287.  
  1288. Returns true if player named name is in the friend list, or false otherwise. If fullinfo is true, a table containing the entries 'level', 'vocation' and 'priority' is returned if the player is found to be in the list, nil otherwise.
  1289.  
  1290. bool isleader(string name, option bool fullinfo)
  1291.  
  1292. Returns true if player named name is in the leader list, or false otherwise. If fullinfo is true, a table containing the entries 'level', 'vocation' and 'priority' is returned if the player is found to be in the list, nil otherwise.
  1293.  
  1294.  
  1295.  
  1296. --------------------------SCRIPT EVENTS-----------------------------------
  1297.  
  1298. Script events
  1299.  
  1300. Events in NeoBot are operations that ultimately will perform some kind of action in the client be it by mouse or keyboard. The following functions create those events which will control the mouse and keyboard in some way in order to achieve a certain purpose.
  1301. Unlike in packet-based bots, controlling the mouse and keyboard is not instantaneous, but takes time. Moving your mouse to a location and performing a mouse click or pressing and releasing a hotkey takes a few hundred milliseconds at best. Therefore, when calling an event function, the script will pause until the event has finished, either succesfully or has failed, before continuing it's execution further.
  1302. This delay can further be extended if more important events are trying to execute first, such as healing. Events will be executed according to their priority and will time out if their timeout time or lifetime expires. It is possible to set an event's priority properties by calling the setpriority() function before issuing an event.
  1303.  
  1304. Item Ids
  1305.  
  1306. Every function which accepts an item id as a parameter to it (ex: openitem(int itemid)) also accepts a string with the itemname, which will be converted internally from an item list located in the file /neolibs/itemlist.txt. For example, you can do useitem(3725) or equally as well useitem('brown mushroom') to eat a brown mushroom.
  1307. Some names are written in a special way. For example, the soft boots have 2 different ids. One for when they are worn and another one for when they are not. The respective item names for this are 'Soft Boots(in use)' and 'Soft Boots'. You must use the name of the one you want exactly as it appears by searching in the file if you are unsure.
  1308.  
  1309. Location strings
  1310.  
  1311. Some events such as those for manipulating items like 'openitem()' or 'moveitems()' will ask you for a location string to specify a source or a destination for the item, or both. This was designed for enhanced flexibility, but also so that you don't need to learn and remember 10 different functions for each similar thing that you want to do.
  1312. To open an item with id 1234 on the ground, you can simply do: openitem(1234, 'ground'), and to open the item located in your backpack slot, you can do: openitem(1234, 'back'). Similarly, to drop all items of id 1234 in your open windows on the ground you would do moveitems(1234, 'ground'), and to drop the item 1234 that is either in your right or left hand you would do moveitems(1234, 'ground', 'lhand rhand').
  1313. Below is the complete possible syntax structure of a location string:
  1314. Empty string '': If nothing is specified, it describes all open windows.
  1315.  
  1316. 'equip1 equip2 equip3 ...': Describes equipment slots; you can put as many as you want out of the possible values: 'head', 'back', 'neck', 'lhand', 'rhand', 'chest', 'legs', 'feet', 'ring' and 'belt'.
  1317.  
  1318. 'n': Describes open window with id n.
  1319.  
  1320. 'n-m': Describes open windows with ids ranging inclusively from n to m.
  1321.  
  1322. 'name1 name2 name3 ...': Describes all open windows who's name has the specified name parts. For example: 'yellow blue pirate backpack'.
  1323.  
  1324. 'name1 name2 name3 ... n': Describes open window of id n that must have the specified name parts in its name. For example: 'yellow backpack 5'.
  1325.  
  1326. 'name1 name2 name3 ... n-m': Describes open windows who's id is between n-m inclusively and that has the specified name parts in its name. For example: 'yellow backpack 1-4'.
  1327.  
  1328. 'ground': If provided as a source location, describes all tiles right around you and the tile you are standing on.
  1329.  
  1330. 'ground x y z': Describes the ground tile with the location x, y and z. You can use the 'ground(x, y, z)' script command to quickly create this string.
  1331.  
  1332.  
  1333. Character events
  1334.  
  1335. The following functions issue an event related with control of your character.
  1336. closeclient()
  1337.  
  1338. Closes down the client. Same result as xlogging.
  1339.  
  1340. connect(string account, string password, string charname)
  1341.  
  1342. Connects you to the game world on the specified account, password and charname. Use 'setlifetime(x)' before calling this function to set the timeout time for the 'Connecting' window to establish the connection because the default event timeout might be too short.
  1343.  
  1344. dismount()
  1345.  
  1346. Dismounts your character from your currently mounted animal.
  1347.  
  1348. logout()
  1349.  
  1350. Logs you out by pressing Ctrl+L if you are not battlesigned.
  1351.  
  1352. mount()
  1353.  
  1354. Mounts your character on the creature that is set as your mount in the client.
  1355.  
  1356. move(string direction)
  1357.  
  1358. Moves your character in the specified direction. direction can be: "n", "e", "s", "w", "ne", "se", "sw" or "nw".
  1359.  
  1360. moveto(int x, int y, int z)
  1361.  
  1362. Moves your character to the specified coordinates x, y and z.
  1363.  
  1364. reachlocation(int x, int y, int z)
  1365.  
  1366. Moves your character near the specified coordinates x, y and z without actually stepping on them.
  1367.  
  1368. reconnect()
  1369.  
  1370. Reonnects you to the game world on last character played. Use 'setlifetime(x)' before calling this function to set the timeout time for the 'Connecting' window to establish the connection because the default event timeout might be too short.
  1371.  
  1372. setattackmode(string attackmode, string chasemode)
  1373.  
  1374. Sets the attack mode of your character to attackmode which can be 'offensive'/'balanced'/'defensive' and chasemode which can be 'chase'/'stand'.
  1375.  
  1376. turn(string direction)
  1377.  
  1378. Faces your character to the specified direction. direction can be: "n", "e", "s" or "w".
  1379.  
  1380.  
  1381. Communication events
  1382.  
  1383. The following functions issue an event related with communicating.
  1384. cast(string incantation)
  1385.  
  1386. Casts the spell defined by incantation. If a hotkey with a similar incantation exists, that hotkey will be pressed. Otherwise, incantation will by typed in.
  1387.  
  1388. navpm(string name, string text)
  1389.  
  1390. Says text to channel member with real char name name connected to the navigation server. You may require leader status to say things depending on the channel settings.
  1391.  
  1392. navsay(string text)
  1393.  
  1394. Says text to all channel members connected to the navigation server. You may require leader status to say things depending on the channel settings.
  1395.  
  1396. navquery(string text)
  1397.  
  1398. Executes a special query that is defined by a command keyword on the Navigation server and passes up to 10 parameters to it. The query can store or retrieve information in the Navigation server's database. If a result is obtainable, it will be passed to the navmessages callback function with the property isquery set to true.
  1399.  
  1400. npcsay(string text)
  1401.  
  1402. Says text in the 'NPCs' channel. Same as doing 'say("NPCs", text)'.
  1403.  
  1404. say(string channel, string text)
  1405.  
  1406. Says text in channel named channel. If a hotkey with text exists, that hotkey will be pressed. Otherwise, text will by typed in. The event will cycle to the requested channel unless it's using a hotkey which has the "Send automatically" option.
  1407.  
  1408. Alternate invocations:
  1409. say(string text): says text in the default channel.
  1410.  
  1411.  
  1412. Defensive spell events
  1413.  
  1414. The following functions issue an event to cast a defensive spell if conditions are met.
  1415. haste()
  1416.  
  1417. Casts the haste spell if you are not currently hasted or if the time left on your haste is 1 second or lower.
  1418.  
  1419. invisibility()
  1420.  
  1421. Casts the invisibility spell if you are not currently invisible or if the time left on your invisibility is 5 seconds or lower.
  1422.  
  1423. manashield()
  1424.  
  1425. Casts the mana shield spell if you are not currently manashielded or if the time left on your mana shield is 5 seconds or lower.
  1426.  
  1427. stronghaste()
  1428.  
  1429. Casts the strong haste spell if you are not currently hasted or if the time left on your haste is 1 second or lower.
  1430.  
  1431.  
  1432. Item events
  1433.  
  1434. The following functions issue an event related with item manipulation.
  1435. buyitems(string itemname, int count)
  1436.  
  1437. 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.
  1438.  
  1439. Alternate invocations:
  1440. buyitems(int itemid, int count): buys items with id itemid
  1441.  
  1442. closewindows(optional string locationtype, optional bool onlyone)
  1443.  
  1444. Closes all windows that fit the description of locationtype. If locationtype is not specified, all windows are closed. If onlyone is specified as true, then only one matching window is closed.
  1445.  
  1446. countitems(int itemid)
  1447.  
  1448. Counts item of id itemid to make it display the 'Using one of xx items...' message. For counting to work, you must have a hotkey with the item setup somewhere within your hotkeys. For items which you can use on other things, you must have a hotkey for the item with the 'With crosshair' type.
  1449.  
  1450. eatfood()
  1451.  
  1452. Eats a food item available out of one of your open backpacks.
  1453.  
  1454. equipitem(int itemid, string locationslot, optional string locationfrom, optional string count)
  1455.  
  1456. Equips item of id itemid to inventory slot locationslot. Slot is a location string and can be 'rhand', 'ring', 'belt', etc.. Optionally, you can specify a source for the items in locationfrom if you don't want it to be all open windows. Optionally, you can provide how many items to move by providing the count parameter.
  1457.  
  1458. higherwindows(optional string locationtype, optional bool onlyone)
  1459.  
  1460. Shows higher window of all windows that fit the description of locationtype. If locationtype is not specified, all windows are shown their higher window. If onlyone is specified as true, then the higher container is shown only once for one window.
  1461.  
  1462. minimizewindows(optional string locationtype, optional bool onlyone)
  1463.  
  1464. Minimizes all windows that fit the description of locationtype. If locationtype is not specified, all windows are minimized. If onlyone is specified as true, then only one matching window is minimized. You may specify 'equip' as locationtype to indicate that you want the equipment window minimized.
  1465.  
  1466. moveitems(int itemid, string locationto, optional string locationfrom, optional int count)
  1467.  
  1468. Moves all items of id itemid to location described by locationto. Optionally, you can specify a source for the items in locationfrom if you don't want it to be all open windows. Moveitems will keep moving items as long as they are found in locationfrom and as long as the destination has space. Optionally, you can specify how many items to move by providing the count parameter. If you only want to move one item or one stack of items from the source location, set the count to 100.
  1469.  
  1470. moveitemsonto(int itemid, int ontoid, optional int index, optional string locationonto, optional string locationfrom)
  1471.  
  1472. Moves all items of id itemid on containers of id ontoid. Optionally, you can specify which container index to start putting items onto if you don't want it to try all the containers from the beginning. For this, you can pass $lastonto to start at the container that was found to be empty from the last operation. Optionally, you can specify the location of the containers of ontoid in the locationonto paramater if you don't want it to be all open windows. Optionally, you can specify a source for the items in locationfrom if you don't want it to be all open windows. Moveitemsonto will keep moving items as long as they are found in locationfrom and as long as the destination containers have space.
  1473.  
  1474. openitem(int itemid, optional string locationfrom, optional bool new, optional int index)
  1475.  
  1476. Opens item of id itemid. If you pass 0 for itemid, any openable item will be opened. You can optionally pass a location string for the locationfrom parameter to indicate where to look for the item to be opened if you don't want it to be looked for in all open windows. You can optionally pass true as the new parameter to indicate openening the item in a new window. You can also optionally specify which item to open in sequence by passing the index parameter (1st item, 2nd item... etc).
  1477.  
  1478. Alternate invocations:
  1479. openitem("depot"): opens a depot box next of you (since depots have different ids, this will make things easier)
  1480.  
  1481. openwindow(string window name, optional bool close)
  1482.  
  1483. Opens a utility window in the client. windowname can currently only be 'battle window'. Optionally, you can set close to true if you would like to close the window instead of opening it.
  1484.  
  1485. reachgrounditem(int itemid)
  1486.  
  1487. Moves your character to stand next to the closest item of id itemid found on the screen.
  1488.  
  1489. Alternate invocations:
  1490. reachgrounditem("depot"): reaches the closest depot box of you (since depots have different ids, this will make things easier)
  1491.  
  1492. reopenwindows(optional string opentype, optional string mainlocation)
  1493.  
  1494. Asks the Open windows at login system to reopen your 'back' item and all openable items within. Optionally, you can specify 'open', 'minimized', 'small' as the opentype parameter to indicate the action to be performed after opening each container. Optionally, you can pass 'belt' as the mainlocation parameter if your main backpack is located in the belt slot. This function returns immediately as it doesn't perform the events itself. To find out if the open backpacks system is currently opening windows, check the $openingbps variable.
  1495.  
  1496. resizewindows(optional int size, optional string locationtype, optional bool onlyone)
  1497.  
  1498. Resizes all windows that fit the description of locationtype to specified size (can be 0/omitted to be as small as possible, or some big value to be as big as possible). If locationtype is not specified, all windows are resized. If onlyone is specified as true, then only one matching window is resized.
  1499.  
  1500. restorewindows(optional string locationtype, optional bool onlyone)
  1501.  
  1502. Restores all windows that fit the description of locationtype from their minimized state. If locationtype is not specified, all windows are restored. If onlyone is specified as true, then only one matching window is restored. You may specify 'equip' as locationtype to indicate that you want the equipment window restored.
  1503.  
  1504. sellitems(string itemname, int count)
  1505.  
  1506. 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.
  1507.  
  1508. Alternate invocations:
  1509. sellitems(int itemid, int count): sells items with id itemid
  1510.  
  1511. useitem(int itemid, optional string locationitem)
  1512.  
  1513. Uses item of id itemid at location locationitem. If locationitem is not specified, the item is searched for in all open hotkeys which is pressed if one is found. Otherwise, it will be clicked in the inventory if present. If a location for the item is specified, the item is clicked on at the designated location if found.
  1514.  
  1515. useitemon(int idused, int idusedon, optional string locationusedon, optional string locationused)
  1516.  
  1517. Uses item with id idused on item with id idusedon, which can be 0 if its location is the ground. If you don't want the usedon item to be looked for in all open backpacks, you can specify its location in the string locationusedon. Same thing for the item being used except that you would do so in the string locationused.
  1518.  
  1519. useoncreature(int itemid, pointer creature)
  1520.  
  1521. Uses item of id itemid on creature creature. If the item is found in a hotkey with an appropriate action, it will be pressed. Otherwise, it will be clicked in the inventory if present.
  1522.  
  1523. writetext(int itemid, string text, optional string locationfrom, optional int index)
  1524.  
  1525. Opens item of id itemid for text editing and writes text text into it. To indicate a new line, use the following two characters: '\n' (ex: 'Johnny\nThais'). You can optionally pass a location string for the locationfrom parameter to indicate where to look for the item to be opened if you don't want it to be looked for in all open windows. You can also optionally specify which item to open in sequence by passing the index parameter (1st item, 2nd item... etc).
  1526.  
  1527.  
  1528. Creature events
  1529.  
  1530. The following functions issue an event related with creature manipulation.
  1531. attack(string creaturename)
  1532.  
  1533. Attacks creature of name creaturename located on the screen.
  1534.  
  1535. Alternate invocations:
  1536. attack(int creatureid): attacks creature with id creatureid
  1537. attack(pointer creature): attacks a designated creature
  1538.  
  1539. follow(string creaturename)
  1540.  
  1541. Follows creature of name creaturename located on the screen.
  1542.  
  1543. Alternate invocations:
  1544. follow(int creatureid): follows creature with id creatureid
  1545. follow(pointer creature): follows a designated creature
  1546.  
  1547. reachcreature(string creaturename)
  1548.  
  1549. Reaches creature of creaturename located on the screen by walking next to it. Use this if you need to get close to NPCs in order to talk to them.
  1550.  
  1551. Alternate invocations:
  1552. reachcreature(int creatureid): follows creature with id creatureid
  1553. reachcreature(pointer creature): follows a designated creature
  1554.  
  1555.  
  1556.  
  1557.  
  1558. -----------------------------SCRIPT LIBRARIES - HARDEK-----------------------------------
  1559.  
  1560. Creature Functions
  1561.  
  1562. The following functions are concerned with creatures information.
  1563. table creatureinfo(string creaturename)
  1564.  
  1565. Returns a table with information about a creature, {name, exp, hp, ratio, maxdmg, bestspell}.
  1566.  
  1567. int creaturemaxhp(string creaturename)
  1568.  
  1569. Returns the maximum amount of HP a creature has.
  1570.  
  1571. int creaturehp(string creaturename)
  1572.  
  1573. Returns the current amount of HP a creature has.
  1574.  
  1575. int creatureexp(string creaturename)
  1576.  
  1577. Returns the amount of experience a creature gives.
  1578.  
  1579. float expratio(string creaturename)
  1580.  
  1581. Returns the reason EXP / HP of the creature.
  1582.  
  1583. int maxdamage(optional string creaturename)
  1584.  
  1585. Returns the maximum amount of HP you can loose in 1 turn concerning all monsters on your screen, optionally you can pass a creature name to know how much damage that creature can deal in 1 turn.
  1586.  
  1587. string bestelement(string creaturename, optional boolean strongonly)
  1588.  
  1589. Returns the creature's weakness (fire, ice, earth, energy, death, physical).
  1590.  
  1591. string beststrongstrike(string creaturename)
  1592.  
  1593. Returns the best STRONG strike spell against the creature.
  1594.  
  1595. string beststrike(string creaturename)
  1596.  
  1597. Returns the best strike spell against the creature.
  1598.  
  1599. string bestspell(string creaturename)
  1600.  
  1601. Returns the best strike spell against the creature.
  1602.  
  1603.  
  1604. Item Functions
  1605.  
  1606. The following functions are concerned with items information.
  1607. int itemscosttocap(string itemname, int cap)
  1608.  
  1609. Returns cost when BUYING items from NPCs, as much as needed to reach 'cap' cap (use this to withdraw money before using buyitemstocap, for example).
  1610.  
  1611.  
  1612. Helper Functions
  1613.  
  1614. The following functions will help you making everyday scripts.
  1615. waitping(optional int base=200)
  1616.  
  1617. Wait based in your average ping, useful for most actions delay.
  1618.  
  1619. int timeleft(string t, optional int ctime=currenttime())
  1620.  
  1621. Returns the number of seconds left to t. Example: timeleft('6:00') will return the number of seconds from now to 6am
  1622.  
  1623. bool tryexec(string cmd, int x, int y, int z, optional int maxtries)
  1624.  
  1625. Check if the character is at the desired location, and executes the command, if unable, will try to reach the location x, y, z and try again, returns false if 'maxtries' tries is reached.
  1626.  
  1627. dontlist()
  1628.  
  1629. Simply an alias for listas('dontlist').
  1630.  
  1631. float euclideandist(sx, sy, dx, dy)
  1632.  
  1633. Will calculate the euclidean distance between {sx, sy} and {dx, dy}.
  1634.  
  1635.  
  1636. Cavebot Functions
  1637.  
  1638. The following functions are very useful for caveboting, like buying items, refilling supplies depositing loot.
  1639. buyitemstocap(string itemname, int cap)
  1640.  
  1641. Will buy items 'itemname' until you reach 'cap' capacity, useful for potions or food, for example.
  1642.  
  1643. depositall()
  1644.  
  1645. Just deposit all your gold (you must be near a NPC).
  1646.  
  1647. bool withdraw(int amount, optional string npc, optional bool sayhi=false)
  1648.  
  1649. Safely withdraw the desired amount of gold from your acount by verifying the answer from the NPC, if no npc is passed, it will accept any message as an answer (not a big problem on most of times). The 'sayhi' parameter is for say hi or not before talking to the npc, true for saying and no for not saying.
  1650.  
  1651. opendepot()
  1652.  
  1653. Reach and open a depot chest.
  1654.  
  1655. movetoinsist(int x, int y, int z, optional int maxtries=5)
  1656.  
  1657. Tries and retries 'maxtries' times to reach the desired location.
  1658.  
  1659. refillsofts()
  1660.  
  1661. Repairs all visible worn soft boots, considering visible money, will try getting more money on the bank in case you don't have enough with your character.
  1662.  
  1663. deposititems(dest, stack, from, open, item1, item2, ...)
  1664.  
  1665. Deposits all {...} items on depot, separating stackables from normal ones, the boolean 'open' parameter is to set if the bot should open the depot chest or not. Parameter dest is the name of the container for normal items, parameter stack is the name of the container for stackable items/
  1666.  
  1667. dropitemsex(int cap, string item1, string item2, ...)
  1668.  
  1669. Will drop the items described on parameters until you have reached `cap` capacity.
  1670.  
  1671. goback()
  1672.  
  1673. Simply an alias for gotolabel(0).
  1674.  
  1675.  
  1676. Player Functions
  1677.  
  1678. The following functions are concerned with your characters information.
  1679. string getelementword(string element)
  1680.  
  1681. Returns the word for the passed element. (vis, flam, frigo, mort, tera, san)
  1682.  
  1683. bool trapped()
  1684.  
  1685. Checks if you are trapped, returns true if you are, false if you are not.
  1686.  
  1687. table getplayerskill()
  1688.  
  1689. Will return the characters skill (sword, club, axe or distance) value on a table {$skill, $skillpc}.
  1690.  
  1691. table spelldamage(string spellname, optional level, optional mlevel, optional skill)
  1692.  
  1693. Will return the min and max damage you can deal with the spell, pass the spell name, not words, i.e. energy wave or rage of the skies. Returns a table {min_damage, max_damage}.
  1694.  
  1695.  
  1696. -----------------------------------SCRIPT LIBRARIES - RAPHAEL-------------------------------
  1697. Raphaels's Functions
  1698.  
  1699. Well, this is my library. Here you will find some useful functions developed by me, most time savers. Give me suggestions and ideas if you like it.
  1700.  
  1701. General Information Functions
  1702.  
  1703. Functions that gives you some kind of information about tibia.
  1704. number boatprice(string source, stirng destination)
  1705.  
  1706. Returns the cost to travel from source to destination.
  1707.  
  1708. boolean canlevitate(number x, number y, opt number z)
  1709.  
  1710. Returns if the specificed tile has enought crates/boxes etc to levitate.
  1711.  
  1712. int flasks()
  1713.  
  1714. Returns the number of visible small, medium and large empty flasks
  1715.  
  1716. int gold()
  1717.  
  1718. Returns the number of visible gold, including platinum and crystal coins
  1719.  
  1720. int exptolvl(opt number baselevel, number level)
  1721.  
  1722. Returns the amount of exp needed to reach level level from level baselevel. If you don't specify baselevel it will be defaulted to 1.
  1723.  
  1724. number finditem(number id, opt number index)
  1725.  
  1726. Returns the location of the first item of id id in the screen. If you don't want to get the first one, specify index.
  1727.  
  1728. number listversion()
  1729.  
  1730. Returns Item ID List version.
  1731.  
  1732. number/table getcont(opt string location, opt boolean bpsonly, opt number index)
  1733.  
  1734. Returns all visible containers. Optionally, you can specify the location for it to search. If you don't want the script to consider any container, you can specify bpsonly to true, and it will only look for backpacks. Also, you can choose to get only one id, using the index parameter.
  1735.  
  1736. bool iscursonin(number sx, number sy, number fx, number fy, opt boolean area)
  1737.  
  1738. Returns true if mouse is inside the area specified by sx, sy, fx, fy, Optionally, you can specify area as true to make fx and fy the side of the rectangle, instead of the other point of it. Example: iscursorin(30, 25, 60, 45) = iscursorin(30, 25, 30, 20, true)
  1739.  
  1740. int sstime(string world)
  1741.  
  1742. Returns the time to the next server save on world world, in seconds. Example: sstime('pacera')
  1743.  
  1744.  
  1745. Scripting Help Functions
  1746.  
  1747. Here are some functions that might help you to write your own scripts. That doesn't mean the other ones might not.
  1748. beep()
  1749.  
  1750. Simply plays a beep.
  1751.  
  1752. int cettime()
  1753.  
  1754. Returns current time in CET, in seconds.
  1755.  
  1756. int cetoffset()
  1757.  
  1758. Returns the offset from your current timezone to CET, in seconds.
  1759.  
  1760. int distto(int fx, int fy, int fz, int sx, int sy, int sz, bool anyfloor)
  1761.  
  1762. Returns the first distance between the two group of coordinates. Optinally set anyfloor to true in order to make it accept any floor, instead of only the current one. If anyfloor is not true and the character isn't in the same floor, it will return -1.
  1763.  
  1764. dropflasks()
  1765.  
  1766. Simply moves all flask to ground.
  1767.  
  1768. exec(string execstring)
  1769.  
  1770. Executes the code inside the string execstring. Example: local command = 'say("wassup dude")' exec(command)
  1771.  
  1772. string findrope()
  1773.  
  1774. Looks for any rope in the characters inventory/hotkeys, and return its name.
  1775.  
  1776. string findshovel()
  1777.  
  1778. Looks for any shovel in the characters inventory/hotkeys, and return its name.
  1779.  
  1780. string get(string setting)
  1781.  
  1782. Returns the value of the setting setting. Uses getpath function to get the full path.
  1783.  
  1784. string getpath(string setting)
  1785.  
  1786. Returns the full path to the setting setting. If it can't be found, returns nil.
  1787.  
  1788. str math.format(number n, string pattern)
  1789.  
  1790. Returns a string representation of the number n, matching the specified pattern. Example: math.format(30, "000.0") --> 030.0 math.format(30, "0.00") --> 30.00 math.format(30.25, "0.0") --> 30.25
  1791.  
  1792. moveitemlist(string locationto, string locationfrom, string/number item1, string/number item2, ...)
  1793.  
  1794. Moves all items written in itemlist to locationto. If you specify locationfrom it will get only items from that location. Example: moveitemlist('brocade backpack', 'red backpack', 'cyclops trophy', 'halberd', 'cyclops toe')
  1795.  
  1796. movewhilemoveable(number x, number y, number z, opt number dx, opt number dy, opt number dz)
  1797.  
  1798. Moves all items from location x, y, z;/i>, while it's moveable. Optinally, you can specify dx, dy, dz;/i> as destination. Example: movewhilemoveable(1234, 4567, 9)
  1799.  
  1800. npctalk(string say1, string say2, ...)
  1801.  
  1802. Will make your character say all text parameters given, in NPC channel. If it's not open, it will say the first phrase in default chuannel, and wait until it opens. Example: npctalk('hi', 'deposit all', 'yes', 'balance')
  1803.  
  1804. pm(string message, string player1, string player2, ...)
  1805.  
  1806. Will message all players. First it will check if the correspondent channel is open, if it's not it will pm the player using '* playername * message' format.
  1807.  
  1808. string set(string setting, string value, opt bool updategui)
  1809.  
  1810. Sets any setting of the bot to the value specified by value. The full path will be get using getpath function and value must be one of the possible values for that field typed in exactly as it appears in the settings. Optionally, you can pass false as the third paramater to prevent the value from updating in the GUI until you move your mouse over the setting. This is to speed things up since redrawing GUIs can be expensive on the CPU.
  1811.  
  1812. sethealrule(string rulename, opt string hprange, opt string mprange, opt string method, opt string condition, opt string spam)
  1813.  
  1814. Simply set all settings of a HealRule. If any setting is not specified or empty, this one will not be modified. Examples: sethealrule('HealRule1', '300-900', '0-50%', '', 'if paralyze') sethealrule('HealRule1', '', '', 'health potion', 'paralyzed') sethealrule('HealRule1, '300 to 900', '0 to 15%', '', 'none', '200-400')
  1815.  
  1816. sethotkey(string hkname, string state)
  1817.  
  1818. Sets the hotkey hkname to state state. state will be converted using toyesno() function.
  1819.  
  1820. str string.at(string text, int n)
  1821.  
  1822. Returns the nth chracter inside string text.
  1823.  
  1824. str string.cap(string text)
  1825.  
  1826. Returns the string text with first letter in upper case and all others in lower case. Example: string.capitalize('this is A TEST') --> 'This is a test'.
  1827.  
  1828. str string.capall(string text)
  1829.  
  1830. Returns the string text with the first letter of each word in upper case and all others in lower case. Example: string.capitalizeall('this is A TEST') --> 'This Is A Test'.
  1831.  
  1832. str string.capitalize(string text)
  1833.  
  1834. Returns the string text with first letter in upper case and all others in lower case. Example: string.capitalize('this is A TEST') --> 'This is a test'.
  1835.  
  1836. str string.capitalizeall(string text)
  1837.  
  1838. Returns the string text with the first letter of each word in upper case and all others in lower case. Example: string.capitalizeall('this is A TEST') --> 'This Is A Test'.
  1839.  
  1840. bool string.end(string text, string substr)
  1841.  
  1842. Returns wheter text last characters are lt;i>substr.
  1843.  
  1844. str string.explode(string text, string separator)
  1845.  
  1846. Returns a table with all sub-strings split by separator. Example: string.explode('Hello # My # Name # Is # Anonymickey', '#') --> table = {'Hello', 'My', 'Name', 'Is', 'Anonymickey'}. Credits to Socket and Hardek for this one.
  1847.  
  1848. bool string.starts(string text, string substr)
  1849.  
  1850. Returns wheter text first characters are lt;i>substr.
  1851.  
  1852. string string.sub2(string s, number i, opt number l)
  1853.  
  1854. Returns the substring of s that starts at i and continues for l characters.
  1855.  
  1856. int sqmWidth()
  1857.  
  1858. Returns the width of each sqm in your screen.
  1859.  
  1860. int table.find2(table, value, arg, notable, argonly)
  1861.  
  1862. Returns the index of value inside table, nil if it can't be found. If you don't specify notable as true it will search inside any table in the main one and return the index inside that secondary table also, as a secondary parameter. Optionally, you can specify arg if your main table is filled with other tables, and the function will look only on this index. You can also set argonly if you don't want to search for values outside secondary tables. Examples: table.find2(t, 'distance') table.find2(t, 'distance', 'type') table.find2(t, 'distance', 'type', false, true) table.find2(t, 'distance', '', true)
  1863.  
  1864. bool table.isempty(table t)
  1865.  
  1866. Returns true if table t is empty.
  1867.  
  1868. tab table.random(table t, number start, number finish, opt number count, opt number step)
  1869.  
  1870. Returns a table filled with random numbers between start and finish. If count is specified, it's the maximum length of the table, meaning it will return only count random numbers inside the given range. You can also specify step, wich means it will count only multiples. Example: table.random(5, 10) --> {7, 10, 9, 8, 5, 6} table.random(5, 10, 3) --> {7, 10, 9} table.random(5, 10, 0, 2) --> {7, 9, 5}
  1871.  
  1872. int table.size(table t)
  1873.  
  1874. Returns the number of components inside the table.
  1875.  
  1876. str time(number n, opt string pattern)
  1877.  
  1878. Returns a string representation of a second time interval n in the format "dd:hh:mm:ss" depending on lenght. Optionally, you can set the format by specifying pattern parameter. Examples: time(5000) --> 01:23:20 time(5000, 'hh:mm') --> 01:23 time(30) --> 00:30
  1879.  
  1880. str timezone()
  1881.  
  1882. Returns a string with your time zone based on your current location. Example: timezone() --> GMT -2 (If you are from Brazil)
  1883.  
  1884. str toyesno(str/bool/num arg)
  1885.  
  1886. Converts the argument in 'yes' or 'no'. arg can be a boolean value, a string (which will be always 'yes', unless it's 'no' or empty), or a number (which will be always 'yes', unless it's 0).
  1887.  
  1888.  
  1889. Character Info Functions
  1890.  
  1891. Functions that can give you information about your character.
  1892. tab bestskill()
  1893.  
  1894. Returns a table with type, skill and skillpc of the your highest skill.
  1895.  
  1896. int levelpc()
  1897.  
  1898. Returns the percent missing for you to advance a level.
  1899.  
  1900. int maxcap()
  1901.  
  1902. Returns the estimated maximun capacity of your character, based on vocation() function.
  1903.  
  1904. int skilltime(string skilltype)
  1905.  
  1906. Returns estimated time to advance in skill skilltype in seconds. skilltype can be: 'magic', 'fist', 'club', 'sword', 'axe', 'distance', 'shielding and 'fishing. Note: It will only start to 'analyze' when you run it for the first time. Example: skilltime('sword')
  1907.  
  1908. int utctime()
  1909.  
  1910. Returns current time in UTC, in seconds.
  1911.  
  1912. int utcoffset()
  1913.  
  1914. Returns the offset from your current timezone to UTC, in seconds.
  1915.  
  1916. str vocation()
  1917.  
  1918. Returns your character vocation. It will try to differ druid from sorcerer checking if it's wearing any rod/wand, if it's not it will return only 'mage'. Also, if it's not possible to determinate your character vocation by any method, it will return 'unknown'.
  1919.  
  1920. tab weaponskill()
  1921.  
  1922. Returns a table with type, skill and skillpc of the your current weapon skill.
  1923.  
  1924.  
  1925. File Handling Functions
  1926.  
  1927. These functions will help you when working with files, reading, writing, anything related to it.
  1928. clearfile(string filename)
  1929.  
  1930. Erases all the content inside file filename. Example: clearfile('test.txt')
  1931.  
  1932. createfile(string filename)
  1933.  
  1934. Creates a file with the name filename, if it doesn't exist. Example: createfile('test.txt')
  1935.  
  1936. execfile(string filename)
  1937.  
  1938. Executes the code inside the file filename. Example: exec('test.txt')
  1939.  
  1940. bool isfileline(string filename, string text)
  1941.  
  1942. If text is a line inside file filename, returns line number, false otherwise. Example: isfileline('test.txt', 'test')
  1943.  
  1944. createfile(string filename)
  1945.  
  1946. Creates a file with the name filename, if it doesn't exist. Example: createfile('test.txt')
  1947.  
  1948. string filecontent(string filename)
  1949.  
  1950. Returns the content of the whole file filename. Example: filecontent('test.txt')
  1951.  
  1952. bool fileexists(string filename)
  1953.  
  1954. Returns true if the file filename exists, false otherwise. Example: fileexists('test.txt')
  1955.  
  1956. str fileline(string filename, number linenum)
  1957.  
  1958. Returns line of number linenum of the file filename. Example: fileline('test.txt', 10)
  1959.  
  1960. int filelinescount(string filename)
  1961.  
  1962. Returns number of lines of file linenum. Returns 0 if it doesn't exists, or if it's empty. Example: filelinescount('test.txt')
  1963.  
  1964. filewrite(string filename, string text)
  1965.  
  1966. Writes text in the file filename. Example: filewrite('test.txt', 'This is my test.')
  1967.  
  1968. filewriteline(string filename, string text)
  1969.  
  1970. Writes text in the file filename. Example: filewriteline('test.txt', 'This is my test.')
  1971.  
  1972. filerewrite(string filename, string text)
  1973.  
  1974. Clears the file filename and writes text in it . Example: filerewrite('test.txt', 'This is my test.')
  1975.  
  1976.  
  1977. Input Functions
  1978.  
  1979. Here are some general functions, I will probably organize it better later.
  1980. hex keyid(string/number key)
  1981.  
  1982. Returns the correspondent hexadecimal code of key key. Useful if you don't want to keep looking at internet lists while using keyevent(..) function. Example: keyevent(keyid('tab')) or keyevent(keyid('a'))
  1983.  
  1984. press(string keys)
  1985.  
  1986. Presses the keys inside the string keys. Special keys MUST be inside [brackets]. Example: press('account[tab]password[enter]')
  1987.  
  1988.  
  1989. ------------------------------SCRIPT LIBRARIES - LUCAS TERRA---------------------------------
  1990.  
  1991. Lucas Terra's Functions
  1992.  
  1993. This is my library file which contains useful functions that enhance the basic functions of Neobot or use them to create additional functionality.
  1994.  
  1995. Alert Functions
  1996.  
  1997. The following functions are related with alarms on bot.
  1998. addtosafelist(string alarmtype, string playername1, string playername2, ...)
  1999.  
  2000. Adds players to safe list.
  2001.  
  2002. playsoundflash(string soundname)
  2003.  
  2004. Plays a sound and flashes the client.
  2005.  
  2006. removefromsafelist(string alarmtype, string playername1, string playername2, ...)
  2007.  
  2008. Remove players to safe list.
  2009.  
  2010. setalarm(string alarmtype, string playsound, string pausebot, string logout)
  2011.  
  2012. Changes the activity of an alarm. alarmtype can be: 'playeronscreen', 'playerattacking', 'defaultmessage', 'privatemessage', 'gmdetected', 'disconnected', 'crashfrozed'. If you activate or deactivate playsound it will automatically do the same for FlashClient. Example: setalarm('playeronscreen','on','off','off') -- Will enable playing sound and flashing client, disable pausing cavebot and disable auto-logout when player on screen.
  2013.  
  2014.  
  2015. Creature Functions
  2016.  
  2017. The following functions issue an event related with creature manipulation.
  2018. castspell(string name, optional pointer creature)
  2019.  
  2020. Casts the spell if you have enough mana, level, soul, etc. needed for the spell. If you pass a complement it will check if you can cast the spell on creature complement. Example: castspell('exevo vis hur', $attacked), casts energy wave only if your current attacked creature is on spell range.
  2021.  
  2022. castspellarea(string name, int amount, optional bool ignoreplayers, string monstername1, string monstername2, ...)
  2023.  
  2024. Casts the spell name if more than amount monsters will get damage because of it, it won't cast if there is a player on the spell area, unless you pass ignoreplayers as true. If you don't pass any monster, it will consider all monsters, so you can optionally choose which monsters you want to consider.
  2025.  
  2026. caststrike(int a, int b)
  2027.  
  2028. Will cast the best strike spell on current attacked monster. The a, b is the delay between each strike spell.
  2029.  
  2030. caststrongstrike(int a, int b, optional int minimumpc)
  2031.  
  2032. Will cast the best strong strike spell on current attacked monster. The a, b is the delay between each strike spell. Minimum pc is the minimum damage mod to cast a strong strike spell.
  2033.  
  2034. bool cancastspell(string name, optional pointer creature)
  2035.  
  2036. Returns true if you have enough mana and soul points, if you have level and mlevel high enough to cast spell spellname, false otherwise. Case the spell you're trying to cast needs a target, you can pass the target as an optional creature, so it will tell if target is on spell range. You can pass 'strike' or 'strong strike' as spellname, to check if you're able to cast the best strong/strike spell.
  2037.  
  2038. bool cooleddown(string spellname)
  2039.  
  2040. Returns true if the cooldown for spell spellname is 0, false otherwise.
  2041.  
  2042. pointer findcreature(string creaturename)
  2043.  
  2044. Will search for every creature on screen, and check if a creature called by creaturename is on screen, if so, it will return this creature're informations, else, it will return nil. Example: local v = findcreature('Bubble') print(v.id) -- Will print Bubble's ID if she was found on screen
  2045.  
  2046. pointer1, pointer2, ... findmonstersonspellrange(string spelltype, direction)
  2047.  
  2048. Will iterate trought all monsters on screen and check which of these are on spell range of spell spelltype. Check cancastspell function for more information about spelltype. The function returns pointers for all monsters. You can create a table with these by doing: local monsters = {findmonstersonspellrange('6x6')}.
  2049.  
  2050. pointer1, pointer2, ... findplayersonspellrange(string spelltype, direction)
  2051.  
  2052. Will iterate trought all players on screen and check which of these are on spell range of spell spelltype. Check cancastspell function for more information about spelltype. The function returns pointers for all monsters. You can create a table with these by doing: local players = {findplayersonspellrange('bigwave')}.
  2053.  
  2054. pointer findcreatureontile(int x, int y, int z)
  2055.  
  2056. Returns the first creature found on tile x,y,z.
  2057.  
  2058. string getbestspell(string monstername, string type)
  2059.  
  2060. Returns the best strike spell to shoot in a monster. It will check for the best strike spell (exori frigo, exori flam...) to shoot in a monstername. Example: getbestspell('rat', 'strong strike') or getbestspell('demon', 'strike')
  2061.  
  2062. bool iscreaturereachable(pointer creaturename)
  2063.  
  2064. Returns true if a creature is reachable, false otherwise.
  2065.  
  2066. bool isonspellarea(pointer creature, string spelltype, optional string direction)
  2067.  
  2068. Returns true if you can cast a spell of type spelltype on the creature creature, false otherwise. spelltype can be: 'smallwave', 'bigwave', 'smallbeam', 'bigbeam', 'strike', '1x1', '2x2', '3x3', '5x5' and '6x6'. The direction can be passed to tell if you can cast spell by turning to some direction. direction can be: 'w', 'e', 's', 'n', 'any' or nil.
  2069.  
  2070. bool ispk(pointer creature)
  2071.  
  2072. Returns true if creature has a white, red, yellow or orange, false otherwise.
  2073.  
  2074. int maroundignore(int monsterdist, string monster1, string monster2...)
  2075.  
  2076. Returns how many monsters on your screen which are not on the parameters list. Example: maroundignore(7, 'Rat', 'Bug') will return how many monsters that aren't Rat nor Bug are on your screen.
  2077.  
  2078. int maroundfloor(int monsterdist, int or string floordifference, string monster1, string monster2...)
  2079.  
  2080. Returns how many monsters, considering all the visible floors. You may specify the monster distance on monsterdist. Floor is how many floors up or down. If you specify a number, like 2, it will consider the floors: -2, -1, 0, +1, +2. If you specify a string, like: '+2', it will consider the floors: 0, +1, +2.
  2081.  
  2082. int maroundfloorignore(int monsterdist, int or string floordifference, string monstertoignore1, string monstertoignore2...)
  2083.  
  2084. Returns how many monsters, considering all the visible floors. You may specify the monster distance on monsterdist. Floor is how many floors up or down. If you specify a number, like 2, it will consider the floors: -2, -1, 0, +1, +2. If you specify a string, like: '+2', it will consider the floors: 0, +1, +2. It will ignore the monsters you specify, it's like a safe list.
  2085.  
  2086. int maroundspell(string spelltype, optional string direction, string monstername1, string monstername2, ...)
  2087.  
  2088. Returns in how many monsters you can cast the spell that has area of spelltype. If no monsters was specified, then it will consider all monsters. To check the possible spelltypes check the function cancastspell. Optionally you can pass a direction, to tell how many monsters would recieve your spell if you turned in to direction direction.
  2089.  
  2090. int maroundspellignore(string spelltype, optional string direction, string monstername1, string monstername2, ...)
  2091.  
  2092. Same as maroundspell but instead of considering monsters on table it will ignore monsters on table.
  2093.  
  2094. massheal(int hppc, int amount, optional bool considerenemies, optional table enemylist, optional friendname1, optional friendname2, ...)
  2095.  
  2096. Casts 'exura gran mas res' if there are more than amount players with less than hppc% of health and on spell range. You can optionally pass an enemy list, and if you want to consider enemies, it won't cast the spell if there is any enemy on the spell range. If you don't pass any friend, it will consider every player as friend. You can also make monsters as by passing its IDs.
  2097.  
  2098. mounting(pointer creature)
  2099.  
  2100. Returns true if creature is currently mounting a monster, false otherwise. If you don't pass a creature it will consider yourself.
  2101.  
  2102. movecreature(pointer creature, optional string direction)
  2103.  
  2104. Will push the creature creature to direction direction. If you don't pass a direction it will try to push the creature to the first pushable spot.
  2105.  
  2106. mwall(pointer creature, optional dist)
  2107.  
  2108. Shoots a magic wall rune dist sqms in front of creature's current position. You can shoot it in your back by doing: mwall($self, -1)
  2109.  
  2110. int paroundfloor(int playerdist, int or string floordifference, string player1, string player2...)
  2111.  
  2112. Returns how many players, considering all the visible floors. You may specify the players distance on playerdist. Floor is how many floors up or down. If you specify a number, like 2, it will consider the floors: -2, -1, 0, +1, +2. If you specify a string, like: '+2', it will consider the floors: 0, +1, +2.
  2113.  
  2114. int paroundfloorignore(int playerdist, int or string floordifference, string playertoignore1, string playertoignore2...)
  2115.  
  2116. Returns how many players, considering all the visible floors. You may specify the players distance on playerdist. Floor is how many floors up or down. If you specify a number, like 2, it will consider the floors: -2, -1, 0, +1, +2. If you specify a string, like: '+2', it will consider the floors: 0, +1, +2. It will ignore the players you specified, like a safe list.
  2117.  
  2118. int paroundignore(int playerdist, string name1, string name2...)
  2119.  
  2120. Returns how many players on your screen which are not on the parameters list. Example: paroundignore(7, 'Bubble', 'Eternal Oblivion') will return how many players that aren't Bubble nor Eternal Oblivion are on your screen.
  2121.  
  2122. int paroundspell(string spelltype, optional string direction, string playername1, string playername2, ...)
  2123.  
  2124. Returns in how many players you can cast the spell that has area of spelltype. If no players was specified, then it will consider all players. To check the possible spelltypes check the function cancastspell. Optionally you can pass a direction, to tell how many players would recieve your spell if you turned in to direction direction.
  2125.  
  2126. int paroundspellignore(string spelltype, optional string direction, string playername1, string playername2, ...)
  2127.  
  2128. Same as paroundspell but instead of considering players on table it will ignore players on table.
  2129.  
  2130. potionfriend(optional int id, int pc, int dist, string friendname1, string friendname2, ...)
  2131.  
  2132. Will iterate trought the friends you have choosen and check which one has the lowest HP%, then it will use a potion with id id on the friend. Only friends with HP lower than pc and dist sqms closer to you will be considered.
  2133.  
  2134. sio(int hppc, string playername1, string playername2)
  2135.  
  2136. Will iterate trought the friends you have choosen and check which one has the lowest HP%, then it will use 'heal friend' spell on him. Only friends with HP lower than hppc will be considered.
  2137.  
  2138. table spellinfo(string spellname)
  2139.  
  2140. Returns a table containing the following informations of a spell: name, words, mp, level, mlevel, soul, price, needpremium, condition, mindmg, maxdmg.
  2141.  
  2142. stopattack()
  2143.  
  2144. Will make your character stop attack/follow by pressing the ESC key.
  2145.  
  2146. waitandlogout()
  2147.  
  2148. Will wait until your battle sign goes out, killing any reachable monster on your screen and then logout.
  2149.  
  2150. int weaponattack(int id)
  2151.  
  2152. Returns the attack of an item. If id wasn't given the weapon you're currently equipped will be considered.
  2153.  
  2154. string wheretoturn(int m, string spelltype)
  2155.  
  2156. Returns the direction you should turn to cast spell in creature m.
  2157.  
  2158.  
  2159. Item Functions
  2160.  
  2161. The following functions issue an event related with item manipulation.
  2162. bool areitemsontile(int x, int y, int z, optional bool/number considercap, optional bool considermoveable, string item1, string item2, ...)
  2163.  
  2164. Returns true if any of the items specified were found on SQM x,y,z, false otherwise. You may also specify if you want to consider only items you're able to pick up by passing considercap as true, or it will only consider the item if you have more than considercap of capacity. The considermoveable to only consider the item if there are no unmoveable items above it.
  2165.  
  2166. int bestelementweapon(name creaturename)
  2167.  
  2168. Returns the ID of the best wand or rod you should equip to do the more damage on monster creaturename.
  2169.  
  2170. closebpcolor(string bpcolor, optional int indexstart, optional int indexend)
  2171.  
  2172. Will close all of your opened backpacks with color bpcolor. It will check from index indexstart to indexend.
  2173.  
  2174. collecthiddenitems(string dist, int itemid1, int itemid2...)
  2175.  
  2176. Will pickup any of the items specified found on screen. If there's an item above it the bot will move it to get your item.
  2177.  
  2178. collectitems(string destination, int itemid1, int itemid2...)
  2179.  
  2180. Will pickup any items around you that has an ID inside table itemids. Example1: collectitems('', 'gold coin', 'platinum coin', 'serpent sword'). Example2: collecitems(''). Will pickup any pickupable items around you.
  2181.  
  2182. bool comparecontainers(pointer container1, pointer container2)
  2183.  
  2184. Returns true if the container1 is the same as container2, false otherwise.
  2185.  
  2186. dropitems(string destination, int itemid1, int itemid2...)
  2187.  
  2188. Will drop all the items you selected from your backpacks to the destination. If destination is not specified it will be considered as your current position. Examples: dropitems('gold coin','mace','stone skin amulet') or dropitems(ground(32222,32614,7),'gold coin','mace','stone skin amulet')
  2189.  
  2190. eatfoodfull(optional string location)
  2191.  
  2192. Will eat food until you get a 'You are full.' message. You can also eat food from ground. Just pass 'ground' as extra parameter. Or the exactly location: 'ground x y z'.
  2193.  
  2194. enchantspear(string handname)
  2195.  
  2196. If you have enough mana and spears on your backpack it will unequip the weapon that's in handname and equip you with a spear, then cast 'exeta con'. Then it will unequip your enchanted spear and equip you back with the weapon your were wearing.
  2197.  
  2198. string,int finditem(int itemid)
  2199.  
  2200. Will look on the inventory where is the item with ID itemid, the function returns the BP Index if item was found on backpack.
  2201.  
  2202. string,pointer findshield()
  2203.  
  2204. Will look in which hand you're using a shield or spellbook and return it as a string: 'lhand' or 'rhand' and as a second value will return the hand pointer: $rhand or $lhand. Example: x,y = findshield()
  2205.  
  2206. string,pointer findweapon()
  2207.  
  2208. Will look in which hand you're using a weapon and return it as a string: 'lhand' or 'rhand', and as a second value will return the hand pointer: $rhand or $lhand. The weapons considered are axes, swords, clubs, wands, rods, distance weapons and bows/crossbows. Example: x,y = findweapon()
  2209.  
  2210. string,int findweapontouse()
  2211.  
  2212. Will search for a weapon in your containers and the function will return two values, the first one is related to where the item is located, in your containers, in your hand or in your belt. The second value is an integer number, related to the ID of item found.
  2213.  
  2214. string findweapontype()
  2215.  
  2216. Will look in what kind of weapon you're using and return it as a string: 'axe', 'sword', 'club', 'wand', 'rod', 'bow' or 'distance weapon'.
  2217.  
  2218. fish(optional int n)
  2219.  
  2220. Fishes on empty water spots. If n is not specified, the bot will fish only in spots that contain fish. If n is specified and lower than 100, it will use the rod on water with no fish n% of the time. If n > 100, it specifies an item id to fish on, such as water elemental bodies. Examples: fish() -- Uses rod only on water SQMs that contains fish fish(30) -- Uses rod on water SQMs with no fish in 30% of the time and on SQMs that contains fish in 70% of the time fish(9582) -- Uses rod in a water elemental body
  2221.  
  2222. int fishspots(optional int n)
  2223.  
  2224. Returns how many fish spots are avaliable on screen. If n is not specified, the bot will look only in spots that contain fish. If n is specified it will look for how many spots has the ID n.
  2225.  
  2226. int foodcount()
  2227.  
  2228. Returns how many food items can be found on your opened containers.
  2229.  
  2230. table getarearunetile(bool ignoreplayers, string monstername1, string monstername2...)
  2231.  
  2232. Returns a table with informations where you will damage the more amount of creatures you choosen. The ignoreplayers is a boolean value for non-pvp worlds. The table is: tile, amount, x, y, z
  2233.  
  2234. table getbpindex(string bpcolor)
  2235.  
  2236. Will search through your opened backpacks and search for a backpack with color bpcolor. The function returns a table listing all the BPs index with the color you choosen.
  2237.  
  2238. bool isfood(int id)
  2239.  
  2240. Returns true if the item checked is a food, false otherwise.
  2241.  
  2242. bool iscontainerfull(int containerid)
  2243.  
  2244. Returns true if the container with ID containerid is full, false otherwise.
  2245.  
  2246. int itemcountcorpse(string corpsename, int itemid1, int itemid2, ...)
  2247.  
  2248. Returns the amount of items inside corpse corpsename.
  2249.  
  2250. moveitemfromcorpse(string corpsename, string destination, int amount, int itemid1, int itemid2, ...)
  2251.  
  2252. Moves items from corpse corpsename to destination.
  2253.  
  2254. moveitemonground(int xfrom, int yfrom, int zfrom, int xto, int yto, int zto)
  2255.  
  2256. Moves an item from xfrom yfrom zfrom to xto yto zto.
  2257.  
  2258. openbps(table {int bpid, string location, optional bool opennew, optional int index}, table {int bpid, string location, optional bool opennew, optional int index}, ...)
  2259.  
  2260. Open backpacks in the order you specified.
  2261.  
  2262. openbpslogin(table {int bpid, string location, optional bool opennew, optional int index}, table {int bpid, string location, optional bool opennew, optional int index}, ...)
  2263.  
  2264. Open backpacks on login in the order you specified.
  2265.  
  2266. opengrounditem(int id)
  2267.  
  2268. Will search for an item with id id on ground and open it.
  2269.  
  2270. pick(int x, int y, int z)
  2271.  
  2272. Will move any items or creatures above the hole spot and use a pick on it.
  2273.  
  2274. pickupitems(optional string direction, optional string destination, optional int amount)
  2275.  
  2276. Pick up items at the SQM located in the direction you have choosen to the destination you have choosen. If you leave direction empty it will take it as 'c' (center). directions can be: 'sw', 's', 'se', 'w', 'c', e', 'nw', 'n', 'ne'. Amount is 100 by default.
  2277.  
  2278. refillammo()
  2279.  
  2280. Refills ammunition in your inventory. Will check if you are wearing a ammunition, if you are and it has less than 100 it will equip more of the same kind. If you're using an ammunition and it's not restoring it you can add the ID on LucasTerra.lua file.
  2281.  
  2282. resetbodylists()
  2283.  
  2284. Resets the body lists to the default settings.
  2285.  
  2286. int searchcontainerincontainer(int containerid)
  2287.  
  2288. Looks for a container inside the container with ID containerid. If it's found, the function returns its ID, or it will return false if no container was found.
  2289.  
  2290. shootarearune(int runeid, optional int amount, optional bool ignoreplayers, optional string monstername1, optional string monstername2...)
  2291.  
  2292. Shoots a rune with id runeid at the sqm which will target more monsters. The minimum amount of monsters can be specified on amount, if amount is not specified then amount will be considered as 1. ignoreplayers is a boolean value for non-pvp worlds.
  2293.  
  2294. shootbestrune(int a, int b, optional pointer creature, optional disconsiderrunedamage)
  2295.  
  2296. Will shoot the best rune (heavy magic missile rune, icicle rune, fireball rune or stalagmite rune) according to the monster you are currently attacking, it will check for the monster's weakness and wait from a to b. If you set disconsiderrunedamage to true it won't consider the rune damage, only the monster's weakness.
  2297.  
  2298. skin(int dist, optional bool movebody, optional bool waitfresh)
  2299.  
  2300. Will look for dead bodies in a range of dist SQMs and use obsidian knife on it. Optionally, you can make it skin even bodies that are covered with trash above, setting movebody to true, and you can make it wait until the body becomes skinnable by setting waitfresh to true. To manage the skin bodies' list you can use the following function: SKINLIST:add(string monstername, ...), to add a monster, example: SKINLIST:add('minotaur', 'minotaur archer') SKINLIST:remove(string monstername, ...), to remove a monster, example: SKINLIST:remove('dragon', 'dragon lord', 'lizard highguard') SKINLIST:clear(), to delete all monsters To see your current skin list you can do: print(SKINLIST)
  2301.  
  2302. int skinspots(int dist, optional bool movebody, optional bool waitfresh)
  2303.  
  2304. Returns how many "skinnable" dead bodies are in a range of dist SQMs on screen.
  2305.  
  2306. skinkitchenknife(int dist, optional bool movebody, optional bool waitfresh)
  2307.  
  2308. Will look for dead bodies in a range of dist SQMs and use a kitchen knife on it. Optionally, you can make it skin even bodies that are covered with trash above, setting movebody to true, and you can make it wait until the body becomes skinnable by setting waitfresh to true. It only considers dead rabbits.
  2309.  
  2310. int skinkitchenknifespots(int dist, optional bool movebody, optional bool waitfresh)
  2311.  
  2312. Returns how many "skinnable" dead rabbits are in a range of dist SQMs on screen.
  2313.  
  2314. stake(int dist, optional bool movebody, optional bool waitfresh)
  2315.  
  2316. Will look for dead bodies in a range of dist SQMs and use blessed wooden stake on it. Optionally, you can make it stake even bodies that are covered with trash above, setting movebody to true, and you can make it wait until the body becomes stakeable by setting waitfresh to true. To manage the skin bodies' list you can use the following function: STAKELIST:add(string monstername, ...), to add a monster, example: STAKELIST:add('vampire', 'demon') STAKELIST:remove(string monstername, ...), to remove a monster, example: STAKELIST:remove('vampire', 'demon') STAKELIST:clear(), to delete all monsters To see your current stake list you can do: print(STAKELIST)
  2317.  
  2318. int stakespots(int dist, optional bool movebody, optional bool waitfresh)
  2319.  
  2320. Returns how many "stakeable" dead bodies are in a range of dist SQMs on screen.
  2321.  
  2322. string trueitemproperties(int itemid)
  2323.  
  2324. Returns all the item properties enabled on item itemid. For example: trueitemproperties(3031) returns: ""
  2325.  
  2326. usegrounditem(int itemid)
  2327.  
  2328. Will search for an item with ID itemid and use it. You can also do: usegrounditem(x,y,z), to use a coordinate.
  2329.  
  2330. usedoor(int x, int y, int z, optional string mode)
  2331.  
  2332. Will use open or close a door, if you don't specify the mode ('open' or 'close') it will just switch the door. If there's an item above the door it will just move it.
  2333.  
  2334. waitcontainer(string containername)
  2335.  
  2336. Will wait until a container is opened.
  2337.  
  2338. string wheretomoveitem(int x, int y, int z, optional int id)
  2339.  
  2340. Returns a direction to move an item or creature. It's useful if you want to take an item off a hole or something.
  2341.  
  2342.  
  2343. Food Timer Functions
  2344.  
  2345. The following functions are used to handle food timers.
  2346. int getfoodtime(int id)
  2347.  
  2348. Returns how long in miliseconds the food with id id will make you regenerate.
  2349.  
  2350. int gethungrytime()
  2351.  
  2352. Returns how long in miliseconds you will be regenarating mana/health by food.
  2353.  
  2354. increasehungrytime(int amount)
  2355.  
  2356. Increases the hungry timer by amount.
  2357.  
  2358. resethungrytime()
  2359.  
  2360. Resets the hungry timer.
  2361.  
  2362.  
  2363. Scripting Help Functions
  2364.  
  2365. The following functions are useful for making some calculations/prodecures easier while scripting.
  2366. int bintonum(int x)
  2367.  
  2368. Returns the binary number x wroten in decimal form.
  2369.  
  2370. int color(int r, int g, int b, optional int transparency)
  2371.  
  2372. Converts a number from RGB (red, blue, green) form to HEX form, the transparaceny is given in percentage. Example: color(255,255,255,50), will return the HEX representation for white color with 50% of transparency.
  2373.  
  2374. string currenttime()
  2375.  
  2376. Returns your system's current time in the format: 'HH:MM:SS'.
  2377.  
  2378. int math.highest(int a, int b)
  2379.  
  2380. Returns the highest number between a and b
  2381.  
  2382. int math.lowest(int a, int b)
  2383.  
  2384. Returns the lowest number between a and b
  2385.  
  2386. int math.positive(int number)
  2387.  
  2388. Returns 0 if number is negative and number if it is positive.
  2389.  
  2390. int randomize(table values)
  2391.  
  2392. It will return a random value from a table in the format: {a,b}, a random number from a to b. It makes easier to randomize numbers/timers in some scripts.
  2393.  
  2394. setcavebot(string onoff)
  2395.  
  2396. Turns cavebot on or off. onoff can be: 'on', 'off', 'yes', 'no'.
  2397.  
  2398. sethealing(string onoff)
  2399.  
  2400. Turns healing on or off. onoff can be: 'on', 'off', 'yes', 'no'.
  2401.  
  2402. setlooting(string onoff)
  2403.  
  2404. Turns looting on or off. onoff can be: 'on', 'off', 'yes', 'no'.
  2405.  
  2406. setmanatraining(string onoff)
  2407.  
  2408. Turns mana training on or off. onoff can be: 'on', 'off', 'yes', 'no'.
  2409.  
  2410. settargeting(string onoff)
  2411.  
  2412. Turns targeting on or off. onoff can be: 'on', 'off', 'yes', 'no'.
  2413.  
  2414. swap(a, b)
  2415.  
  2416. The variable b recieves the value of a and a recieves value of b. You can do: swap(table, a, b) to swap values inside a table.
  2417.  
  2418. tilehasinfo(int posx, int posy, int posz)
  2419.  
  2420. Returns true if the location you passed as parameters are on your screen, false otherwise.
  2421.  
  2422. timebetween(string timefrom, string timeto, optional int delay)
  2423.  
  2424. Returns true if the system clock is between timefrom and timeto.
  2425.  
  2426. string tobin(int x, optional bool reverse)
  2427.  
  2428. Return the number x wroten in binary form. If you pass the reverse value, it will return it wroten in the reverse form.
  2429.  
  2430. int tosec(string time)
  2431.  
  2432. Returns how many seconds have passed since '0:00' at time time. Example: tosec('6:32') returns 23520.
  2433.  
  2434. waitmessage(string sendername, string msg, optional int maxwaittime, optional bool exactmsg, optional int msgtype)
  2435.  
  2436. Will wait until a message from sender sendername containing the message msg appears. If you don't pass a maxwaittime it will be considered as 10000 (10 seconds). If you pass exactmsg as true it will only consider the message if it was sent exactly as you wrotten in the function call, considering lower and upper letters. If you pass a msgtype it will check if the message type is the same as you passed on parameter.
  2437.  
  2438. waitping(optional int a, optional int b)
  2439.  
  2440. Waits between $pingaverage*a and $pingaverage*b. If a,b isn't passed it a,b = 1.6, 2.3
  2441.  
  2442.  
  2443. Table Manipulation Functions
  2444.  
  2445. The following functions are used on tables manipulation
  2446. int table.binaryfind(table tablename, x, optional extraparameter)
  2447.  
  2448. Looks for the a match of value x in the table tablename. Returns its position or nil if no value was found. The extraparameter is used for strutctured tables, lets say you have a table with players, you want to search the first which has HPPC 30. So: table.binaryfind(table, 30, 'hppc'). BE CAREFUL! This function only works for sorted tables!
  2449.  
  2450. int table.find(table tablename, x, optional extraparameter)
  2451.  
  2452. Looks for the first match of value x in the table tablename. Returns its position or nil if no value was found. The extraparameter is used for structured tables, lets say you have a table with players, you want to search the first which has HPPC 30. So: table.find(table, 30, 'hppc')
  2453.  
  2454. table.insertsorted(table tablename, value, optional argument, optional string order, optional bool disallowduplicated)
  2455.  
  2456. Will add a value sorting it. You can choose 'asc' or 'desc' in order. If the value you're inserting is a table you MUST pass an argument to tell the way you want to order it. For example, you're addying players in to a table, so you do: table.insertsorted(playerstable, $followed, 'name', 'asc'), this way it will add a player and sort it according to his name. If you don't pass the order it will insert as 'asc'. The optional bool disallowduplicated means it won't accept duplicated items, so it will won't add it if the item is already found on the table. You can also pass multiple parameters to be ordered as, for example: table.insertsorted(monsters, m, {{'dist', 'asc'}, {'hppc', 'desc'}}), will give priority to the closest creatures from you and which has the highest HP%.
  2457.  
  2458. table.lower(table tablename)
  2459.  
  2460. Will look for every string elements on the table tablename and transform it all in lower case characters.
  2461.  
  2462. table.newsort(table tablename, optional extraparameter, optional order)
  2463.  
  2464. Sorts a table on desired order, which can be: 'asc' or 'desc'. The extraparameter is used when you want to sort a structured table, like a players table. table.newsort(players, 'name') will sort the table players according to their names and table.newsort(players, 'id') will sort the table players according to their IDs and so on.
  2465.  
  2466. string table.stringformat(table tablename, string name)
  2467.  
  2468. Returns a table in the string format: name = {item1, item2, item3, ...}
  2469.  
  2470. table.upper(table tablename)
  2471.  
  2472. Will look for every string elements on the table tablename and transform it all in upper case characters.
  2473.  
  2474.  
  2475. String Manipulation Functions
  2476.  
  2477. The following functions are used on messages manipulation
  2478. string, string string.attackername(string msg)
  2479.  
  2480. Returns the name of attacker and the type of an attacker. For example: string.attackername("You lose 3 hitpoints due to an attack by a bug.") returns "bug" and "monster"
  2481.  
  2482. table string.attackmsg(string msg)
  2483.  
  2484. Returns a table containing information about an attack message. The table has the following info: table.dmg, table.target.name, table.target.type, table.dealer.name, table.dealer.type. dmg returns how many hitpoints or mana points it was dealed. target.name returns the target's name, target.type returns the target's type (monster or player). Same for dealer.
  2485.  
  2486. string string.concat(msg1, msg2, msg3...)
  2487.  
  2488. Concatenates words.
  2489.  
  2490. table string.healmsg(string msg)
  2491.  
  2492. Returns a table containing information about a heal message. The table has the following info: table.dmg, table.target, table.healer. dmg returns how many hitpoints or was healed. target returns the target's name, healer returns the healer's name.
  2493.  
  2494. table string.lootmsg(string msg)
  2495.  
  2496. Returns a table containing information about a loot message. It has the structures: name, the name of the creature, items with the sub-structures: name and count. The items is a table which contains informations about each item looted.
  2497.  
  2498. string string.removews(string str)
  2499.  
  2500. Removes white spaces from the string str.
  2501.  
  2502. string string.token(string str, int n)
  2503.  
  2504. Returns the nth token (word/element) of a string str. Example: local word = 'Hey man you rox' print(string.token(word,3)) -- Will print the word you
  2505.  
  2506.  
  2507. Cavebot functions
  2508.  
  2509. The following functions are useful for making cavebot Action waypoints
  2510. allowwalk(int id1, int id2, ...)
  2511.  
  2512. Makes cavebot walk trought ids id1, id2, ...
  2513.  
  2514. int balance()
  2515.  
  2516. It will make you say 'balance' in NPC channel and then check if your current account balance. You can use it anywhere to access your account balance once you had used it once.
  2517.  
  2518. bool breakdworcwall(int x, int y, int z)
  2519.  
  2520. Will use a weapon in a dworc wall until it's broken. If there's a moveable item above it, it will move it. If there's a non-moveable item above it, the function will return false. If the wall was broken successfully the function will return true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2521.  
  2522. bool breakspidersilk(int x, int y, int z)
  2523.  
  2524. Will use a weapon in a spider silk wall until it's broken. If there's a moveable item above it, it will move it. If there's a non-moveable item above it, the function will return false. If the wall was broken successfully the function will return true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2525.  
  2526. buyitemsupto(string itemname, int amount, optional int currentamount)
  2527.  
  2528. Buys items up to a certain amount depending on the amount of items currently held. If you don't specify currentamount value it will, consider only the visible amount.
  2529.  
  2530. bool cutgrass(int x, int y, int z)
  2531.  
  2532. Will use a machete in a grass until it's broken. If there's a moveable item above it, it will move it. If there's a non-moveable item above it, the function will return false. If the wall was broken successfully the function will return true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2533.  
  2534. isdistance(int distx, optional int disty)
  2535.  
  2536. Returns true if you are x sqms close to the action waypoint, false otherwise. You can pass an optional parameter y, so it will check if you're x sqms close horizontally and y sqms close vertically.
  2537.  
  2538. isposition(int x, int y, optional int z)
  2539.  
  2540. Returns true if you are on tile x,y,z, if z is not given it considers your current z.
  2541.  
  2542. isrange(int x, int y)
  2543.  
  2544. Returns true if you are in a range of x horizontal sqms and if you are in a range of y vertical sqms, false otherwise.
  2545.  
  2546. levitate(string direction, string updown)
  2547.  
  2548. Turns your character to the direction and then will cast levitate. Example: levitate('w','up')
  2549.  
  2550. moveitemsdownto(int itemid, int amountto, string bpfrom, string bpto)
  2551.  
  2552. Will leave amountto inside bpfrom and moves what exceeds amountto to bpto.
  2553.  
  2554. moveitemsupto(int itemid, int amountto, string bpto, string bpfrom)
  2555.  
  2556. Moves up to amountto items from container bpfrom to container bpto.
  2557.  
  2558. bool openhole(int x, int y, int z)
  2559.  
  2560. Will use the kind of shovel you've choosen in cavebot settings in a closed whole until it becomes a hole. If there's a moveable item above it, it will move it. If there's a non-moveable item above it, the function will return false. If the hole was opened successfully the function will return true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2561.  
  2562. bool opensand(int x, int y, int z)
  2563.  
  2564. Will use the kind of shovel you've choosen in cavebot settings in a sand until it becomes a hole. If there's a moveable item above it, it will move it. If there's a non-moveable item above it, the function will return false. If the hole was opened successfully the function will return true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2565.  
  2566. opentrade(optional int n, optional bool sayhi)
  2567.  
  2568. Will try to say 'trade' in NPC channel n times, until trade window opens. If n is not specified it will try to open it from 3 to 5 times. If you pass sayhi as true it will say 'hi' before saying 'trade'.
  2569.  
  2570. returnwpt(optional int howmanyback)
  2571.  
  2572. Will go to label $wptid-1 or $wptid-howmanyback
  2573.  
  2574. sellitemsdownto(string itemname, int amount, optional int currentamount)
  2575.  
  2576. Sells items down to a certain amount depending on the amount of items currently held. If you don't specify currentamount value, it will consider only the visible amount.
  2577.  
  2578. sellflasks()
  2579.  
  2580. Sells all of your flasks to the NPC.
  2581.  
  2582. uselever(int x, int y, int z, int leverid)
  2583.  
  2584. Will use a sewer until you go down. If there's a moveable item above the sewer it will move it, if there's a non-moveable item above it the function will return false. If you went down successfully it returns true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2585.  
  2586. usesewer(int x, int y, int z)
  2587.  
  2588. Will use a sewer until you go down. If there's a moveable item above the sewer it will move it, if there's a non-moveable item above it the function will return false. If you went down successfully it returns true. If the coordinates wasn't given the function will use the coordinates of the waypoints you're currently on.
  2589.  
  2590. travel(string destination, optional bool havering)
  2591.  
  2592. Makes you travel to a certain location. The bot will search for the Boat/Carpet NPC and reach it, then it will say: 'hi', destination, 'yes'. If the NPC took you to the wrong place, it will repeat the action until you get there. You can write the city name, like "ab'dendriel" or "ab dendriel", the bot will do it anyway. The optional bool havering is used for when you're travelling with Buddel. If havering is true it will say: 'hi', 'okolnir', 'no', 'yes'. If it's false, it will say: 'hi', 'go', 'okolnir', 'yes'. Special Thanks to botterxxx for getting all the locations.
  2593.  
  2594.  
  2595. Client Information functions
  2596.  
  2597. The following functions return information gathered from the client.
  2598. bool iscreatureontile(int x, int y, int z)
  2599.  
  2600. Returns true if a creature can be found on the tile at given coordinates and false otherwise.
  2601.  
  2602. table cursorinfo()
  2603.  
  2604. Returns a table containing the informations (x,y,z,id,info) about the tile where your mouse is currently on. Example: cursorinfo().id -> returns the ID where your mouse is currently on.
  2605.  
  2606. table findpixel(int posx, int posy)
  2607.  
  2608. Returns a table containing the informations (x,y) about the pixel where you can find the location x,y (in Tibia coordinates). Example: findpos($posx,$posy).x -> returns the horizontal pixel where you're located.
  2609.  
  2610. bool tilewalkable(int x, int y, int z)
  2611.  
  2612. Returns true if your character can walk in that sqm, false otherwise.
  2613.  
  2614.  
  2615. Item Properties
  2616.  
  2617. ITEM_ACTION - You can use this to check if an item performs an action or not.
  2618. ITEM_BIGSPRITE - You can use this to check if an item has a big sprite or not.
  2619. ITEM_BLOCKPATHS - You can use this to check if an item block paths or not.
  2620. ITEM_BLOCKSHOTS - You can use this to check if an item block shots or not.
  2621. ITEM_BLOCKWALK - You can use this to check if an item block walks or not.
  2622. ITEM_CONTAINER - You can use this to check if an item is a container or not.
  2623. ITEM_CORPSE - You can use this to check if an item is a corpse or not.
  2624. ITEM_DIAGONALBORDER - You can use this to check if an item is a diagonal border or not.
  2625. ITEM_FLOORCHANGE - You can use this to check if an item makes you change the floor or not.
  2626. ITEM_FLUIDCONTAINER - You can use this to check if an item is a fluid container or not.
  2627. ITEM_GROUND - You can use this to check if an item is a ground item or not.
  2628. ITEM_HANGABLE - You can use this to check if an item can be hangged on wall or not.
  2629. ITEM_HEIGHTED - You can use this to check if an item is heighted or not.
  2630. ITEM_HORIZONTAL - You can use this to check if an item is an horizontal wall or not.
  2631. ITEM_LIGHTFONT - You can use this to check if an item is a light font or not.
  2632. ITEM_MINIMAP - You can use this to check if an item has a color in minimap or not.
  2633. ITEM_NOTMOVEABLE - You can use this to check if an item is moveable or not.
  2634. ITEM_NOTROOFEDGE - You can use this to check if an item is a roof edge or not.
  2635. ITEM_OFFSET - I dont know what this property do.
  2636. ITEM_PICKUPABLE - You can use this to check if an item is pickupable or not.
  2637. ITEM_READABLE - You can use this to check if an item is readable or not.
  2638. ITEM_ROTATEABLE - You can use this to check if an item is rotateable or not.
  2639. ITEM_SPLASH - You can use this to check if an item is a fluid splash or not.
  2640. ITEM_STACKABLE - You can use this to check if an item is stackable or not.
  2641. ITEM_TOPORDER1 - You can use this to check if an item is on top order 1 or not.
  2642. ITEM_TOPORDER2 - You can use this to check if an item is on top order 2 or not.
  2643. ITEM_TOPORDER3 - You can use this to check if an item is on top order 3 or not.
  2644. ITEM_USEABLE - You can use this to check if an item is useable with or not.
  2645. ITEM_VERTICAL - You can use this to check if an item is a vertical wall or not.
  2646. ITEM_WRITEABLE - You can use this to check if an item is writeable or not.
  2647.  
  2648. Message Types
  2649.  
  2650. MSG_CHANNEL - Any player message in Game/Help/Real/Tutor/Trade channel.
  2651. MSG_DEFAULT - Any player/npc message in Default channel.
  2652. MSG_INFO - Info messages (green text) in Server Log.
  2653. MSG_NPC - Any NPC answers in NPC channel.
  2654. MSG_PVT - Private messages from other players.
  2655. MSG_RAID - Raid messages.
  2656. MSG_RED - Any red alert message.
  2657. MSG_REPORT - Report description when reporting somthing to a gamemaster (Ctrl + R).
  2658. MSG_SENT - Your sent private messages.
  2659. MSG_STATUS - Status messages (In the screen).
  2660. MSG_STATUSLOG - Status messages in Server Log.
  2661. MSG_TUTOR - Tutor/Senior Tutor saying in Help channel.
  2662. MSG_WELCOME - Game/Channel welcome messages.
  2663. MSG_WHISPER - Any player whispering.
  2664. MSG_YELL - Any player yelling.
  2665.  
  2666. Skull Types
  2667.  
  2668. SKULL_BLACK - Check if player has black skull. Example: if $self.skull == SKULL_BLACK then print('Im black skull') end
  2669. SKULL_GREEN - Check if player has green skull.
  2670. SKULL_ORANGE - Check if player has orange skull.
  2671. SKULL_RED - Check if player has red skull.
  2672. SKULL_WHITE - Check if player has white skull.
  2673. SKULL_YELLOW - Check if player has yellow skull.
  2674.  
  2675. Party Types
  2676.  
  2677. PARTY_EXPSHARE_OK_LEADER - Check if player is leader of a working exp share party. Example: if $target.party == PARTY_EXPSHARE_OK_LEADER then print('yey') end
  2678. PARTY_EXPSHARE_OK_MEMBER - Check if player is a member of a working exp share party.
  2679. PARTY_EXPSHARE_OFF_LEADER - Check if player is leader of a disabled exp share party. If it's disabled it might because there's a low level character on your party or he's in a different floor.
  2680. PARTY_EXPSHARE_OFF_MEMBER - Check if player is a member of a disabled exp share party. If it's disabled it might because there's a low level character on your party or he's in a different floor.
  2681. PARTY_EXPSHARE_WAIT_LEADER - Check if player is leader of a on-standby exp share party.
  2682. PARTY_EXPSHARE_WAIT_MEMBER - Check if player is a member of a on-standby exp share party.
  2683. PARTY_INVITED_LEADER - Check if player is inviting you to a party.
  2684. PARTY_INVITED_MEMBER - Check if player is invited to your party.
  2685. PARTY_NOPARTY - Check if player isn't on your party.
  2686. PARTY_ONPARTY_LEADER - Check if player is the leader of your party.
  2687. PARTY_ONPARTY_MEMBER - Check if player is a member of your party.
  2688.  
  2689. War Banner Types
  2690.  
  2691. WAR_BLUE - Check if player have a blue war banner, means he's in a war you're not in. Example: if $attacked.warbanner == WAR_BLUE then print('attacked player is in a war') end
  2692. WAR_GREEN - Check if player have a green war banner, means he's in a war and he's your ally.
  2693. WAR_RED - Check if player have a red war banner, means he's in a war and he's your enemy.
  2694. WAR_NOWAR - Check if player don't have a war banner.
  2695. Enjoy!
  2696.  
  2697.  
  2698.  
  2699.  
  2700. ---------------------------SCRIPT LIBRARIES Anonymickey's (NOT APPEAR IN MENU)---------------------------
  2701.  
  2702. Anonymickey's Functions
  2703.  
  2704. Well, this is my library. Here you will find some useful functions developed by me, most time savers. Give me suggestions and ideas if you like it.
  2705.  
  2706. General Information Functions
  2707.  
  2708. Functions that gives you some kind of information about tibia.
  2709. int flasks()
  2710.  
  2711. Returns the number of visible small, medium and large empty flasks
  2712.  
  2713. int gold()
  2714.  
  2715. Returns the number of visible gold, including platinum and crystal coins
  2716.  
  2717. int exptolvl(opt number baselevel, number level)
  2718.  
  2719. Returns the amount of exp needed to reach level level from level baselevel. If you don't specify baselevel it will be defaulted to 1.
  2720.  
  2721. bool iscursonin(number sx, number sy, number fx, number fy, opt boolean area)
  2722.  
  2723. Returns true if mouse is inside the area specified by sx, sy, fx, fy, Optionally, you can specify area as true to make fx and fy the side of the rectangle, instead of the other point of it. Example: iscursorin(30, 25, 60, 45) = iscursorin(30, 25, 30, 20, true)
  2724.  
  2725. int sstime(string world)
  2726.  
  2727. Returns the time to the next server save on world world, in seconds. Example: sstime('pacera')
  2728.  
  2729.  
  2730. Scripting Help Functions
  2731.  
  2732. Here are some functions that might help you to write your own scripts. That doesn't mean the other ones might not.
  2733. int cettime()
  2734.  
  2735. Returns current time in CET, in seconds.
  2736.  
  2737. int cetoffset()
  2738.  
  2739. Returns the offset from your current timezone to CET, in seconds.
  2740.  
  2741. dropflasks()
  2742.  
  2743. Simply moves all flask to ground.
  2744.  
  2745. exec(string execstring)
  2746.  
  2747. Executes the code inside the string execstring. Example: local command = 'say("wassup dude")' exec(command)
  2748.  
  2749. str math.format(number n, string pattern)
  2750.  
  2751. Returns a string representation of the number n, matching the specified pattern. Example: math.format(30, "000.0") --> 030.0 math.format(30, "0.00") --> 30.00 math.format(30.25, "0.0") --> 30.25
  2752.  
  2753. moveitemlist(string locationto, string locationfrom, string/number item1, string/number item2, ...)
  2754.  
  2755. Moves all items written in itemlist to locationto. If you specify locationfrom it will get only items from that location. Example: moveitemlist('brocade backpack', 'red backpack', 'cyclops trophy', 'halberd', 'cyclops toe')
  2756.  
  2757. npctalk(string say1, string say2, ...)
  2758.  
  2759. Will make your character say all text parameters given, in NPC channel. If it's not open, it will say the first phrase in default chuannel, and wait until it opens. Example: npctalk('hi', 'deposit all', 'yes', 'balance')
  2760.  
  2761. sethealrule(string rulename, opt string hprange, opt string mprange, opt string method, opt string condition, opt string spam)
  2762.  
  2763. Simply set all settings of a HealRule. If any setting is not specified or empty, this one will not be modified. Examples: sethealrule('HealRule1', '300-900', '0-50%', '', 'if paralyze') sethealrule('HealRule1', '', '', 'health potion', 'paralyzed') sethealrule('HealRule1, '300 to 900', '0 to 15%', '', 'none', '200-400')
  2764.  
  2765. str string.capitalize(string text)
  2766.  
  2767. Returns the string text with first letter in upper case and all others in lower case. Example: string.capitalize('this is A TEST') --> 'This is a test'.
  2768.  
  2769. str string.capitalizeall(string text)
  2770.  
  2771. Returns the string text with the first letter of each word in upper case and all others in lower case. Example: string.capitalizeall('this is A TEST') --> 'This Is A Test'.
  2772.  
  2773. str string.explode(string text, string separator)
  2774.  
  2775. Returns a table with all sub-strings split by separator. Example: string.explode('Hello # My # Name # Is # Anonymickey', '#') --> table = {'Hello', 'My', 'Name', 'Is', 'Anonymickey'}. Credits to Socket and Hardek for this one.
  2776.  
  2777. int table.find2(table, value, arg, notable, argonly)
  2778.  
  2779. Returns the index of value inside table, nil if it can't be found. If you don't specify notable as true it will search inside any table in the main one and return the index inside that secondary table also, as a secondary parameter. Optionally, you can specify arg if your main table is filled with other tables, and the function will look only on this index. You can also set argonly if you don't want to search for values outside secondary tables. Examples: table.find2(t, 'distance') table.find2(t, 'distance', 'type') table.find2(t, 'distance', 'type', false, true) table.find2(t, 'distance', '', true)
  2780.  
  2781. tab table.random(table t, number start, number finish, opt number count, opt number step)
  2782.  
  2783. Returns a table filled with random numbers between start and finish. If count is specified, it's the maximum length of the table, meaning it will return only count random numbers inside the given range. You can also specify step, wich means it will count only multiples. Example: table.random(5, 10) --> {7, 10, 9, 8, 5, 6} table.random(5, 10, 3) --> {7, 10, 9} table.random(5, 10, 0, 2) --> {7, 9, 5}
  2784.  
  2785. str time(number n, opt string pattern)
  2786.  
  2787. Returns a string representation of a second time interval n in the format "dd:hh:mm:ss" depending on lenght. Optionally, you can set the format by specifying pattern parameter. Examples: time(5000) --> 01:23:20 time(5000, 'hh:mm') --> 01:23 time(30) --> 00:30
  2788.  
  2789. str timezone()
  2790.  
  2791. Returns a string with your time zone based on your current location. Example: timezone() --> GMT -2 (If you are from Brazil)
  2792.  
  2793.  
  2794. Character Info Functions
  2795.  
  2796. Functions that can give you information about your character.
  2797. tab bestskill()
  2798.  
  2799. Returns a table with type, skill and skillpc of the your highest skill.
  2800.  
  2801. int levelpc()
  2802.  
  2803. Returns the percent missing for you to advance a level.
  2804.  
  2805. int maxcap()
  2806.  
  2807. Returns the estimated maximun capacity of your character, based on vocation() function.
  2808.  
  2809. int skilltime(string skilltype)
  2810.  
  2811. Returns estimated time to advance in skill skilltype in seconds. skilltype can be: 'magic', 'fist', 'club', 'sword', 'axe', 'distance', 'shielding and 'fishing. Note: It will only start to 'analyze' when you run it for the first time. Example: skilltime('sword')
  2812.  
  2813. int utctime()
  2814.  
  2815. Returns current time in UTC, in seconds.
  2816.  
  2817. int utcoffset()
  2818.  
  2819. Returns the offset from your current timezone to UTC, in seconds.
  2820.  
  2821. str vocation()
  2822.  
  2823. Returns your character vocation. It will try to differ druid from sorcerer checking if it's wearing any rod/wand, if it's not it will return only 'mage'. Also, if it's not possible to determinate your character vocation by any method, it will return 'unknown'.
  2824.  
  2825. tab weaponskill()
  2826.  
  2827. Returns a table with type, skill and skillpc of the your current weapon skill.
  2828.  
  2829.  
  2830. File Handling Functions
  2831.  
  2832. These functions will help you when working with files, reading, writing, anything related to it.
  2833. clearfile(string filename)
  2834.  
  2835. Erases all the content inside file filename. Example: clearfile('test.txt')
  2836.  
  2837. createfile(string filename)
  2838.  
  2839. Creates a file with the name filename, if it doesn't exist. Example: createfile('test.txt')
  2840.  
  2841. execfile(string filename)
  2842.  
  2843. Executes the code inside the file filename. Example: exec('test.txt')
  2844.  
  2845. bool isfileline(string filename, string text)
  2846.  
  2847. If text is a line inside file filename, returns line number, false otherwise. Example: isfileline('test.txt', 'test')
  2848.  
  2849. createfile(string filename)
  2850.  
  2851. Creates a file with the name filename, if it doesn't exist. Example: createfile('test.txt')
  2852.  
  2853. string filecontent(string filename)
  2854.  
  2855. Returns the content of the whole file filename. Example: filecontent('test.txt')
  2856.  
  2857. bool fileexists(string filename)
  2858.  
  2859. Returns true if the file filename exists, false otherwise. Example: fileexists('test.txt')
  2860.  
  2861. str fileline(string filename, number linenum)
  2862.  
  2863. Returns line of number linenum of the file filename. Example: fileline('test.txt', 10)
  2864.  
  2865. int filelinescount(string filename)
  2866.  
  2867. Returns number of lines of file linenum. Returns 0 if it doesn't exists, or if it's empty. Example: filelinescount('test.txt')
  2868.  
  2869. filewrite(string filename, string text)
  2870.  
  2871. Writes text in the file filename. Example: filewrite('test.txt', 'This is my test.')
  2872.  
  2873. filewriteline(string filename, string text)
  2874.  
  2875. Writes text in the file filename. Example: filewriteline('test.txt', 'This is my test.')
  2876.  
  2877. filerewrite(string filename, string text)
  2878.  
  2879. Clears the file filename and writes text in it . Example: filerewrite('test.txt', 'This is my test.')
  2880.  
  2881.  
  2882. Input Functions
  2883.  
  2884. Here are some general functions, I will probably organize it better later.
  2885. hex keyid(string/number key)
  2886.  
  2887. Returns the correspondent hexadecimal code of key key. Useful if you don't want to keep looking at internet lists while using keyevent(..) function. Example: keyevent(keyid('tab')) or keyevent(keyid('a'))
  2888.  
  2889. press(string keys)
  2890.  
  2891. Presses the keys inside the string keys. Special keys MUST be inside [brackets]. Example: press('account[tab]password[enter]')
  2892.  
  2893.  
  2894. HUD Functions
  2895.  
  2896. Functions to help you drawing your HUDs.
  2897. drawline(string dir, number length, opt number x, opt number y)
  2898.  
  2899. Draws a line in your HUD, in the direction dir, with length length in pixels. dir can be 'horizontal' or 'vertical'. You can also specify a start point for the line: c and y. (This function needs improvement) Example: drawline('horizontal', 200, 0, 15)
  2900.  
  2901.  
  2902.