Ok, im trying to program commands into my bot, but i've only been able to get !ver because it doesn't run a second word.
when i say... !Kick JohnDoe
is there a way i can have my bot pick up the !Kick without the JohnDoe.
Help me out plz
[Kp edit: gave him a new title, then kicked him out of botdev. His question is about basic text parsing, which belongs in the forum of his language of choice.]
You need to ***LEARN VB!***
And don't say you do, this is a trivial task.
Hint: use Split()
I might be able to put together ban.exe :P
Quote from: $t0rm on August 30, 2004, 10:34 AM
You need to ***LEARN VB!***
And don't say you do, this is a trivial task.
Hint: use Split()
Yes, Split, Join, Choose, and Switch are all excellent useful VB functions for text processing. Learn them all!
Mid$() and InStr() are also essential.
I use Right() and Left() a lot.
Lcase = and Rcase =
Ever since discovering regex, I can't go back.
Don't forget UCase!
Might want to look up the 'if' statment aswell, since you will probably use that quite often.
And Split() can be helpful sometimes.
if lcase(message)="!kick" & name then
csb.send = "/kick" &name
Assuming you are using csb and have name defined as a string
(I have no idea what you are asking but this seemed like it)
This regex should do it for you:
%c(\w+?)\s*?(.*?)
And sub in your trigger for %c. Command name will be group 1, args will be group 2.
[Let us assume that the thread starter was referring to Visual Basic!]
Quote from: Forged on September 03, 2004, 11:38 PM
if lcase(message)="!kick" & name then
csb.send = "/kick" &name
Assuming you are using csb and have name defined as a string
(I have no idea what you are asking but this seemed like it)
So, we would have to look at this assuming the variable "name" is declared as a sectioned part of the message? For instance, if I wanted to extract "Forged" from ".kick Forged", and I set up a control flow statement to extract "name", it's going to give some goofy error. You'll need to have something to the effect of...
Public name as String
If LCase(message) = someTrigVar & "kick " Then
name = mid$(message, 6) 'Extract all text from the 'message' variable starting from position 6; can be reused so long as the variable receives a new value per action
WhateverObject.Send "/kick " & name
End If