Author | Message | Time |
---|---|---|
SiMi | ok , im adding commands to my bot but i want to get a good start , not on adding the commands but writing them and usuing the access way.Ok this is what i mean Public Function Event_Talk If LCase(strText) = "?trigger" Then Send msTrigger & " (ALT + 0" & Asc(msTrigger) & ")", True If Left(strText, 1) = msTrigger Then DoCommands strUser, strText, False End Sub thats from ethbot.....what i need is to start writing ot commands but writing them out in order from the access list unstead of M or A i want to write them out by 10 , 20 , 30 ..... can somebody get me started and i can take it from there 2nd question i need a good anti idle....telling the Bot Uptime , Connection Uptime and Computer Uptime..... i dont need them all in one but thats what i need grrrr.........someone help ;D | January 12, 2003, 10:51 PM |
celluloid | to answer your 2nd question (i believe) you could use this code, make a timer, and at the amount of time you set make it do /uptime this is what i use (note: this is just the /uptime part of te code i have in a module) [code]If (Mid(txtSendBNET.text, 1, 7) = "/uptime") Then rtbAdd "Bot idle for: " & FormatCount(GetTickCount - LastTalk, 4) & vbNewLine, vbBlue rtbAdd "Bot connected for: " & FormatCount(GetTickCount - connecttime) & vbNewLine, vbBlue rtbAdd "Bot uptime: " & FormatCount(GetTickCount - RunningTime) & vbNewLine, vbBlue rtbAdd "Computer uptime: " & FormatCount(GetTickCount) & vbNewLine, vbBlue[/code] i hope this helps a little bit if not, at least give you an idea of where to go with it. | January 13, 2003, 12:39 AM |
SiMi | [quote] [code]If (Mid(txtSendBNET.text, 1, 7) = "/uptime") Then rtbAdd "Bot idle for: " & FormatCount(GetTickCount - LastTalk, 4) & vbNewLine, vbBlue rtbAdd "Bot connected for: " & FormatCount(GetTickCount - connecttime) & vbNewLine, vbBlue rtbAdd "Bot uptime: " & FormatCount(GetTickCount - RunningTime) & vbNewLine, vbBlue rtbAdd "Computer uptime: " & FormatCount(GetTickCount) & vbNewLine, vbBlue[/code] [/quote] shouldn't it be If (Left(txtSendBNET.text, 1, 7) = "/uptime") Then | January 13, 2003, 1:02 AM |
LoRd | Mid is short for middle whats in between chracter 1 and character 7 /uptime | January 13, 2003, 2:51 AM |
Yoni | Mid(s, 1, 7) is pretty much equivalent to Left(s, 7) though. I'd say Left is faster than Mid, but this is VB we're talking about, so speed is irrelevant. 8) | January 13, 2003, 8:20 AM |
Spht | Like Grok said once, you should check if the input was even a command before you try and treat every message as if it could be a command. In SphtBot, when processing _KeyPress() for input, I check to see if the input was a command (Left(s, 1) = "/"), if it is, I send it to a command processing function. The function parses the input into Command - Parameter. Then using Select Case, I check the command. If the command matches no local commands, I then run it through the Aliases Binary Chat plugin (Aliases.bcp) which will then run the translated command back through the same function. Using a seperate function allows me to have a remote command like "localcmd" that can call any local or Alias command. When it's called remotely, any messages that would be displayed on screen from the triggered command would be whispered back to the user if bLocal = False. If the command has no return, then it will return "Local command processed" by default. | January 13, 2003, 9:10 AM |
Grok | Auto-List/Auto-complete command list would be a nice GUI addition for when the user pressed the command token("/", ".", or alternative). [pre] . (dropdown list of possibilities) .b (show ban, other b* commands) .b[tab] (completes selected command from list) [/pre] | January 13, 2003, 12:21 PM |
SiMi | grrrr....someone anwser my questions... | January 13, 2003, 7:38 PM |
Atom | Yeah ok, ill try to help you. You need to learn how to use arrays. You can load a database of users with their flags into an array and loop through the items to see if that user has the proper flags. Boy im too tired to help nm. | January 13, 2003, 10:21 PM |
Grok | Hi SiMi, I'll tackle your first question. The 2nd question, uptimes, is just a matter of subtracting the current time from the start time, and displaying the result. "Uptime = " & Format(Tnow-Tstart, "HH:MM:SS") kind of thing. Q: "add commands using the access[level] way" Based on your description, and needs of the process, I will make some assumptions, stated here: Assumption: * UserID/Name is already determined (fUserID) * A function is available to get user access level. * If user level is higher than or equal to the command access level, the user is granted permission for the command. * All commands are enumerated. * An array is available with the access level for each command. As you can see, you may have more groundwork to lay before we can actually write a function to grant permission to run a command. Even so, there may be more to consider, like the target/effect of a command. ZeroBot grants members the ability to ban, but ban won't work on certain targets (S-listed names). But that logic can go in the command implementation. [code] Public Function CommandIsAuth(nCmdId, fUserId) As Boolean CommandIsAuth = False Dim pCmdSecLev As Long Dim pUserSecLev As Long pCmdSecLev = COMMAND_SECURITY_LEVEL(nCmdId) 'read value from array pUserSecLev = GetUserSecurityLevel(fUserId) 'function to get user access level if pUserSecLev < pCmdSecLev Then Exit Function 'anyone surviving that is authorized for this command CommandIsAuth = True End Function [/code] In your startup code, you might want to initialize the array of command security levels, which in my sample I named COMMAND_SECURITY_LEVEL(). To make it easier to index commands and write code, I suggest creating a Commands Enum. [code] Public Enum BotCommands CmdNone CmdKick CmdBan CmdJoin CmdTalk ' ... etc End Enum Public Const MAX_BOT_COMMANDS = 50 'set to your count from Enum BotCommands Public COMMAND_SECURITY_LEVEL(0 To MAX_BOT_COMMANDS) As Long [/code] This should get you started without giving away the farm. | January 14, 2003, 6:19 AM |
n00blar | Damn I love grok! He replies and then silence is heard throughout the land =P I guess they are all standing in awe of your greatness hehe =) well i'm glad to see somone (grok) is of great help! | January 14, 2003, 8:12 AM |
SiMi | damn... good job , thanks | January 14, 2003, 7:37 PM |