XenoBot Forums - Powered by vBulletin

User Tag List

Page 4 of 4 FirstFirst ... 234
Results 31 to 39 of 39

Thread: Xenobot Lua Documentation

  1. #31
    Noceur's Avatar
    Join Date
    Sep 2013
    Location
    Sweden
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I love you, this is a lot more handy to me than the file that comes with xenobot.

  2. #32

    Join Date
    Apr 2012
    Location
    RS, Brazil
    Posts
    181
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    @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
    Last edited by Ropiderz; 09-16-2013 at 09:32 PM.

  3. #33
    Senior Member
    Join Date
    May 2013
    Posts
    659
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Ropiderz View Post
    @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

  4. #34
    XenoBot Scripts Developer Syntax's Avatar
    Join Date
    Feb 2011
    Posts
    1,660
    Mentioned
    431 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Ropiderz View Post
    @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.

  5. #35
    Senior Member RoxZin xD's Avatar
    Join Date
    Feb 2012
    Location
    Rio de Janeiro
    Posts
    714
    Mentioned
    16 Post(s)
    Tagged
    1 Thread(s)
    Or maybe an increase in the maximum characters per post? But wikia looks sexy too

  6. #36

    Join Date
    Apr 2012
    Location
    RS, Brazil
    Posts
    181
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm sticking it into wikia, to see documentation see this link: http://xenobot.wikia.com/wiki/Documentation
    Last edited by Ropiderz; 09-17-2013 at 09:43 PM.

  7. #37
    robin's Avatar
    Join Date
    Jan 2012
    Location
    Poland / UK
    Posts
    105
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PromB View Post
    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...

  8. #38

    Join Date
    Dec 2012
    Posts
    187
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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
    Last edited by SarahD1987; 12-16-2013 at 02:16 PM.

  9. #39

    Join Date
    Jul 2017
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you! It has worked perfectly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •