| Mirage Source http://web.miragesource.net/forums/ |
|
| Player Messages http://web.miragesource.net/forums/viewtopic.php?f=193&t=5338 |
Page 1 of 1 |
| Author: | Jacob [ Tue Mar 31, 2009 8:58 pm ] |
| Post subject: | Player Messages |
http://web.miragesource.com/forums/viewtopic.php?f=120&t=3719&start=500#p60658 Rian mentioned a different way to do the messages that are sent to players, such as "This is a safe zone!" and so on. Instead of doing different modules for each of those, it would be better to load in an external file with the messages. Each message would have an ID associated with it so you know what message is which. For messages like player damage and npc damage, I've come up with a way to send just what you need to fill in the message. Pseudo Code: SendClientMessage(MessageID as long, Optional args as string) MessageID would be the corresponding ID client side. The optional args would be for what that message needs. This would be client side Code: Private StringConst() As String ' Load our strings - Would be a text file for the real thing Private Sub LoadStrings() ReDim StringConst(0 To 4) StringConst(0) = "Just a test message." StringConst(1) = "A test message with a replace %1%." StringConst(2) = "%1% test messages %2%" StringConst(3) = "%1% Test is a mother %2% that will %3% you." StringConst(4) = "%1% hits you for %2% damage." End Sub Code: ' our function to replace strings Private Function ReplaceStr(ByRef MessageID As Long, Optional ByRef nString As String) As String Dim i As Long Dim args() As String ReplaceStr = "Error!" ' First check if it's a valid id If MessageID < 0 Then Exit Function If MessageID > UBound(StringConst) Then Exit Function ' Set our return string ReplaceStr = StringConst(MessageID) ' Split the nString If LenB(nString) > 0 Then args() = Split(nString, ",") For i = 0 To UBound(args) ReplaceStr = Replace(ReplaceStr, "%" & i + 1 & "%", args(i)) Next End If End Function Example of use: Code: Debug.Print ReplaceStr(2, "fucking,rock") Debug.Print ReplaceStr(3, "this,fucker,kill") Debug.Print ReplaceStr(4, "Dugor,1337") Thoughts? |
|
| Author: | Egon [ Tue Mar 31, 2009 10:12 pm ] |
| Post subject: | Re: Player Messages |
This is how most "big" game companies do things with messages, menus and errors. |
|
| Author: | Jacob [ Wed Apr 01, 2009 5:36 pm ] |
| Post subject: | Re: Player Messages |
Any other thoughts? Think I should add it to MS4 so you guys know what I mean? |
|
| Author: | Tony [ Wed Apr 01, 2009 5:39 pm ] |
| Post subject: | Re: Player Messages |
Sure, I'd like to see it. |
|
| Author: | Matt [ Wed Apr 01, 2009 6:48 pm ] |
| Post subject: | Re: Player Messages |
Dugor would never do 1337 damage. Sorry. >.> |
|
| Author: | grimsk8ter11 [ Wed Apr 01, 2009 8:45 pm ] |
| Post subject: | Re: Player Messages |
This is common practice and probably a good feature to have. It is actually called string tables to be formal, usually loaded from a file with a corresponding name or number to each so that once loaded into the table they can be easily referenced. You could implement bloom filters for visual basic as well and name them by strings like "AttackMessage1" or however felt necessary, bloom filters can filter thousands of hits a second. I have also been playing with bloom filters in Visual basic to use archives for large file sets. You can have over a thousand archives with thousands of files each in my C tests and still find if an archive has it and which one has it in under a few seconds. So it should handle a small group of strings very well, though hash tables may be more effective. |
|
| Author: | Tony [ Thu Apr 02, 2009 1:01 am ] |
| Post subject: | Re: Player Messages |
grimsk8ter11 wrote: This is common practice and probably a good feature to have. It is actually called string tables to be formal, usually loaded from a file with a corresponding name or number to each so that once loaded into the table they can be easily referenced. You could implement bloom filters for visual basic as well and name them by strings like "AttackMessage1" or however felt necessary, bloom filters can filter thousands of hits a second. I have also been playing with bloom filters in Visual basic to use archives for large file sets. You can have over a thousand archives with thousands of files each in my C tests and still find if an archive has it and which one has it in under a few seconds. So it should handle a small group of strings very well, though hash tables may be more effective. What's bloom filters? |
|
| Author: | Dragoons Master [ Thu Apr 02, 2009 11:56 am ] |
| Post subject: | Re: Player Messages |
Very good idea. I WILL implement them asap. |
|
| Author: | Jacob [ Thu Apr 02, 2009 11:58 am ] |
| Post subject: | Re: Player Messages |
I'll probably add it to MS4 next week. Going on a vacation this weekend. |
|
| Author: | Nean [ Thu Apr 02, 2009 1:35 pm ] |
| Post subject: | Re: Player Messages |
Dugor wrote: I'll probably add it to MS4 next week. Going on a vacation this weekend. Awesome. You don't know how glad I am to hear, that MS4 will be making progress again. |
|
| Author: | FrankJScott [ Wed Aug 28, 2024 6:10 pm ] |
| Post subject: | Updated 7RAJATOGEL Tips |
In response to the lady talking about slot bank online 24 jam, game slot link, agen judi casino, agen slots, main slot88 login, slot s, game slot game, link judi, sistem slot online, slot lagi, I highly suggest this click this link for 7RAJATOGEL link or macam macam judi slot online, slot lagi, judi online 4d, slot online ovo, game judi slot online, slot games login, agen judi slot slot online, agen judi terpercaya, user slot login, slot game indonesia, as well as this updated 7RAJATOGEL info on top of link game judi slot online, spin slot88 login, game judi slot online, sg slot online, login slot joker, bandar judi hongkong, slot saja, nama situs judi slot, 666 casino, slot joker online, as well as this best 7RAJATOGEL advice which is also great. Also, have a look at this homepage for 7RAJATOGEL blog on top of game online slot indonesia, web judi online, indonesia slot online, bandar slot88 login, agen slot online, sistem judi slot online, bandar judi slot online terbaik, slot 666 game, macam macam judi slot online, link slot live, on top of this top 7RAJATOGEL advice with situs judi slot online pg soft, judi toto online, judi asia slot, spin slot88 login, web slot game, rtp bolaxx slot, apa judi slot, nama nama situs judi slot, slot spade, microgaming slot online, for good measure. Check more @ Updated ASIAN2BET Site b6e4238 |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|