DarkstaR
05-24-2012, 12:55 AM
This update fixes a few small bugs, re-invents some old functionality and adds many essential Scripter functions. Furthermore, I've made some improvements to some old scripting functions with the help of @Syntax (http://forums.xenobot.net/member.php?u=193).
Changelog:
v2.4.3
Fixed some bugs related to the saving and loading of "Pathfinder" settings.
Fixed "Startup Items" to actually be functional for all XenoBot panels. It now includes all possible panels in its list of options (Startup Items are panels which will automatically be opened upon inject/login).
Fixed "Alarms" to flash the clients button in the windows taskbar
Added the following functionality to the Scripter:
Added a "Channel" class which provides methods for creating and working with console channels. This class has the following functionality:
Channel.Open(name, speakcallback, closecallback)
Returns: A channel class object
Channel:Name()
Channel:ID()
Channel:Close()
Channel:SendOrangeMessage(sender, text)
Channel:SendYellowMessage(sender, text)
Added an "Item" class which provides methods for determining the properties of different items. This class has the following functionality:
Item.GetName(id)
Returns: The name of the item ID provided
Item.GetID(name [,spot])
Returns: The ID of the item name provided
Notes: If multiple ID's share the same name, they can be indexed using the optional spot paremeter
Item.isContainer(id)
Item.isCorpse(id)
Item.isStackable(id)
Item.isUseWithable(id)
Item.isFood(id)
Added new methods to the "Self" class. The functionality as is follows:
Self.ShopGetItemPurchasePrice(item)
Returns:
The cost to purchase the specified item from the current shop window
-1 if the specified item is not sold in the current shop
Notes:
The parameter can either be an item name or item ID
Self.ShopGetItemSaleCount(item)
Returns:
The amount of the specified item it is possible to sell in the shop
0 if the specified item is not sellable in the current shop or if you hold no instances of the specified item
Notes:
The parameter can either be an item name or item ID
Self.DropItem(x, y, z, itemid [, count])
Returns: Nothing
Self.GetSpellCooldown(spell)
Returns: The amount of time (MS) before the spell can be cast
Self.MeetsSpellRequirements(spell)
Returns: True if you have enough level and mana to cast the provided spell, false if otherwise
Self.CanCastSpell(spell)
Returns: (Self.GetSpellCooldown(spell) == 0 and Self.MeetsSpellRequirements(spell))
Added new methods to global scope:
alert()
Plays an alert sound and flashes the Tibia client.
Returns: Nothing
Modified the following Scripter functions:
Container:UseItem() now takes an optional boolean parameter which determines, in the case of the item being a container, if it opens in the same window or not.
Self.Equip() has an optional "count" parameter appended to its argument list.
Self.WithdrawItems() will now withdraw an exact amount of items instead of a rough amount.
The following functions will now natively support transactions of more than 100 items at a time:
Self.ShopSellItem()
Returns:
1, 0 if successful
0, [amountNotSold] if failed
Self.ShopBuyItem()
Returns:
1, 0 if successful
0, [amountNotBought] if failed
Example use of the new Item class along with the cooldown checks and new shop functions:
function yesNo(value)
return (value and "yes" or "no")
end
function displayItemInfo(id)
print("Item %d [%s] is: \n Container: %s\n Corpse: %s\n Stackable: %s\n UseWithable: %s\n Food: %s",
id,
Item.GetName(id),
yesNo(Item.isContainer(id)),
yesNo(Item.isCorpse(id)),
yesNo(Item.isStackable(id)),
yesNo(Item.isUseWithable(id)),
yesNo(Item.isFood(id)))
end
function exhaustSelfThenCheckIfICanCast(spell)
if (Self.CanCastSpell(spell)) then
Self.Say(spell)
wait(1000)
print("%s casted 1000 MS ago. %d MS left on cooldown.", spell, Self.GetSpellCooldown(spell))
elseif (not Self.MeetsSpellRequirements(spell)) then
print("%s can not be cast. You either lack the mana or required level!", spell)
else
print("%s is currently on cooldown for %d MS.", spell, Self.GetSpellCooldown(spell))
end
end
displayItemInfo(Item.GetID("boots of haste"))
exhaustSelfThenCheckIfICanCast("utevo lux")
print("SD's cost %d each and you have %d vials to be sold.", Self.ShopGetItemPurchasePrice("sudden death rune"), Self.ShopGetItemSaleCount(285))
while (true) do
alert()
wait(100)
end
Example use of the new Channel class with a command handler:
function mySpeakCallback(c, message)
c:SendYellowMessage("Input", message)
if (message == "close") then
c:Close()
end
end
function myCloseCallback(c)
print("%s custom channel has been closed.", c:Name())
end
local commander = Channel.Open("Commander", mySpeakCallback, myCloseCallback)
commander:SendOrangeMessage("Commander", "Please say a command")
For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19
Changelog:
v2.4.3
Fixed some bugs related to the saving and loading of "Pathfinder" settings.
Fixed "Startup Items" to actually be functional for all XenoBot panels. It now includes all possible panels in its list of options (Startup Items are panels which will automatically be opened upon inject/login).
Fixed "Alarms" to flash the clients button in the windows taskbar
Added the following functionality to the Scripter:
Added a "Channel" class which provides methods for creating and working with console channels. This class has the following functionality:
Channel.Open(name, speakcallback, closecallback)
Returns: A channel class object
Channel:Name()
Channel:ID()
Channel:Close()
Channel:SendOrangeMessage(sender, text)
Channel:SendYellowMessage(sender, text)
Added an "Item" class which provides methods for determining the properties of different items. This class has the following functionality:
Item.GetName(id)
Returns: The name of the item ID provided
Item.GetID(name [,spot])
Returns: The ID of the item name provided
Notes: If multiple ID's share the same name, they can be indexed using the optional spot paremeter
Item.isContainer(id)
Item.isCorpse(id)
Item.isStackable(id)
Item.isUseWithable(id)
Item.isFood(id)
Added new methods to the "Self" class. The functionality as is follows:
Self.ShopGetItemPurchasePrice(item)
Returns:
The cost to purchase the specified item from the current shop window
-1 if the specified item is not sold in the current shop
Notes:
The parameter can either be an item name or item ID
Self.ShopGetItemSaleCount(item)
Returns:
The amount of the specified item it is possible to sell in the shop
0 if the specified item is not sellable in the current shop or if you hold no instances of the specified item
Notes:
The parameter can either be an item name or item ID
Self.DropItem(x, y, z, itemid [, count])
Returns: Nothing
Self.GetSpellCooldown(spell)
Returns: The amount of time (MS) before the spell can be cast
Self.MeetsSpellRequirements(spell)
Returns: True if you have enough level and mana to cast the provided spell, false if otherwise
Self.CanCastSpell(spell)
Returns: (Self.GetSpellCooldown(spell) == 0 and Self.MeetsSpellRequirements(spell))
Added new methods to global scope:
alert()
Plays an alert sound and flashes the Tibia client.
Returns: Nothing
Modified the following Scripter functions:
Container:UseItem() now takes an optional boolean parameter which determines, in the case of the item being a container, if it opens in the same window or not.
Self.Equip() has an optional "count" parameter appended to its argument list.
Self.WithdrawItems() will now withdraw an exact amount of items instead of a rough amount.
The following functions will now natively support transactions of more than 100 items at a time:
Self.ShopSellItem()
Returns:
1, 0 if successful
0, [amountNotSold] if failed
Self.ShopBuyItem()
Returns:
1, 0 if successful
0, [amountNotBought] if failed
Example use of the new Item class along with the cooldown checks and new shop functions:
function yesNo(value)
return (value and "yes" or "no")
end
function displayItemInfo(id)
print("Item %d [%s] is: \n Container: %s\n Corpse: %s\n Stackable: %s\n UseWithable: %s\n Food: %s",
id,
Item.GetName(id),
yesNo(Item.isContainer(id)),
yesNo(Item.isCorpse(id)),
yesNo(Item.isStackable(id)),
yesNo(Item.isUseWithable(id)),
yesNo(Item.isFood(id)))
end
function exhaustSelfThenCheckIfICanCast(spell)
if (Self.CanCastSpell(spell)) then
Self.Say(spell)
wait(1000)
print("%s casted 1000 MS ago. %d MS left on cooldown.", spell, Self.GetSpellCooldown(spell))
elseif (not Self.MeetsSpellRequirements(spell)) then
print("%s can not be cast. You either lack the mana or required level!", spell)
else
print("%s is currently on cooldown for %d MS.", spell, Self.GetSpellCooldown(spell))
end
end
displayItemInfo(Item.GetID("boots of haste"))
exhaustSelfThenCheckIfICanCast("utevo lux")
print("SD's cost %d each and you have %d vials to be sold.", Self.ShopGetItemPurchasePrice("sudden death rune"), Self.ShopGetItemSaleCount(285))
while (true) do
alert()
wait(100)
end
Example use of the new Channel class with a command handler:
function mySpeakCallback(c, message)
c:SendYellowMessage("Input", message)
if (message == "close") then
c:Close()
end
end
function myCloseCallback(c)
print("%s custom channel has been closed.", c:Name())
end
local commander = Channel.Open("Commander", mySpeakCallback, myCloseCallback)
commander:SendOrangeMessage("Commander", "Please say a command")
For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19