![]() |
Live/Visual Stats - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Live/Visual Stats (/showthread.php?tid=236) |
Live/Visual Stats - DarkX - 13-08-2006 Hey I got bored and started writting a visual/live stats code and I can't get them to become live(AKA) they won't automatically update themselves. You have to log off to make them work. I was wondering if someone could help me with this. Or post a working tutorial for this such thing. Thanks in advance. - Misunderstood - 13-08-2006 whenever the stats update, send the client the updated info. Duh ![]() - Robin - 13-08-2006 DarkX Wrote:Hey I got bored and started writting a visual/live stats code and I can't get them to become live(AKA) they won't automatically update themselves. You have to log off to make them work. I was wondering if someone could help me with this. Or post a working tutorial for this such thing. In modHandleData, find any packets which have things like "player(index).STR =" etc. and underneath, have a label or something in frmMirage updated with that information. If there isn't any packets which send this info, make one. - DarkX - 14-08-2006 Quote:In modHandleData, find any packets which have things like "player(index).STR =" etc. and underneath, have a label or something in frmMirage updated with that information. You mean like these? Code: If LCase(Parse(0)) = "playerstats" Then Sorry, still very new to this half of VB, how exactly would I do that. I tried something earlier on in the week, but I'm still not sure how you mean. - Leighland - 17-08-2006 That would work. The only thing is the stats will only be updated whenever you do something that calls the SendStats procedure on the server. So on the server, on frmServer, make a new timer and put this code in it: Code: Dim i As Byte Interval: 1000 Enabled: True This will update every players stats every second. EDIT: I also think you may have the code a little messed up. Open the Server source code and change the following things. I'm just going to post the code for what I think you're trying to do. in modServerTCP, find: Code: Sub SendStats(ByVal Index As Long) Replace it with this: Code: Sub SendStats(ByVal Index As Long) Now right here I'll explain a little something, just because it doesn't seem you understand how parsing works ![]() We send data to the client in a certain order. That order determines how we will later pick up the data on the client side. If you read it wrong on the client side, you could be displaying magi on your strength label, or displaying the players experience on the speed label... which we don't want. Lol. So here's how the serve ris going to send that above data to the client: 0. "PLAYERSTATS" 1. GetPlayerSTR(Index) 2. GetPlayerDEF(Index) 3. GetPlayerSPEED(Index) 4. GetPlayerMAGI(Index) 5. GetPlayerLevel(Index) 6. GetPlayerExp(Index) Now... open up the client source code and in modHandleData find the following: Code: ' ::::::::::::::::::::::::: Replace it with this: Code: ' ::::::::::::::::::::::::: Notice how we read it on the client in the same order as we sent it from the server? This not only makes the code cleaner and easy to find bugs, but it also makes sure we know exactly which variable we are setting each stat too. The way your code looks, judging that your server side code sends the stats in the same order I have, you woudl be setting the players strength level to whatever the value of their experience was. Which isn't good, obviously. Now, let's add the stuff to display that. Make sure you edit the following code to suit your labels. Code: ' ::::::::::::::::::::::::: This will now send the stats, experience, and level of each player connected to your server every second and display it on the labels you make on frmMirage. If you ahve any problems just post. - Robin - 18-08-2006 Leighland Wrote:That would work. The only thing is the stats will only be updated whenever you do something that calls the SendStats procedure on the server. So on the server, on frmServer, make a new timer That's as bad as sending the HP, MP and SP every ten seconds!!!! Using timers for something like that is really bad programming. All you need to do is go to frmTraining, press the 'train' button, find out what packet is sent. Go serverside, find that packet in handledata, then at the bottom add: Code: Call SendPlayerStats(index) Then make a new sub in modServerTCP: Code: Public Sub SendPlayerStats(byval Index as long) Then in clientside modHandleData, add a new packet called "updatedstats" and have all your labels updated with the values recieved in the packet ![]() ~Kite (I did that all off the top of my head, so I didn't write down all the stat's etc.) - DarkX - 18-08-2006 Ok Kite I know what your talking about, but I couldn't get it to work. Leighland's on the other hand, after a short amount of tweaking I got it to work... I thank both of you very much (I will try and figure out how to get yours working Kite) Thanks!!! - Robin - 19-08-2006 Sorry my post didn't give more information, but I don't have internet and VB6.0 on the same pc ![]() I'll see if I can write up a tutorial for it when I get a few minutes spare. Glad to see you got Leigh's one working though! ~Kite - DarkX - 20-08-2006 Well, I got yours somewhat working, but I had couldn't get it to where it automatically updates itself, you had to type /stats or press the stats button. Or find away to get the form your on to reload. - Coke - 20-08-2006 I equally have had such problems with efficiently displaying stats >. - DarkX - 20-08-2006 Unfortunately had to deal with those tricky stats, but thanks to leighland and Kite here things are finally working, where I can't get Kites to work I got leighlands working and it perfectly updates every 5 seconds. - Coke - 20-08-2006 The issue with that method is imagin when you have say 10 players online, think of the packet spamming! eeeek! Has anyone tried adding to the packets? For instance, the client sends a packet to the server saying you just earnt 15 experience, why then can the server not reply with an experience update? Also another 'want' for me if this was working would be for it to then blt the experience just earnt onto the players sprite, i think i saw gsd do something similar once and it was quite neat :] - DarkX - 20-08-2006 Well couldn't you modify the bltPlayerDamage, to be bltPlayerEXP, so when the player gets some exp it blts that plus the letters EXP above there head? - Robin - 21-08-2006 I got home, all ready to write up a tutorial for this, but when I got onto the source, I pressed the button in frmTraining, followed the string of packets, eventually came client side and just added: Code: If Index = MyIndex then At the end of one of the stat's packets. This packet is sent when you log in, or when you send training packets. I don't know why it doesn't work for you. ps. I did that on Mirage 3.03 ~Kite - DarkX - 21-08-2006 Yeah who knows if it'll work on MSE - Robin - 21-08-2006 The stat's weren't changed in MSE Build 1. I'm just saying, I did it in 3.03. - DarkX - 21-08-2006 I know but I have a problem with installing certain codes, like that (for some odd reason I have trouble with installing small crap like that. |