Author | Message | Time |
---|---|---|
GoSu_KaOs | This is my info command. It works like this. When a user types in " .info <username> " , the bot opens the file that has the same name as the user's message with out the .info text .( If I type in " .info GoSu ", then the bot will open the file called "GoSu.txt"), then send the information in the file to bnet. The problem is, I can't get rid of the " .info " text from the message. When I type in ".info GoSu", it will open the file "GoSu.txt". But when I type in something like " .info GoSuKaOs ", the message showes up as "ukaos". If I change the number in " Right((LCase(message)), 5) " to something like 20, the message will show " .info GoSuKaOs". I Don't get how to make this work. Here's the code I got: [code]If username = "GoSu" then If Left((LCase(message)), 5) = (Loadtrigger & "info") Then Open (App.Path & Right((LCase(message)), 5) & ".txt") For Input As #1 Input #1, za Send "This user was last seen on: " & za Close #1 End If End If[/code] I've explained it as clear as I could. Let me know if you can help | November 8, 2004, 10:35 PM |
Zakath | Couldn't Mid be used to do this? | November 8, 2004, 11:01 PM |
Yegg | The proper way in doing that would be: [code]If username = "GoSu" then If LCase(Left(message, 5)) = (Loadtrigger & "info") Then Open (App.Path & Right(message, (Len(message) - 6)) & ".txt") For Input As #1 Input #1, za Send "This user was last seen on: " & za Close #1 End If End If[/code] .....nice job zakath, u coulda given him an example. | November 8, 2004, 11:35 PM |
Yoni | Mid(somestring, n) gives the same result (maybe even faster) as Right(somestring, Len(somestring) - n + 1). And it is not a complicated problem - GoSu_KaOs could have looked up Mid in the VB reference, following Zakath's post, and figured it out. Edit: Btw, this should be in the VB forum, it's only remotely to do with bot development. | November 8, 2004, 11:49 PM |
Yegg | but wut if the gosu didn't fully understand Mid? giving an example is a good way in helping some1 understand how to do something the right way. | November 8, 2004, 11:50 PM |
Zakath | And it also can do the exact opposite. I much prefer giving people pointers to where they can learn to improve their coding technique on their own, rather than simply handing them code that does what they want. | November 8, 2004, 11:58 PM |
Yegg | good point. i jus figured since it looks like hes new to programming from reading his other posts i'd giv him an example. | November 9, 2004, 12:01 AM |
Zakath | It really doesn't take a supergenius to understand the entries for Mid in MSDN. | November 9, 2004, 12:14 AM |
Minux | Shouldn't this be in the Visual Basic Forum? | November 9, 2004, 1:17 AM |