Xenobot Lua Documentation
Documentation is hosted at wikia site.
http://xenobot.wikia.com/wiki/Documentation
Summary
Printable View
Xenobot Lua Documentation
Documentation is hosted at wikia site.
http://xenobot.wikia.com/wiki/Documentation
Summary
-----
-----
-----
-----
-----
-----
-----
-----
-----
-----
-----
Well, good job
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.
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.
I might be wrong, but this one isn't working without @Forgee's library.
Correct me if I'm wrong.
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:
lua code:
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.
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.
Where do I download this XenoLuaLib.lua?
Fuck me.. You deserve a medal.
It seems that the Self.UseBed function doesn't work properly. It gets stuck at the 'Choose a Skill' window :(
I love you, this is a lot more handy to me than the file that comes with xenobot. :)
@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
Or maybe an increase in the maximum characters per post? But wikia looks sexy too :eek:
Well, I'm sticking it into wikia, to see documentation see this link: http://xenobot.wikia.com/wiki/Documentation
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.
Code: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:
Code:function Channel:SpeakCallback(message)
if (self._speakCallback == nil) then return 0 end
return self._speakCallback(self, message)
end
Code: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.
Code:function configChannel:open(channelName)
thisChannel = Channel.New(channelName, function(obj, message) self:inputReceived(message) end, function() print("closed") end)
end
Thank you! It has worked perfectly!