Author | Message | Time |
---|---|---|
David | I just started programming and im getting the basics down with my bot, im using (CSB) and im not getting the whole commands concept down, any help or examples or anything would be nice - David / JeLLo @ USWest - Inside @ USEast | March 23, 2004, 5:14 PM |
SNiFFeR | I would recommend implementing the commands on the ontalk sub. Have it check your database, if it finds the user (create a sub), goto the command sub. If it doesn't find the user, exit sub. | March 23, 2004, 5:25 PM |
Eli_1 | As someone allready said, it would go in your CSB_OnTalk or UserTalk event, whichever it is... Anyway, you would first check to see if the leftmost amount of the data is your trigger. e.g.: [code] if left(lcase(message), len(trigger)) = trigger and len(message) > len(trigger) then message = right(message, len(message) - len(trigger) end if [/code] That would check to see if for, example, the left 2 characters of the string is your trigger (1!). if so -- remove those chars. if not - well, don't do anything. then you would check to see if the user is trying to run a command, which can be done many ways, but the easiest seems to be: [code] if left(message, 4) = "say " and len(message) > 4 then CSB.send right(message, len(message) - len(trigger) - 4) elseif ... elseif ... end if ect.... [/code] Btw, the "and len(message) > 4 then" is to stop the user from typing something like this: [quote] "1!say " [/quote] Which would make your bot send nothing... Also you would need to see if the user has access to your bot, which again can be done many ways. | March 23, 2004, 8:00 PM |