PDA

View Full Version : [Update] XenoBot v3.3.4 [BrowseField and EffectMessageProxy]



DarkstaR
08-25-2013, 03:51 PM
This update not only fixes a bug, but it also adds the BrowseField and EffectMessageProxy features needed to make effective dice scripts. Furthermore, it brings some huge new ways to succinctly, yet powerfully, interface with the Creature and Container classes.

Changelog:

v3.3.4
Fixed a bug in the Scripter which caused Self.GetSpectators() to ignore the first creature in the list.
Added the following Scripter functions to the Self class:
Added tostring(), ==, and .. operators for the Creature class in the Scripter.
tostring() returns name
== compares by ID
.. concatenates names
Added EffectMessageProxy class to the Scripter.
Works like all other proxies. See below for code examples.
Added Self.PrivateMessage() to the Scripter.
Notes: Sends a private message to a player.
Parameters
player: the person to message
message: the message to send
Returns: 1 if success 0 if fail
Usage: Self.PrivateMessage(player, message)
Added Self.BrowseField() to the Scripter.
Notes: Opens the Browse Field window on a tile.
Parameters
x, y, z: the position of the tile to browse
Returns: 1 if success 0 if fail
Usage: Self.BrowseField(x, y, z)
Added meta __call constructors to the following Scripter classes:
Creature, Container, Module, Signal, All Proxies
Examples
Creature("DarkstaR") is the same as Creature.New("DarkstaR")
Container("Orange Backpack") is the same as Container.New("Orange Backpack")
Added Creature iterators to the Scripter.
See below for code examples.
Current iterators:
Creature.iPlayers([range, sort])
Creature.iMonsters([range, sort])
Creature.iNpcs([range, sort])
Creature.iAllies([range, sort])
Creature.iEnemies([range, sort])
Creature.iPartyMembers([range, sort])
Creature.iCreatures([range, sort])
Added Container iterators to the Scripter.
See below for code examples.
Current iterators:
Container.iContainers()
iterates through containers
Container:iItems()
iterates through items in a container

New Scripting Examples

EffectMessageProxy Example
EffectMessageProxy.OnReceive("GET EFFECTS", function(proxy, message, x, y, z)
--will get red messages from dice, food eating, potion drinking, etc...
end)


Container class iterator example
for index, container in Container.iContainers() do
print(tostring(index) .. ": " .. container:Name())

for spot, item in container:iItems() do
print("-----" .. tostring(spot) .. ": " .. table.serialize(item))
end
end


Simple Creature class iterator examples
print("------------ PLAYERS ------------")
for name, creature in Creature.iPlayers() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ MONSTERS ------------")
for name, creature in Creature.iMonsters() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ NPCS ------------")
for name, creature in Creature.iNpcs() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ ALLIES ------------")
for name, creature in Creature.iAllies() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ ENEMIES ------------")
for name, creature in Creature.iEnemies() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ PARTY MEMBERS ------------")
for name, creature in Creature.iPartyMembers() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ ALL ------------")
for name, creature in Creature.iCreatures() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end


Advanced Creature class iterator Examples
print("------------ MONSTERS in RANGE 5 sort by HEALTH ------------")
local sort = function(a, b) return a:HealthPercent() > b:HealthPercent() end
for name, creature in Creature.iMonsters(5, sort) do
print(name .. ": " .. creature:HealthPercent() .. "%")
end

print("------------ PLAYERS in ANY RANGE sort by NAME ------------")
local sort = function(a, b) return a:Name() < b:Name() end
for name, creature in Creature.iPlayers(nil, sort) do
print(name .. ": " .. creature:HealthPercent() .. "%")
end

print("------------ ENEMIES in RANGE 1 ------------")
for name, creature in Creature.iEnemies(1) do
print(name .. ": " .. creature:HealthPercent() .. "%")
end


Practical Creature class iterator Examples
-- PRACTICAL EXAMPLES: ALLY HEALER --
local sort = function(a, b) return a:HealthPercent() < b:HealthPercent() end
local name, creature = Creature.iAllies(10, sort)() --gets the first ally returned; e.g. lowest hp
if (creature and creature:HealthPercent() < 60) then
Self.Say("exura sio \"" .. name)
end


-- PRACTICAL EXAMPLES: TARGETING --
local sort = function(a, b) --SORT by DISTANCE then by HEALTH then by ID
local adist = a:DistanceFromSelf()
local bdist = b:DistanceFromSelf()
if (adist == bdist) then
local ahealth = a:HealthPercent()
local bhealth = b:HealthPercent()
if (ahealth == bhealth) then
return a:ID() < b:ID()
else
return ahealth < bhealth
end
else
return adist < bdist
end
end
local name, creature = Creature.iMonsters(nil, sort)() --gets the first creature returned; e.g. best target
if (creature and not creature:isTarget()) then
creature:Attack()
end

For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19

Stusse
08-25-2013, 03:53 PM
sWEET!

Good job :)

/STusse

thorekz
08-25-2013, 03:55 PM
cool thanks

Stusse
08-25-2013, 03:57 PM
Do you have intentions of adding these targeting options to the Bot itself as well?

/Stusse

DarkstaR
08-25-2013, 03:59 PM
Do you have intentions of adding these targeting options to the Bot itself as well?

/Stusse

dafuq r u sayin bro

Bovah
08-25-2013, 03:59 PM
YESSS!!!!!! Thanks :D

Xeromex
08-25-2013, 04:03 PM
So, who got the honour to make a anti-loot steal script?
Darkstar, amazing update!! Thanks

Stusse
08-25-2013, 04:03 PM
Haha nvm didnt read it through fully :p


/Stusse

Stusse
08-25-2013, 04:06 PM
So, who got the honour to make a anti-loot steal script?
Darkstar, amazing update!! Thanks
Would be quite cool if we were able to loot via Browse Field in the bot itself.. :P

Not sure how accurate it would be with the correct monster corpse id and shit but would be cool at least :D

Xeromex
08-25-2013, 04:12 PM
Would be quite cool if we were able to loot via Browse Field in the bot itself.. :P

Not sure how accurate it would be with the correct monster corpse id and shit but would be cool at least :D

Looting by just right clicking is more efficient. Making that script is going to be pretty hard I think, best way could be by lootmessage proxy I thinkż

kubax36
08-25-2013, 04:16 PM
Container:iItems()
iterates through items in a container
does it mean i can make now unrust script? If yes how to use it? :D

Nakuu
08-25-2013, 04:17 PM
Cheers

Maximum Adam
08-25-2013, 05:25 PM
Cool :)
Still waiting for a NpcMessageProxy :D

Mish
08-25-2013, 05:29 PM
Cool :)
Still waiting for a NpcMessageProxy :D

Definitely needed!

killjoy
08-25-2013, 05:54 PM
nice thanks

alpha90
08-25-2013, 09:28 PM
Thank you :D!!

Daemon
08-25-2013, 09:39 PM
That was a fast update DarkstaR ~ It did not take you long at all to implement the browse field function keep it up :). Once again better bot better programmer better experience and its cheaper..... Ibot users are getting scammed.

jayjay23
08-25-2013, 10:46 PM
That was a fast update DarkstaR ~ It did not take you long at all to implement the browse field function keep it up :). Once again better bot better programmer better experience and its cheaper..... Ibot users are getting scammed.

+1 br0

exxd
08-25-2013, 11:12 PM
wish all updates were compat. atleast as far back to tibia 9.8..... for paying customers who only play OTs, we are limited :\

DarkstaR
08-25-2013, 11:33 PM
wish all updates were compat. atleast as far back to tibia 9.8..... for paying customers who only play OTs, we are limited :\

I wish it was easy to do so, but when Tibia makes massive changes to the structure of the client it becomes challenging. I try to keep functionality as far back as possible but it does become a war between compatibility or fast updates. I'm constantly updating the bot to be better at scaling as well. I hope that makes sense.

Linty
08-26-2013, 02:37 PM
Is the container iterator a convenience thing? Does it add functionality that was not possible before?

DarkstaR
08-26-2013, 02:43 PM
Is the container iterator a convenience thing? Does it add functionality that was not possible before?

Almost everything here, with the exception of the two mentions in the thread title and the one bug fix, is convenience. It's all done in Lua in the library and was all possible before, just in much uglier or more complex ways. It's an attempt to make scripts a bit easier to write for people who aren't as advanced.

Eion
08-26-2013, 03:01 PM
Well these class iterators make a lot of things more simple for sure. It also makes the scripting a bit cleaner. Although, I'm not sure if I would call this the "easier" method. That would seem to be an opinion. One that is very dependent on the type of script you are writing.

sirmate
08-26-2013, 05:21 PM
Nice to see progress here. Good work DarkstaR.

RoxZin xD
08-26-2013, 09:27 PM
That makes things smoother. Nice update!

Mish
08-30-2013, 08:16 AM
New update needed! Just saying it incase you didn't notice it =) DarkstaR

Lasermannen
08-30-2013, 08:39 AM
FUCK THESE PATCHES

Xparn
08-30-2013, 08:42 AM
lol one more update, damn.

Orming
08-30-2013, 08:46 AM
what was this update for even?

Ryszard
08-30-2013, 08:49 AM
FUCK THESE PATCHES

+1, they r updating tibia all the time without any sucess

Lasermannen
08-30-2013, 08:50 AM
the lagg seems to be gone lol.

Xparn
08-30-2013, 09:06 AM
the lagg seems to be gone lol.

Hopefully that's true. But i hope as well the update for xeno come as fast as the last time!


ADD; I can't even log on.

Lasermannen
08-30-2013, 09:13 AM
Hopefully that's true. But i hope as well the update for xeno come as fast as the last time!


ADD; I can't even log on.
It takes some time to log in but when in no lags atleast for me, had alot of lag before ss.

Rysox
08-30-2013, 09:17 AM
I'm still lagging.

Xparn
08-30-2013, 09:26 AM
It takes some time to log in but when in no lags atleast for me, had alot of lag before ss.
Ah yeah connected, seems to be working now. Hopefully it will stay as this (no kicks/laggs)

Rysox
08-30-2013, 09:29 AM
NICK PLEZ

serious
08-30-2013, 09:48 AM
I had the same problem with logging on after SS, you have to reinstall tibia according to the website. I did and it fixed my problem! hope that helps

Xparn
08-30-2013, 10:14 AM
I had the same problem with logging on after SS, you have to reinstall tibia according to the website. I did and it fixed my problem! hope that helps
You don't have to re-install you can just install the new client and log on with that, and yeah that helped.

banhxeo
08-30-2013, 10:46 AM
No laggs for me, been online for over 1h

Gordo
08-30-2013, 10:51 AM
is anyone else having problems updating the client? i try to update it by logging in and it downloads but then says it cannot connect to server, i tried downloading it straight from the site but no luck so far

PS. theres a rumor going around that somehow hackers are getting your password when you log in

Hater
08-30-2013, 10:54 AM
is anyone else having problems updating the client? i try to update it by logging in and it downloads but then says it cannot connect to server, i tried downloading it straight from the site but no luck so far

PS. theres a rumor going around that somehow hackers are getting your password when you log in

download it via the website, when you update it via the client you have to run it as admin.


and that hacker shit is bull


p.s. server has still some probs, so logging in can bring troubles

Annox
08-30-2013, 12:23 PM
I'm still lagging. Yet another pointless update ffs. Unlucky Nick! lol

tortose
08-30-2013, 03:25 PM
I've downloaded new client for both tibia an bot. Some reason it will not bring up the tibia client. Am I the only person that is having this problem?

popit
08-30-2013, 03:29 PM
I've downloaded new client for both tibia an bot. Some reason it will not bring up the tibia client. Am I the only person that is having this problem?

there was an update on tibia got to wait for a new version of xenobot ;)

ozkl
08-30-2013, 03:29 PM
I've downloaded new client for both tibia an bot. Some reason it will not bring up the tibia client. Am I the only person that is having this problem?
Because Tibia patched today, XenoBot hasn't been updated yet. Stay patient.

tortose
08-30-2013, 03:38 PM
Got yeah, thank you for clearing that up for me.

Presunto
08-30-2013, 04:24 PM
Too bad darkstar didn't started it early, it is a quite simple update as far as I know