| Mirage Source http://www.miragesource.net/forums/ |
|
| Help: Hmm http://www.miragesource.net/forums/viewtopic.php?f=201&t=754 |
Page 1 of 2 |
| Author: | William [ Tue Nov 21, 2006 6:35 pm ] |
| Post subject: | Help: Hmm |
Code: Mid(GetPlayerName(i), 1, Val(Parse$(3))) That line of code can only equal to one exact name, like: Code: william But it cant also equal to: Code: William
So how can you make it so it can be both capslock letters and not? |
|
| Author: | Verrigan [ Tue Nov 21, 2006 7:33 pm ] |
| Post subject: | Re: Help: Hmm |
William wrote: Code: Mid(GetPlayerName(i), 1, Val(Parse$(3))) That line of code can only equal to one exact name, like: Code: william But it cant also equal to: Code: William So how can you make it so it can be both capslock letters and not? LCase() |
|
| Author: | William [ Tue Nov 21, 2006 8:57 pm ] |
| Post subject: | |
Nice.. I'll check it out. |
|
| Author: | William [ Tue Nov 21, 2006 9:27 pm ] |
| Post subject: | |
Code: f MsgToString = LCase(Mid(GetPlayerName(i), 1, Val(Parse$(3)))) Or MsgToString = Mid(GetPlayerName(i), 1, Val(Parse$(3))) Then Works fine now. Thanks :D I made a page system, so all you need to write is this: Code: The name of the person you want to page is Verrigan, but all you need to do is write this:
/ver hello man or /Verri hello or /ve hey |
|
| Author: | Lea [ Wed Nov 22, 2006 1:09 am ] |
| Post subject: | |
Man, I feel sorry for "Ve-rrigan", "Ve-ctor", "Ve-23" all those Ve names, how will you determine which one the message is for? |
|
| Author: | Verrigan [ Wed Nov 22, 2006 4:56 am ] |
| Post subject: | |
I'm the only one that can start with 'V', damnit! |
|
| Author: | William [ Wed Nov 22, 2006 1:47 pm ] |
| Post subject: | |
Dave wrote: Man, I feel sorry for "Ve-rrigan", "Ve-ctor", "Ve-23" all those Ve names, how will you determine which one the message is for?
It will take the one with the smallest index. Sometimes you might page wrong. But overall this system is good for long names |
|
| Author: | Lea [ Wed Nov 22, 2006 10:06 pm ] |
| Post subject: | |
That kinda sucks... I hope your game doesn't get more than a couple people on, or else you'll run into trouble like that. |
|
| Author: | William [ Wed Nov 22, 2006 10:27 pm ] |
| Post subject: | |
no it wont. T4C uses the same system. And you can write the full name if you wish. |
|
| Author: | Spodi [ Thu Nov 23, 2006 1:29 am ] |
| Post subject: | |
Just do the same thing on the char creation (case-insensitive) and you'll be fine. /whisper Spodi /whisper spodi /whisper SPODI All the same in the end. But there can be only one Spodi made. |
|
| Author: | William [ Thu Nov 23, 2006 1:03 pm ] |
| Post subject: | |
LCase() only makes it work like this: Will will This isnt working for it: wILL WilL |
|
| Author: | Misunderstood [ Thu Nov 23, 2006 2:08 pm ] |
| Post subject: | |
I don't know what you're smoking, but I'm pretty sure LCase changes the entire string to lowercase, not just the first letter. Changing the first letter of a word is called converting to propercase, vb has another function for that.(I think its like strconv(string,vbproppercase) |
|
| Author: | Joost [ Thu Nov 23, 2006 2:41 pm ] |
| Post subject: | |
Problem. 2 players. One named John. The other Johnson. Johnson has a lower index number. How'd you PM John? |
|
| Author: | William [ Thu Nov 23, 2006 4:06 pm ] |
| Post subject: | |
@Missunderstood: If you look above I had "or" in the if statement. Which means I can either have it all like william. Or as it was written correctly: William. @Joost: well kick them. |
|
| Author: | Verrigan [ Thu Nov 23, 2006 4:35 pm ] |
| Post subject: | |
William, to make sure any strings are compared properly, both should be the same case... So LCase() both strings.. Then you'll never have a problem. |
|
| Author: | William [ Thu Nov 23, 2006 5:05 pm ] |
| Post subject: | |
Heres the bloody code: Server Code: Case "playermsg" MsgToString = Parse$(1) For i = 1 To HighIndex If MsgToString = LCase$(Mid$(GetPlayerName(i), 1, Val(Parse$(3)))) Or MsgToString = Mid$(GetPlayerName(i), 1, Val(Parse$(3))) Then D = i End If Next i MsgTo = D Msg = Parse$(2) client Code: Sub PlayerMsg(ByVal Text As String, ByVal MsgTo As String, ByVal i As Byte) Dim packet As String packet = "playermsg" & SEP_CHAR & MsgTo & SEP_CHAR & Text & SEP_CHAR & i & SEP_CHAR & END_CHAR Call SendData(packet) End Sub Code: ' Player message
If Mid$(MyText, 1, 1) = "/" Then ChatText = Mid$(MyText, 2, Len(MyText) - 1) Name = vbNullString ' Get the desired player from the user text For i = 1 To Len(ChatText) If Mid$(ChatText, i, 1) <> " " Then Name = Name & Mid$(ChatText, i, 1) Else Exit For End If Next i ' Make sure they are actually sending something If Len(ChatText) - i > 0 Then ChatText = Mid$(ChatText, i + 1, Len(ChatText) - i) ' Send the message to the player Call PlayerMsg(ChatText, Name, i - 1) Else Call AddText("Usage: /playername msghere (The whole player name is not needed to be written. Also remember to write the correct caps.", AlertColor) End If MyText = vbNullString frmMirage.txtMyChat.Text = vbNullString Exit Sub End If Now stop telling me everything that sucks with it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|