Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding stats on the client side.


KrakaKrucifix
 Share

Recommended Posts

Hello everyone and long time no see.  I recently used this link:

[http://www.touchofdeathforums.com/smf/index.php/topic,35634.0.html](http://www.touchofdeathforums.com/smf/index.php/topic,35634.0.html)

to add two new stats to my game: dexterity and wisdom.  It appears to have worked, the functions are usable and all.  The problem I am having is that this doesn't add the stats to the client side so that Users can click the + sign to add stats.  I was wondering if anyone could make or knows of a tutorial that walks through adding stats on the client's side.

Thanks in advance,

KK
Link to comment
Share on other sites

Just add your own labels to the picCharStatus window in frmMirage, make the + label and then do it like the rest of them

```
Private Sub AddWhateverthelabeliscalled_Click()
    Call SendUseStatPoint(X)
End Sub

```
where X is the stat number.
Link to comment
Share on other sites

Ok, so it looks like there is a lot more to it over all than that, though I may not have described my situation very well.  At the time I wrote this, I had done nothing client side regarding adding these two stats.  Since then I have done quite a bit but I am still hitting on snag and I'm not sure what to do to fix it.  When trying to log into the game with my edited client I get an VB Runtime error 9, script out of range.  I've narrowed the issue down to one particular part of code.  Please see my code below, the bolded part is where the issue occurs:

> ' :::::::::::::::::::::::::
>     ' :: Player Stats Packet ::
>     ' :::::::::::::::::::::::::
>     If (casestring = "playerstatspacket") Then
>         Dim SubDef As Long, SubMagi As Long, SubSpeed As Long, SubStr As Long, SubWis As Long, SubDex As Long
>         SubStr = 0
>         SubDef = 0
>         SubMagi = 0
>         SubSpeed = 0
>         SubWis = 0
>         SubDex = 0
>
>         If GetPlayerWeaponSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).addDEX
>            
>         End If
>         If GetPlayerArmorSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).addDEX
>         End If
>         If GetPlayerShieldSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).addDEX
>         End If
>         If GetPlayerHelmetSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).addDEX
>         End If
>         If GetPlayerLegsSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerLegsSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerLegsSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerLegsSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerLegsSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerLegsSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerLegsSlot(MyIndex))).addDEX
>         End If
>         If GetPlayerRingSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerRingSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerRingSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerRingSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerRingSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerRingSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerRingSlot(MyIndex))).addDEX
>         End If
>         If GetPlayerNecklaceSlot(MyIndex) > 0 Then
>             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerNecklaceSlot(MyIndex))).AddSTR
>             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerNecklaceSlot(MyIndex))).AddDEF
>             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerNecklaceSlot(MyIndex))).AddMAGI
>             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerNecklaceSlot(MyIndex))).AddSpeed
>             SubWis = SubWis + Item(GetPlayerInvItemNum(MyIndex, GetPlayerNecklaceSlot(MyIndex))).AddWis
>             SubDex = SubDex + Item(GetPlayerInvItemNum(MyIndex, GetPlayerNecklaceSlot(MyIndex))).addDEX
>         End If
>
>         If SubStr > 0 Then
>             frmMirage.lblSTR.Caption = Val(parse(1)) - SubStr & " (+" & SubStr & ")"
>         Else
>             frmMirage.lblSTR.Caption = Val(parse(1))
>         End If
>         If SubDef > 0 Then
>             frmMirage.lblDEF.Caption = Val(parse(2)) - SubDef & " (+" & SubDef & ")"
>         Else
>             frmMirage.lblDEF.Caption = Val(parse(2))
>         End If
>         If SubMagi > 0 Then
>             frmMirage.lblMAGI.Caption = Val(parse(4)) - SubMagi & " (+" & SubMagi & ")"
>         Else
>             frmMirage.lblMAGI.Caption = Val(parse(4))
>         End If
>         If SubSpeed > 0 Then
>             frmMirage.lblSPEED.Caption = Val(parse(3)) - SubSpeed & " (+" & SubSpeed & ")"
>         Else
>             frmMirage.lblSPEED.Caption = Val(parse(3))
>         End If
> **        If SubWis > 0 Then
>             frmMirage.lblWis.Caption = Val(parse(8)) - SubWis & " (+" & SubWis & ")"
>         Else
>             frmMirage.lblWis.Caption = Val(parse(8))
>         End If
>         If SubDex > 0 Then
>             frmMirage.lblDex.Caption = Val(parse(9)) - SubDex & " (+" & SubDex & ")"
>         Else
>             frmMirage.lblDex.Caption = Val(parse(9))
>         End If**        frmMirage.lblEXP.Caption = Val(parse(6)) & " / " & Val(parse(5))
>
>         frmMirage.shpTNL.Width = (((Val(parse(6))) / (Val(parse(5)))) * 150)
>         frmMirage.lblLevel.Caption = Val(parse(7))
>         Player(MyIndex).Level = Val(parse(7))
>
>         Exit Sub
>     End If
Link to comment
Share on other sites

You gotta do it client side too.
I haven't really looked into the code, nor the tutorial you used because im short on time but, try this: Get on skill as a template, say Defence, and then just search for everything that involves the Defence skill (except the part that calculates the hits, etc.) and copy it over and rename it.
Link to comment
Share on other sites

I know it has to be done on the client side too, thats what I'm trying to do.  I haven't added the two new stats to the Item Editor, NPC Editor, or frmNewShop, however, that should not be causing the issue I have above.

I have done a search using DEF as my criteria and, other than the sections mentioned above, I believe I have a matching set of code for both my Dex and Wis stats.  I just can't figure out what causes the above code.  I can comment the bolded code out and the issue no longer occurs but this obviously means that when I log in, instead of displaying my Wisdom and Dex as a number, it simply displays whatever I put in the label box as a caption while I was editing the source.

I was thinking my issue might have something to do with parsing, but from what I can tell I am doing it right.  I also have lblWis and lblDex created in frmMirage.  Other than those two possibilities I'm not sure what else could cause the above bolded lines of code to have issues.

Thanks again.
Link to comment
Share on other sites

ok, so you have ONLY done this client sided? nothing is send by server?

because that would fuck it up ya know, it tries to find a parse adres which is not send XD

if you DID include it server wise, please check the stuff send and recieved by using addtext for current player, this can be used as debug thingy, thats what i always do, i first let server add text to my client to see whats send, then i let client show me whats recieved.

i think that would give you a clear hint on whats wrong ^^

Damian666
Link to comment
Share on other sites

I did a lot of stuff client side, basically followed what the tutorial at the top said to do, but I don't think anything I had to do dealt with parsing.  That could very be the issue.  I'm not sure how making messages in this situation would help me because I know that if a uncomment out the bolded text above, I can't even play the game.  It crashes as soon as I try to load a character.  But I'll check the server side for parsing that needs to be done.  hadn't thought of that.

If you could further explain what to do with the messages (i understand how it would help, i often use cout to help me find errors while coding in C++, but in this situation I can't even uncomment the code without crashing), I'd appreciate it.
Link to comment
Share on other sites

Sorry, meant to say I'd done a ton of stuff server sided.  In fact the stats seem to work completely… the only issue is getting the number to display on the character portion of the screen (when you click the character button).  Where it should say Dexterity : # it says Dexterity : Dexterity because of the code I had to comment out so the game wouldn't crash.

As for adding a message, I understand how to implement adding a message, but I'm not sure how that would help my situation.  I know that the stats transfer properly, when I do a /info it shows me my Dex and Wisdom like it should and I can add stat points to it and everything.  All my scripts and functions that use the stats work as well.  The only issue is with getting the label that should show the amount of Dex and Wisdom that I have to show that amount.  And the reason I'm not sure how to implement a message in such a way that it will help me is because if I uncomment out the code that makes it so that the amount of wisdom and dex I should have is shown, I can no longer get into the game to see any message anyway.
Link to comment
Share on other sites

You need to tell the game what the caption should look like, so my guess is that you should tell that somewhere on ModHandleData (the Player Stats packet to be more specific)

Maybe something like this:

```
        If SubDex > 0 Then
            frmMirage.lblDex.Caption = Val(parse(X)) - SubDex & " (+" & SubDex & ")"
        Else
            frmMirage.lblDex.Caption = Val(parse(X))
        End If

```
Just change the parse number and tweak it to fit the name of the label.

Also, dont forget to Dim SubDex As Long.
Also dont forget to tell that SubDex = 0
Link to comment
Share on other sites

Ok, I have dimmed them and set them = 0.  Here is the code I have for that section

```
'      If SubWis > 0 Then
'          frmMirage.lblWis.Caption = Val(parse(8)) - SubWis & " (+" & SubWis & ")"
'      Else
'          frmMirage.lblWis.Caption = Val(parse(8))
'      End If
'      If SubDex > 0 Then
'          frmMirage.lblDex.Caption = Val(parse(9)) - SubDex & " (+" & SubDex & ")"
'      Else
'          frmMirage.lblDex.Caption = Val(parse(9))
'      End If
```
It is currently commented out because if not, my game crashes upon entering with my character.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...