View Full Version : [Reference] Xenobot Lua Documentation
Ropiderz
07-28-2013, 04:34 PM
Xenobot Lua Documentation
Documentation is hosted at wikia site.
http://xenobot.wikia.com/wiki/Documentation
Summary
SELF CLASS (http://xenobot.wikia.com/wiki/Self)
ITEM CLASS (http://xenobot.wikia.com/wiki/Item)
CONTAINER CLASS (http://xenobot.wikia.com/wiki/Container)
CREATURE CLASS (http://xenobot.wikia.com/wiki/Creature)
CLIENT CLASS (http://xenobot.wikia.com/wiki/Client)
CAVEBOT CLASS (http://xenobot.wikia.com/wiki/Cavebot)
LOOTER CLASS (http://xenobot.wikia.com/wiki/Looter)
TARGETING CLASS (http://xenobot.wikia.com/wiki/Targeting)
WALKER CLASS (http://xenobot.wikia.com/wiki/Walker)
CHANNEL CLASS (http://xenobot.wikia.com/wiki/Channel)
MAP CLASS (http://xenobot.wikia.com/wiki/Map)
MODULE CLASS (http://xenobot.wikia.com/wiki/Module)
SIGNAL CLASS (http://xenobot.wikia.com/wiki/Signal)
PROXY CLASS (http://xenobot.wikia.com/wiki/Proxy)
HEAD UP DISPLAY CLASS (http://xenobot.wikia.com/wiki/HUD)
GLOBAL CLASS (http://xenobot.wikia.com/wiki/Global)
Ropiderz
07-28-2013, 04:34 PM
-----
Ropiderz
07-28-2013, 04:34 PM
-----
Ropiderz
07-28-2013, 04:34 PM
-----
Ropiderz
07-28-2013, 04:35 PM
-----
Ropiderz
07-28-2013, 04:35 PM
-----
Ropiderz
07-28-2013, 04:35 PM
-----
Ropiderz
07-28-2013, 04:36 PM
-----
Ropiderz
07-28-2013, 04:36 PM
-----
Ropiderz
07-28-2013, 04:37 PM
-----
Ropiderz
07-28-2013, 04:40 PM
-----
Ropiderz
07-28-2013, 04:40 PM
-----
danonix
07-28-2013, 05:12 PM
Well, good job
Stusse
07-28-2013, 05:42 PM
Every function is explained in the default XenoBot lua library file so this thread is not needed.
I was also working on it a while ago but then Syntax came up with the file documentation.
Not everyone is even able to find the library. Honestly I think this is great for the community that wants to see what functions are available.
/Stusse
Ropiderz
07-28-2013, 05:48 PM
Every function is explained in the default XenoBot lua library file so this thread is not needed.
I was also working on it a while ago but then Syntax came up with the file documentation.
Not every function is explained. In the other thread we were discussing about this documentation, Syntax and Spectrus approved this idea, but now seems that someone have deleted that thread.
DarkstaR
It's done. Some functions weren't added like "libOnLocalSpeech", "libDestroyTimer" and similar. Let me know if this is helpful and if it should be edited.
Syntax
07-29-2013, 05:38 AM
Fine with me as long as it's updated. PM me a copy of the lua parser I sent if you modified it, please. Thread stuck.
Bushu
07-29-2013, 08:30 AM
Self.ShopBuyItem(item, amount)
Buy the amount of items you want.
parameter item The item name or ID you want to buy.
parameter amount The amount of items you want to buy.
returns integer, integer
I might be wrong, but this one isn't working without Forgee's library.
Correct me if I'm wrong.
Ropiderz
07-29-2013, 11:31 AM
Fine with me as long as it's updated. PM me a copy of the lua parser I sent if you modified it, please. Thread stuck.
Ok
I might be wrong, but this one isn't working without Forgee's library.
Correct me if I'm wrong.
All info was taken from the XenoLuaLib.lua, DarkstaR posted a while ago a list of issues with Forgee's lib, including this one you mentioned, but now it's part of native library.
Bushu
07-29-2013, 06:37 PM
All info was taken from the XenoLuaLib.lua, DarkstaR posted a while ago a list of issues with Forgee's lib, including this one you mentioned, but now it's part of native library.
Good to know (:
Self.WithdrawItems(items array)
how can i specify the itemid, amount, bp where its at, bp to withdraw?
Ropiderz
08-04-2013, 03:53 PM
Self.WithdrawItems(items array)
how can i specify the itemid, amount, bp where its at, bp to withdraw?
The entry must be a table. Example:
Self.WithdrawItems(FIRST_BACKPACK, {ITEM1, BACKPACK_INDEX, AMOUNT}, {ITEM2, BACKPACK_INDEX, AMOUNT}...)
The FIRST_BACKPACK is where to start searching for your items (optional), then you start the array:
{3031, 2} -- gold coin to the backpack index 2
{3031, 2, 50} -- move 50 coins instead of all
Hey man, great work. The majority of the community needs this.
Ropiderz
08-26-2013, 02:25 PM
Updated functions for the version 3.3.4
Added:
Container.iContainers()
Container:iItems()
Creature.iCreatures()
Creature.iAllies()
Creature.iEnemies()
Creature.iPartyMembers()
Creature.iNpcs()
Creature.iPlayers()
Creature.iMonsters()
Self.BrowseField(x, y, z)
Self.PrivateMessage(player, message)
Changed:
Existing classes that now can be called with the meta function __call, they are now cited as an Alternate Invocation for Class.New()
As the Proxy functions doesn't return the same thing, I've added something on each example block so you know what they are returning.
Also I couldn't explain all the Creatures iterations because there's no enough space to add more functions on that post, so I've explained Creatures.iCreatures() and the others are cited on the same block.
Golocky
09-04-2013, 05:46 AM
Where do I download this XenoLuaLib.lua?
Golocky
09-04-2013, 05:48 AM
Where do I download this XenoLuaLib.lua?
forget it I already found it in your signature
Ropiderz
09-04-2013, 07:05 PM
forget it I already found it in your signature
That's my personal library, you don't need to download XenoLuaLib, it's already included on Xeno when you download it.
HolmaN
09-06-2013, 04:26 PM
Fuck me.. You deserve a medal.
robin
09-12-2013, 09:18 PM
It seems that the Self.UseBed function doesn't work properly. It gets stuck at the 'Choose a Skill' window :(
PromB
09-12-2013, 10:00 PM
It seems that the Self.UseBed function doesn't work properly. It gets stuck at the 'Choose a Skill' window :(
Copy and paste your function
Noceur
09-15-2013, 03:21 AM
I love you, this is a lot more handy to me than the file that comes with xenobot. :)
Ropiderz
09-16-2013, 09:25 PM
Syntax
I think I'll move it to wikia, so I can separate each function per page and add examples of usage, because it's hard to keep 15k characters on each post, otherwise in each update I'll need to delete others posts to keep the order. What do you think ?
example:
http://xenobot.wikia.com/wiki/Documentation
Syntax
I think I'll move it to wikia, so I can separate each function per page and add examples of usage, because it's hard to keep 15k characters on each post, otherwise in each update I'll need to delete others posts to keep the order. What do you think ?
example:
http://xenobot.wikia.com/wiki/Documentation
I think it sounds great :D
Syntax
09-16-2013, 10:43 PM
Syntax
I think I'll move it to wikia, so I can separate each function per page and add examples of usage, because it's hard to keep 15k characters on each post, otherwise in each update I'll need to delete others posts to keep the order. What do you think ?
example:
http://xenobot.wikia.com/wiki/Documentation
Fine by me.
RoxZin xD
09-16-2013, 11:10 PM
Or maybe an increase in the maximum characters per post? But wikia looks sexy too :eek:
Ropiderz
09-17-2013, 12:22 AM
Well, I'm sticking it into wikia, to see documentation see this link: http://xenobot.wikia.com/wiki/Documentation
robin
09-19-2013, 05:43 PM
Copy and paste your function
Self.UseBed(32655, 31892, 2, TRAINING_SWORD)
So basically everything is done in the same way as in the example provided by DarkstaR in the changelog when the function was added.
No idea why this isn't working... :(
SarahD1987
12-16-2013, 02:56 PM
Could someone give me a simple example of how to recognise the input from a Channel please? I just cant seem to get it working correctly and the documentation on the wiki doesn't explain it.
I can't seem to figure out which variables should be within the anonymous function for the speech callback
Edit: Here's some code I made while trying to get it to work. I had a look through the XenoLuaLib file and it looks like when someone speaks the speech callback is called with a variable 'message', but it still seems to print blank in the server log.
ConfigChannel = {}
function ConfigChannel:new()
local configChannel = {}
local thisChannel = nil
function configChannel:open(channelName)
thisChannel = Channel.New(channelName, function(message) self:inputReceived(message) end, function() print("closed") end)
end
function configChannel:stop()
thisChannel:Close()
end
function configChannel:inputReceived(message)
print(message)
end
configChannel:open("Config")
return configChannel
end
configChannel = ConfigChannel:new()
Here's the parts of the code from the XenoLuaLib file I'm referring to above:
function Channel:SpeakCallback(message)
if (self._speakCallback == nil) then return 0 end
return self._speakCallback(self, message)
end
function libOnCustomChannelSpeak(channel, message)
for i, c in ipairs(libChannels) do
if (c:ID() == math.floor(channel)) then
c:SpeakCallback(message)
break
end
end
end
Edit: Nevermind! I got it working after looking through the XenoLuaLib some more. I just needed another variable for the channel object. e.g.
function configChannel:open(channelName)
thisChannel = Channel.New(channelName, function(obj, message) self:inputReceived(message) end, function() print("closed") end)
end
Oversimulation
07-18-2017, 01:54 AM
Thank you! It has worked perfectly!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.