18-09-2008, 05:52 PM
MS4
v3.51
Adding new /commands like /kill or /mute have changed. They are now structured like the packet system.
Reference: http://web.miragesource.com/forums/viewt...331#p52200
HandleKeyPresses
Find
It will first get the text that you have typed in and will split it wherever a space is.
Example:
You type in "/info Admin".
The split function will then create the following array.
Command(0) = "/info"
Command(1) = "Admin"
So now we have to select what the command was and do something with it.
After
You'll have all the select statements.
Example
As you can see we have to add
This will be our error checking, since we know that we have to have the "/Command' and an additional piece of info, we have to make sure our array contains the right amount of elements.
If you know you need 4 pieces of info for your command you would have to do something like
1 for your command and 4 additional pieces of info.
Then you can access the strings in your command with
Little thing on Val() to convert to a numerical value. It would be better to use the correct conversion.
For example if you know your string needs to be a long then you would do:
Clng() - Converts to a long
CInt() - Converts to an integer
Cbyte() - Converts to a byte
Now before we convert we want to make sure we have a valid number first.
A good check would be
MAKE SURE TO CHECK ISNUMERIC BEFORE CONVERTING OTHERWISE YOU WILL GET ERRORS IF SOMEONE TYPES IN ANYTHING BESIDES A NUMBER.
I think that's it. If I'm missing something or didn't explain things well please let me know.
v3.51
Adding new /commands like /kill or /mute have changed. They are now structured like the packet system.
Reference: http://web.miragesource.com/forums/viewt...331#p52200
HandleKeyPresses
Find
Code:
If Left$(MyText, 1) = "/" Then
Command = Split(MyText, " ")
It will first get the text that you have typed in and will split it wherever a space is.
Example:
You type in "/info Admin".
The split function will then create the following array.
Command(0) = "/info"
Command(1) = "Admin"
So now we have to select what the command was and do something with it.
After
Code:
Select Case Command(0)
Example
Code:
Case "/info"
' Checks to make sure we have more than one string in the array
If UBound(Command) >= 1 Then
Call SendData(CPlayerInfoRequest & SEP_CHAR & Command(1) & END_CHAR)
End If
As you can see we have to add
Code:
If UBound(Command) >= 1 Then
If you know you need 4 pieces of info for your command you would have to do something like
Code:
If UBound(Command) >= 5 Then
Then you can access the strings in your command with
Code:
Command(NumberYouNeed)
Little thing on Val() to convert to a numerical value. It would be better to use the correct conversion.
For example if you know your string needs to be a long then you would do:
Code:
CLng(Command(1))
Clng() - Converts to a long
CInt() - Converts to an integer
Cbyte() - Converts to a byte
Now before we convert we want to make sure we have a valid number first.
A good check would be
Code:
If IsNumeric(Command(1)) Then
SendSetAccess Command(2), CLng(Command(1))
End If
MAKE SURE TO CHECK ISNUMERIC BEFORE CONVERTING OTHERWISE YOU WILL GET ERRORS IF SOMEONE TYPES IN ANYTHING BESIDES A NUMBER.
I think that's it. If I'm missing something or didn't explain things well please let me know.