DarkstaR
01-08-2012, 05:12 PM
This update brings the long awaited LUA scripter. Though it is far from done, it does have the core functionality and is capable of some powerful stuff. Any functions require attacking, working with items or reading the map are currently impossible. You can, however, make gold depositors, mana trainers, friend healers, and more. Below the changelog you will find some examples.
Changelog:
v2.1.0
Added the LUA Scripter. The scripter, currently, has many limitations but consecutive updates will continue to add more functionality
Fixed a bug which caused the looter to not open new backpacks if the items being looted to them aren't stackable
Fixed a few bugs with Anti-Idle. It will now dance in random directions a random amount of multiple times at random intervals. The dancing will be visible to anyone who can see you
Fixed a bug which caused the client to debug when right-clicking within the VIP list
How to use scripts:
Place the script in the "My Documents/XenoBot/Scripter" folder. Open the "Scripter" window and execute the desired script. Errors will show in red in the Server Log channel and automatically kill the script which triggered them
Creature Class Example: Traversing the list of visible, living creatures.
--This will list every creature that is visible, alive, and on the same floor.
local names = "Creatures found: "
for index = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(index)
if (creature:isValid()) then
if (creature:isOnScreen() and creature:isVisible() and creature:isAlive()) then
names = names .. creature:Name() .. ", "
end
end
end
displayInformationMessage(names)
Creature Class Example: Displaying detailed information about a followed creature.
--this is a demonstration on how to use the Creature class. It will display information about the creature you are following
local creature = Creature.GetByID(Self.FollowID())
if (creature:isValid()) then
local message = "\n"
message = message .. "Name: " .. creature:Name() .. "\n"
message = message .. "LookDir: " .. creature:LookDirection() .. "\n"
message = message .. "Speed: " .. creature:Speed() .. "\n"
message = message .. "Outfit: " .. table.serialize(creature:Outfit()) .. "\n"
message = message .. "Health Percent: " .. creature:HealthPercent() .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Is Self: " .. tostring(creature:isSelf()) .. "\n"
message = message .. "Is Target: " .. tostring(creature:isTarget()) .. "\n"
message = message .. "Is Followed: " .. tostring(creature:isFollowed()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Skull Type: " .. creature:Skull() .. "\n"
message = message .. "Party Status: " .. creature:PartyStatus() .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "White Skull: " .. tostring(creature:isWhiteSkull()) .. "\n"
message = message .. "Red Skull: " .. tostring(creature:isRedSkull()) .. "\n"
message = message .. "Orange Skull: " .. tostring(creature:isOrangeSkull()) .. "\n"
message = message .. "Black Skull: " .. tostring(creature:isBlackSkull()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Is Party Leader: " .. tostring(creature:isPartyLeader()) .. "\n"
message = message .. "Is Party Member: " .. tostring(creature:isPartyMember()) .. "\n"
message = message .. "Is Party Invited: " .. tostring(creature:isInvitedToParty()) .. "\n"
message = message .. "Is Party Inviting: " .. tostring(creature:isInvitingToParty()) .. "\n"
message = message .. "Is Sharing Exp: " .. tostring(creature:isSharingExp()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "War Icon: " .. creature:WarIcon() .. "\n"
message = message .. "Is War Enemy: " .. tostring(creature:isWarEnemy()) .. "\n"
message = message .. "Is War Ally: " .. tostring(creature:isWarAlly()) .. "\n"
message = message .. "Is In War: " .. tostring(creature:isInWar()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Location: " .. table.serialize(creature:Position()) .. "\n"
message = message .. "Is Reachable: " .. tostring(creature:isReachable()) .. "\n"
message = message .. "Is Adjacent: " .. tostring(creature:isAdjacent()) .. "\n"
message = message .. "Is On Screen: " .. tostring(creature:isOnScreen()) .. "\n"
message = message .. "Is Alive: " .. tostring(creature:isAlive()) .. "\n"
message = message .. "Is Visible: " .. tostring(creature:isVisible()) .. "\n"
message = message .. "Distance From Self: " .. creatureistanceFromSelf() .. "\n"
displayInformationMessage(message)
else
displayInformationMessage("Please kill this script, follow a creature, and re-execute.")
end
Self Class Example: Speaking and obtaining information.
Self.Say("Hello world!")
sleep(math.random(700, 1400)) --Sleep between everything we say. saying everything very quickly can be _highly_ suspicious
Self.Yell("Hello world!")
sleep(math.random(700, 1400))
Self.Whisper("Hello world!")
sleep(math.random(700, 1400))
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
displayInformationMessage("Hey bro, my mana is " .. Self.Mana() .. "/" .. Self.MaxMana() .. "!")
displayInformationMessage("My health? It's " .. Self.Health() .. "/" .. Self.MaxHealth() .. "!")
displayInformationMessage("Impressive, since I'm only level " .. Self.Level() .. " with " .. Self.Experience() .. " exp!")
-- Other member data functions
-- Self.ID()
-- Self.TargetID()
-- Self.FollowID()
-- Self.Position()
-- Self.LookDirection()
-- Self.Speed()
-- Self.Outfit()
-- Self.Skull()
-- Self.PartyStatus()
-- Self.WarIcon()
-- Self.Cap()
Self Class Example: Waiting until a certain amount of mana then randomly spamming spells until a lower threshold is met.
--Change the locals in the loop.
function TrainMana(range, spell, drainTo)
if (Self.Mana() >= range) then
if (math.random(1, 8) == 5) then
while (Self.Mana() > drainTo) do
Self.Say(spell)
sleep(math.random(200,600))
end
return 1000
else
return math.random(800, 1700)
end
end
return 300
end
while (true) do
local spell = "exura ico"
local castAt = Self.MaxMana() - 40
local castTo = Self.MaxMana() - 200
sleep(TrainMana(castAt, spell, castTo))
end
Event Handler Example: Handling the WALKER_SELECTLABEL event in order to deposit gold with your waypoints.
--To plug this into any script, set the cap limit and structure your waypoints like so:
--KeepHunting:
--walk
--through
--cave
--CheckCap:
--DepositGold:
--walk
--to
--bank
--AtBank:
--ReturnToHunt:
--walk
--back
--to
--hunt
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "CheckCap") then
if (Self.Cap() < 720) then
gotoLabel("DepositGold")
else
gotoLabel("KeepHunting")
end
elseif (labelName == "AtBank") then
delayWalker(3000) --Call this immediately, before evr sleeping. Walker and scripter are in different threads so if we sleep before calling this walker will proceed a few wp's before this bites
Self.Say("Hi")
sleep(math.random(700, 1400)) --Sleep between everything we say. saying everything very quickly can be _highly_ suspicious
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
Self.SayToNpc("Yes")
gotoLabel("ReturnToHunt")
end
end
For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19
Changelog:
v2.1.0
Added the LUA Scripter. The scripter, currently, has many limitations but consecutive updates will continue to add more functionality
Fixed a bug which caused the looter to not open new backpacks if the items being looted to them aren't stackable
Fixed a few bugs with Anti-Idle. It will now dance in random directions a random amount of multiple times at random intervals. The dancing will be visible to anyone who can see you
Fixed a bug which caused the client to debug when right-clicking within the VIP list
How to use scripts:
Place the script in the "My Documents/XenoBot/Scripter" folder. Open the "Scripter" window and execute the desired script. Errors will show in red in the Server Log channel and automatically kill the script which triggered them
Creature Class Example: Traversing the list of visible, living creatures.
--This will list every creature that is visible, alive, and on the same floor.
local names = "Creatures found: "
for index = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(index)
if (creature:isValid()) then
if (creature:isOnScreen() and creature:isVisible() and creature:isAlive()) then
names = names .. creature:Name() .. ", "
end
end
end
displayInformationMessage(names)
Creature Class Example: Displaying detailed information about a followed creature.
--this is a demonstration on how to use the Creature class. It will display information about the creature you are following
local creature = Creature.GetByID(Self.FollowID())
if (creature:isValid()) then
local message = "\n"
message = message .. "Name: " .. creature:Name() .. "\n"
message = message .. "LookDir: " .. creature:LookDirection() .. "\n"
message = message .. "Speed: " .. creature:Speed() .. "\n"
message = message .. "Outfit: " .. table.serialize(creature:Outfit()) .. "\n"
message = message .. "Health Percent: " .. creature:HealthPercent() .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Is Self: " .. tostring(creature:isSelf()) .. "\n"
message = message .. "Is Target: " .. tostring(creature:isTarget()) .. "\n"
message = message .. "Is Followed: " .. tostring(creature:isFollowed()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Skull Type: " .. creature:Skull() .. "\n"
message = message .. "Party Status: " .. creature:PartyStatus() .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "White Skull: " .. tostring(creature:isWhiteSkull()) .. "\n"
message = message .. "Red Skull: " .. tostring(creature:isRedSkull()) .. "\n"
message = message .. "Orange Skull: " .. tostring(creature:isOrangeSkull()) .. "\n"
message = message .. "Black Skull: " .. tostring(creature:isBlackSkull()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Is Party Leader: " .. tostring(creature:isPartyLeader()) .. "\n"
message = message .. "Is Party Member: " .. tostring(creature:isPartyMember()) .. "\n"
message = message .. "Is Party Invited: " .. tostring(creature:isInvitedToParty()) .. "\n"
message = message .. "Is Party Inviting: " .. tostring(creature:isInvitingToParty()) .. "\n"
message = message .. "Is Sharing Exp: " .. tostring(creature:isSharingExp()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "War Icon: " .. creature:WarIcon() .. "\n"
message = message .. "Is War Enemy: " .. tostring(creature:isWarEnemy()) .. "\n"
message = message .. "Is War Ally: " .. tostring(creature:isWarAlly()) .. "\n"
message = message .. "Is In War: " .. tostring(creature:isInWar()) .. "\n"
displayInformationMessage(message)
message = "\n"
message = message .. "Location: " .. table.serialize(creature:Position()) .. "\n"
message = message .. "Is Reachable: " .. tostring(creature:isReachable()) .. "\n"
message = message .. "Is Adjacent: " .. tostring(creature:isAdjacent()) .. "\n"
message = message .. "Is On Screen: " .. tostring(creature:isOnScreen()) .. "\n"
message = message .. "Is Alive: " .. tostring(creature:isAlive()) .. "\n"
message = message .. "Is Visible: " .. tostring(creature:isVisible()) .. "\n"
message = message .. "Distance From Self: " .. creatureistanceFromSelf() .. "\n"
displayInformationMessage(message)
else
displayInformationMessage("Please kill this script, follow a creature, and re-execute.")
end
Self Class Example: Speaking and obtaining information.
Self.Say("Hello world!")
sleep(math.random(700, 1400)) --Sleep between everything we say. saying everything very quickly can be _highly_ suspicious
Self.Yell("Hello world!")
sleep(math.random(700, 1400))
Self.Whisper("Hello world!")
sleep(math.random(700, 1400))
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
displayInformationMessage("Hey bro, my mana is " .. Self.Mana() .. "/" .. Self.MaxMana() .. "!")
displayInformationMessage("My health? It's " .. Self.Health() .. "/" .. Self.MaxHealth() .. "!")
displayInformationMessage("Impressive, since I'm only level " .. Self.Level() .. " with " .. Self.Experience() .. " exp!")
-- Other member data functions
-- Self.ID()
-- Self.TargetID()
-- Self.FollowID()
-- Self.Position()
-- Self.LookDirection()
-- Self.Speed()
-- Self.Outfit()
-- Self.Skull()
-- Self.PartyStatus()
-- Self.WarIcon()
-- Self.Cap()
Self Class Example: Waiting until a certain amount of mana then randomly spamming spells until a lower threshold is met.
--Change the locals in the loop.
function TrainMana(range, spell, drainTo)
if (Self.Mana() >= range) then
if (math.random(1, 8) == 5) then
while (Self.Mana() > drainTo) do
Self.Say(spell)
sleep(math.random(200,600))
end
return 1000
else
return math.random(800, 1700)
end
end
return 300
end
while (true) do
local spell = "exura ico"
local castAt = Self.MaxMana() - 40
local castTo = Self.MaxMana() - 200
sleep(TrainMana(castAt, spell, castTo))
end
Event Handler Example: Handling the WALKER_SELECTLABEL event in order to deposit gold with your waypoints.
--To plug this into any script, set the cap limit and structure your waypoints like so:
--KeepHunting:
--walk
--through
--cave
--CheckCap:
--DepositGold:
--walk
--to
--bank
--AtBank:
--ReturnToHunt:
--walk
--back
--to
--hunt
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "CheckCap") then
if (Self.Cap() < 720) then
gotoLabel("DepositGold")
else
gotoLabel("KeepHunting")
end
elseif (labelName == "AtBank") then
delayWalker(3000) --Call this immediately, before evr sleeping. Walker and scripter are in different threads so if we sleep before calling this walker will proceed a few wp's before this bites
Self.Say("Hi")
sleep(math.random(700, 1400)) --Sleep between everything we say. saying everything very quickly can be _highly_ suspicious
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
Self.SayToNpc("Yes")
gotoLabel("ReturnToHunt")
end
end
For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19