Modules/bIRC/ircGetBotByName

From Multi Theft Auto: Wiki
Revision as of 20:23, 29 July 2009 by Awwu (talk | contribs) (Created page with '{{ml_birc}} __NOTOC__ This function returns the first {{ml_birc|ircbot}} pointer of the bot with the specified name. It's useful if you don't have access to the variable where bo…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Package-x-generic.png This function is provided by the external module Basic IRC Module. You must install this module to use this function.

This function returns the first ircbot pointer of the bot with the specified name. It's useful if you don't have access to the variable where bot was originally stored in ircCreateBot.

Syntax

ircbot ircGetBotByName ( string botName )

Required Arguments

  • botName: The name of the ircbot you want to get.

Returns

Returns the ircbot pointer if ircbot with specified name was found, false otherwise.

Example

This example adds a command getbotstate which can be used to check the current state of an ircbot.

function getIrcBotState ( thePlayer, commandName, botName )
    local theBot = ircGetBotByName ( botName )
    if theBot then
        outputChatBox ( botnames .. " is currently " .. ircGetBotState ( theBot ) .. "." )
    else
        outputChatBox ( "There's no ircbot called " .. botName .. "!" )
    end
end
addCommandHandler ( "getbotstate", getIrcBotState )

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other