DarkDino Posted May 10, 2013 Author Share Posted May 10, 2013 I have no idea why this happens. I can't explain it, i do not change the stats but this happens:![](http://i1070.photobucket.com/albums/u492/darkdino2d/ERRORdmrd_zpsf435ddde.png)PLEASE HELP ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png)I use EO 3.0. Link to comment Share on other sites More sharing options...
Synergy Posted May 10, 2013 Share Posted May 10, 2013 Can we see the code for the labels? Link to comment Share on other sites More sharing options...
DarkDino Posted May 10, 2013 Author Share Posted May 10, 2013 > Can we see the code for the labels?```Private Sub HandlePlayerStats(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim buffer As clsBufferDim i As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set buffer = New clsBuffer buffer.WriteBytes data() For i = 1 To Stats.Stat_Count - 1 SetPlayerStat Index, i, buffer.ReadLong frmMain.lblCharStat(i).Caption = GetPlayerStat(MyIndex, i) Next ' Error handler Exit Suberrorhandler: HandleError "HandlePlayerStats", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```And this in HandlePlayer Data``` For x = 1 To Stats.Stat_Count - 1 frmMain.lblCharStat(x).Caption = GetPlayerStat(MyIndex, x) Next```![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) Link to comment Share on other sites More sharing options...
Synergy Posted May 10, 2013 Share Posted May 10, 2013 You might have to wait until someone more familiar with EO 3.0 gets on, I'm afraid. Link to comment Share on other sites More sharing options...
escfoe2 Posted May 10, 2013 Share Posted May 10, 2013 In the enumeration, how are your stats ordered? If strength is first, it is number 1\. Everything below it has a value equal to its position. So.. The For-Loop has to mock this. Please post your Enum and I will fix your Loop. Link to comment Share on other sites More sharing options...
DarkDino Posted May 10, 2013 Author Share Posted May 10, 2013 ``` Select Case PointType Case Stats.Strength Call SetPlayerStat(index, Stats.Strength, GetPlayerRawStat(index, Stats.Strength) + 1) sMes = "Strength" Case Stats.Endurance Call SetPlayerStat(index, Stats.Endurance, GetPlayerRawStat(index, Stats.Endurance) + 1) sMes = "Endurance" Case Stats.Intelligence Call SetPlayerStat(index, Stats.Intelligence, GetPlayerRawStat(index, Stats.Intelligence) + 1) sMes = "Intelligence" Case Stats.Agility Call SetPlayerStat(index, Stats.Agility, GetPlayerRawStat(index, Stats.Agility) + 1) sMes = "Agility" Case Stats.Willpower Call SetPlayerStat(index, Stats.Willpower, GetPlayerRawStat(index, Stats.Willpower) + 1) sMes = "Willpower" End Select```Default NumerationSTR 1DEX 2INT 3AGI 4WILL 5 Link to comment Share on other sites More sharing options...
escfoe2 Posted May 10, 2013 Share Posted May 10, 2013 Alright, now check your label index's. Making sure the label for strength has an index of 1 and so on and so forth. I'm guessing your strength is 0\. Which the bug you described means all of the index's are screwed up by one value. Link to comment Share on other sites More sharing options...
DarkDino Posted May 10, 2013 Author Share Posted May 10, 2013 STR Index 1DEX Index 2INT Index 3AGI Index 4WILL Index 5 ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png).. Link to comment Share on other sites More sharing options...
escfoe2 Posted May 10, 2013 Share Posted May 10, 2013 Are their names lblCharStat(Index)? Link to comment Share on other sites More sharing options...
DarkDino Posted May 10, 2013 Author Share Posted May 10, 2013 lblCharStat(1), lblCharStat(2), lblCharStat(3), lblCharStat(4), lblCharStat(5) ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) is Index, name from labels is lblCharStat Link to comment Share on other sites More sharing options...
escfoe2 Posted May 11, 2013 Share Posted May 11, 2013 The code you posted, is that the only code that includes lblCharStat. Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 Yes :S ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png), no is a problem from server? Link to comment Share on other sites More sharing options...
escfoe2 Posted May 11, 2013 Share Posted May 11, 2013 Add a break to[background=rgb(248, 248, 248)]SetPlayerStat Index, i, buffer.ReadLong[/background][background=rgb(248, 248, 248)]frmMain.lblCharStat(i).Caption = GetPlayerStat(MyIndex, i)[/background]Run your project and see what happens when you add a value. See what values are coming through.If you want to make it easier, change those two lines to this[background=rgb(248, 248, 248)]Dim Value as Long[/background][background=rgb(248, 248, 248)]SetPlayerStat Index, i, buffer.ReadLong[/background][background=rgb(248, 248, 248)]Value = [/background][background=rgb(248, 248, 248)]GetPlayerStat(MyIndex, i)[/background][background=rgb(248, 248, 248)]frmMain.lblCharStat(i).Caption = Value[/background]And only put a break on [background=rgb(248, 248, 248)]frmMain.lblCharStat(i).Caption = Value[/background]Then hover over 'Value' each time it breaks, making sure the values are coming through properly.If they don't come through properly, it's a problem in the server. I'll be back in a bit, going to grab a bite to eat. Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 No runtimes, Nothing happened D:, the problem is same ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) Link to comment Share on other sites More sharing options...
Zeno Posted May 11, 2013 Share Posted May 11, 2013 > In the enumeration, how are your stats ordered? If strength is first, it is number 1\. Everything below it has a value equal to its position. So.. The For-Loop has to mock this. Please post your Enum and I will fix your Loop.I'm still thinking this is what's up. I'd be surprised if an enumeration offset is caused by anything else.DarkDino, please post your version of this:```' Stats used by Players, Npcs and ClassesPublic Enum Stats Strength = 1 Endurance Intelligence Agility Willpower Skills ' Make sure Stat_Count is below everything else Stat_CountEnd Enum```for **both** client and server-side. You can find it in Mod Enumerations. So that we can better help, please don't simple state what it is - actually show the code. Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 Client```' Stats used by Players, Npcs and ClassesPublic Enum Stats Strength = 1 Endurance Intelligence Agility Willpower ' Make sure Stat_Count is below everything else Stat_CountEnd Enum```and Server D:```' Stats used by Players, Npcs and ClassesPublic Enum Stats Strength = 1 Endurance Intelligence Agility Willpower ' Make sure Stat_Count is below everything else Stat_CountEnd Enum``` Link to comment Share on other sites More sharing options...
Zeno Posted May 11, 2013 Share Posted May 11, 2013 Hmm… yeah everything seems good. May I see the stats part of the serverside code for Function PlayerData, and the full Sub SendStats? Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 ```Function PlayerData(ByVal index As Long) As Byte() Dim Buffer As clsBuffer, i As Long If index > MAX_PLAYERS Then Exit Function Set Buffer = New clsBuffer Buffer.WriteLong SPlayerData Buffer.WriteLong index Buffer.WriteString GetPlayerName(index) Buffer.WriteLong GetPlayerLevel(index) Buffer.WriteLong GetPlayerPOINTS(index) Buffer.WriteLong GetPlayerSprite(index) Buffer.WriteLong GetPlayerMap(index) Buffer.WriteLong GetPlayerX(index) Buffer.WriteLong GetPlayerY(index) Buffer.WriteLong GetPlayerDir(index) Buffer.WriteLong GetPlayerAccess(index) Buffer.WriteLong GetPlayerPK(index) Buffer.WriteLong GetPlayerClass(index) For i = 1 To Stats.Stat_Count - 1 Buffer.WriteLong GetPlayerStat(index, i) Next If Player(index).GuildFileId > 0 Then If TempPlayer(index).TmpGuildSlot > 0 Then Buffer.WriteByte 1 Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_Name Buffer.WriteLong GuildData(TempPlayer(index).TmpGuildSlot).Guild_Logo End If Else Buffer.WriteByte 0 Buffer.WriteLong 0 End If PlayerData = Buffer.ToArray() Set Buffer = NothingEnd Function``````Sub SendStats(ByVal index As Long)Dim i As LongDim packet As StringDim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong SPlayerStats For i = 1 To Stats.Stat_Count - 1 Buffer.WriteLong GetPlayerStat(index, i) Next SendDataTo index, Buffer.ToArray() Set Buffer = NothingEnd Sub```D: Link to comment Share on other sites More sharing options...
Zeno Posted May 11, 2013 Share Posted May 11, 2013 Hmm.. everything looks perfect. It must be some simple little thing.In handleplayerstats, try using index instead of myindex when setting the caption. Edit: I guess too in handleplayerdata.Oh, and if you're of these in HandlePlayerData that could also cause it.``` Buffer.WriteLong GetPlayerLevel(index) Buffer.WriteLong GetPlayerPOINTS(index) Buffer.WriteLong GetPlayerSprite(index) Buffer.WriteLong GetPlayerMap(index) Buffer.WriteLong GetPlayerX(index) Buffer.WriteLong GetPlayerY(index) Buffer.WriteLong GetPlayerDir(index) Buffer.WriteLong GetPlayerAccess(index) Buffer.WriteLong GetPlayerPK(index) Buffer.WriteLong GetPlayerClass(index)``` Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 same error :/ Link to comment Share on other sites More sharing options...
Zeno Posted May 11, 2013 Share Posted May 11, 2013 Sort of related, imo your handleplayerdata and handleplayerstats should just setplayerstats. Only Setplayerstats should do the label updating. I'd be surprised if this was causing in the error. I'm really not sure what's going wrong.Escfoe2 sagely recommended running with breaks, to which you replied there were no runtime errors… which doesn't make sense to me as a reply. Have you debugged with breaks before? Click on the thin gray column between the toolbox and your code and it will make a little burgundy circle. Your program will stop when it gets to that line. This allows you to check what variables are at certain points. I recommend placing the break just before your lbl.Caption. Then run it. When it stops, you can run it line-by-line by pressing f8\. Hover your mouse to check a variable's value. Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 I had not understood what to debug, now I do:```For x = 1 To Stats.stat_Count - 1```x = 6, Stats.stat_Count = 6```frmMain.lblCharStat(x).Caption = GetPlayerStat(Index, x)```x=6, Index = 1, x = 6Private Sub HandlePlayerStats```For i = 1 To Stats.stat_Count - 1```i = 0, Stats.stat_Count = 6```SetPlayerStat Index, i, Buffer.ReadLong```Index = 1, i = 1```frmMain.lblCharStat(i).Caption = GetPlayerStat(Index, i)```i = 1, index = 1, i = 1 Link to comment Share on other sites More sharing options...
Zeno Posted May 11, 2013 Share Posted May 11, 2013 Am I crazy for thinking the new mission is to find why/how i=0 in HandlePlayerStats. How the heck does that happen in a For i=1 loop? Link to comment Share on other sites More sharing options...
DarkDino Posted May 11, 2013 Author Share Posted May 11, 2013 How to find this ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png)? Link to comment Share on other sites More sharing options...
escfoe2 Posted May 11, 2013 Share Posted May 11, 2013 > Am I crazy for thinking the new mission is to find why/how i=0 in HandlePlayerStats. How the heck does that happen in a For i=1 loop?When a for-loop is first created the value of 'x' or whatever variable used has not yet been set. So it remains the default beginning value of 0.'CTRL+F' and search for lblCharStat in 'ProjectMake a note of every sub/function it appears in and post a reply of these sub/functions here. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now