This update brings some significant modifications to the Scripter, allows .xbst settings to include .lua scripts, fixes bugs, adds the new minimap color to the pathfinder logic, and improves a lot of functionality.
With the release of version 3 of XenoBot, I just want to thank everyone who has helped me get it this far in the time that it has. I could not have done it without the support of my customers and I definitely couldn't have done it without my dedicated forum staff. Thanks guys!
EDIT: INFORMATION ON v3.0.0 ISSUES:
1. The following error is caused by using Forgee's library and is NOT bug a with XenoBot. His library accidentally overwrites a critical class within the Scripter. In previous versions, this class was not used often, causing the bug to go unnoticed. Now, however, this class is used extensively so Forgee's library is causing all kinds of issues. I sent Forgee a message about this and haven't had a reply in two days, so if you want this fixed remove Forgee.lua from your scripts. If you're buying scripts from people using Forgee or Sirmate, you may want to let them know you will no longer purchase scripts if they use third-party libraries.
Code:05:54 XenoScript Error:
Script: ?Corym?Config.lua
Line #: 1684
Chunk: C:\Program Files ?x86??XenoBot?Data?XenoLuaLib.lua
Error: attempt to call field 'GetItemIDFromDualInput' (a nil value)
This is an error with user-input and should not be reported as a bug with XenoBot
2. Many functions have been updated to do checks on the environment they are operating in, causing poorly written scripts to break. If you are,as example, using the OpenDoor() function to go down a sewer grate, and wonder why it's not working, it's because your script is bad and you should feel bad. If you paid for scripts like this, consider switching script providers or advise your provider to improve his/her methods.
3. Loading settings closes all running .lua scripts now. Therefore, if you're using loadSettings() in a script, you need to make sure that the settings file you are loading will reload that .lua script if you don't want it to indefinitely die.
ISSUES END
Changelog:
Changes marked with * are thanks to @SyntaxCode:v3.0.0
Fixed the Looter, it wont miss so many bodies now.
Fixed the debug which occurred when one-liners got too long. I also increased the one-liner max length to 500 characters.
Modified the Settings system, it will now work with Lua scripts.
When a setting is saved, it packages all running .lua scripts into the .xbst.
When a setting is loaded, it does the one of following for each .lua script:
1. If the script doesn't exist in your lua directory, it creates and executes it.
2. If the script does exist in your lua directory, and it is the same, it executes it.
3. If the script does exist in your lua directory, but it is different, it asks you if you want to replace or skip.
- Replace will replace the file currently in your lua directory with the one in the .xbst and then execute it.
- Skip will keep the file currently in your lua directory and execute it. You will have to save the .xbst to make it remember this one.
Improved Lua error message handling.
Improved Targeting, it wont be as slow now.
Improved the container opening functions in the Scripter.
Improved many Scripter functions to accept item ID's and names interchangeably:
Container:OpenChildren(...)
Self.UseItemWithMyPosition(idOrName)
Self.UseItemWithMe(idOrName)
Self.UseItemWithTarget(idOrName)
Self.UseItemWithFollow(idOrName)
Self.ItemCount(idOrName, container, countEquipment)
Self.UseLever(x, y, z, idOrName)
Self.DropItem(x, y, z, idOrName, count)
Self.DropItems(x, y, z, ...)
Self.Equip(idOrName, slot, count)
Self.DepositItems(...)
Self.WithdrawItems(slot, ...)
Improved Self.WithdrawItems() to open children in the same window. *
Improved Self.DepositItems() to open children in the same window. *
Improved the Scripter classes to allow static calls. *
Added the new swamp grass minimap color to the Pathfinder, it now recognizes it as blocking.
Added Channel.New() to the Scripter. *
Functionality: Works exactly the same as Channel.Open().
Added Creature.New() to the Scripter. *
Functionality: Returns a creature object, derived from the input.
Parameters:
Input: Either a creature index (number 0-1299), a creature name (string), or a creature ID (number > 1300)
Added Container.New() to the Scripter. *
Functionality: Returns a container object, derived from the input.
Parameters:
Input: Either a container index (number 0-15), a container name (string), or a container ID (number > 99)
Added Self.GetSpectators() to the Scripter. *
Functionality: Returns a table of all creatures on the screen.
Parameters
multiFloor: true to include all floors, false (or blank) to only include current floor.
Added Self.GetTargets() to the Scripter. *
Functionality: Returns a table of all monsters within a range on the screen.
Parameters
distance: distance a creature must be within to be included.
Added Self.isAreaPvPSafe() to the Scripter. *
Functionality: Returns true if it's safe to cast an area spell and false if it could get us a skull.
Parameters
radius: radius to check for players.
multiFloor: true to check all floors, false to only check current floor.
ignoreParty: true to ignore party members in the check, false to include them.
safeList: an optional list of players to ignore in the check.
Added Self.UseDoor() to the Scripter. *
Functionality: Opens or closes a door.
Parameters
x, y, z: door position.
close: true if we are trying to close the door, false (or blank) if we're trying to open it.
Added Item.GetRingActiveID() to the Scripter. *
Functionality: Works exactly the same as getActiveRingID.
Added Container.GetAll() to the Scripter. *
Functionality: Works exactly the same as Container.GetIndexes().
Added the Module class to the Scripter. *
Module.New()
Functionality: registers a function to be executed every x milliseconds
Returns: A module instance.
Parameters:
Name: The name of the module.
Callback: The main function of the module.
Module:Execute()
Functionality: Executes the modules function.
Module:Name()
Functionality: returns the name of the module object.
Module:IsActive()
Functionality: returns if the function is currently running or not.
Module:Delay()
Functionality: delays the modules execution.
Parameters:
Time: amount of miliseconds to wait.
Module:Start()
Functionality: un-pauses the module.
Module:Stop()
Functionality: pauses the module.
[highlight=lua]
--------------------------------------
------- [[ Lua examples: ]] -------
--------------------------------------
-- interchangeable name/ids example --
Self.UseItemWithMe("mana potion") -- same as: Self.UseItemWithMe(268)
Self.Equip("stonecutter axe", "weapon") -- same as: Self.Equip(3319, "weapon")
Self.UseItemWithTarget("sudden death rune") -- same as: Self.UseItemWithTarget(3155)
Self.DropItems(Self.Position().x, Self.Position().y, Self.Position().z, 284, 285, "label")
Self.DepositItems(
17809,
"cheese cutter",
{17818, 0},
{"earflap", 0}
)
Self.WithdrawItems(
0, --into backpack 0
{268, 0, 100},
{"power bolt", 0, 1500},
{"strong mana potion", 0, 300}
)
-- static calls example --
Container.Minimize("blue backpack") -- same as: Container.GetByName("blue backpack"):Minimize()
Container.OpenChildren("blue backpack", 8860, 2871) -- same as: Container.GetByName("blue backpack"):OpenChildren(8860, 2871)
Creature.isTarget('Demon') -- same as: Creature.GetByName('Demon'):isTarget()
-- module example --
function DoFish(module) --our fisher callback
local WATER_FISH = {4597, 4598, 4599, 4600, 4601, 4602}
for x = -7, 7, 1 do
for y = -5, 5, 1 do
local position = Self.Position()
local item = Map.GetTopUseItem(position.x + x, position.y + y, position.z)
if(table.contains(WATER_FISH, item.id))then
Self.UseItemWithGround(3483, position.x + x, position.y + y, position.z)
module:Delay(1000) --delay myself for 1 second
end
end
end
end
local fisher = Module.New('auto-fisher', DoFish) -- create an autofisher module
fisher:Stop() -- stops the fisher
fisher:Start() -- starts the fisher
Module.Stop('auto-fisher') -- also stops the fisher
Module.Start('auto-fisher') -- also starts the fisher[/highlight]
For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19