• Welcome to Valhalla Legends Archive.
 

[VB? - extracting text fields] Commands ("kick" , "ban exe)

Started by titan0060, August 30, 2004, 10:28 AM

Previous topic - Next topic

titan0060

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.]

Banana fanna fo fanna

You need to ***LEARN VB!***

And don't say you do, this is a trivial task.

Hint: use Split()

Warrior

Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Grok

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!

Stealth

- Stealth
Author of StealthBot


Meh


Banana fanna fo fanna


Blaze

Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

l)ragon

Might want to look up the 'if' statment aswell, since you will probably use that quite often.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

R.a.B.B.i.T


Forged

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)
QuoteI wish my grass was Goth so it would cut itself

Banana fanna fo fanna

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.

LivedKrad

#13
[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