Santini Posted July 18, 2012 Author Share Posted July 18, 2012 Hello,First of all I am using Eclipse 3.0 (Nightly Release).I created a new vital called hunger by going through the code and following how the hp and mp worked.and the new vital (hunger) worked perfectly. So I tried to create another vital called thirst following the exact same method as before but this time when I press start it come up with this error:Run-Time error '9':Subscript out of rangeWhen I press debug it highlights this line of code:HandleDataSub(SPlayerThirst) = GetAddress(AddressOf HandlePlayerThirst)Thanks for taking the time to read this post.Santini Link to comment Share on other sites More sharing options...
erkro1 Posted July 18, 2012 Share Posted July 18, 2012 Do you have a HandlePlayerThirst sub?And do you have SPlayerThirst in modEnumerations? Link to comment Share on other sites More sharing options...
Santini Posted July 18, 2012 Author Share Posted July 18, 2012 Yes and Yes.Here is the HandlePlayerThirst sub:>! Private Sub HandlePlayerThirst(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBuffer>! ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes data() Player(MyIndex).MaxVital(Vitals.Thirst) = Buffer.ReadLong Call SetPlayerVital(MyIndex, Vitals.Thirst, Buffer.ReadLong)>! If GetPlayerMaxVital(MyIndex, Vitals.Thirst) > 0 Then 'frmMain.lblHP.Caption = Int(GetPlayerVital(MyIndex, Vitals.HP) / GetPlayerMaxVital(MyIndex, Vitals.HP) * 100) & "%" frmMain.lblThirst.Caption = GetPlayerVital(MyIndex, Vitals.Thirst) & "/" & GetPlayerMaxVital(MyIndex, Vitals.Thirst) ' hp bar frmMain.imgThirstBar.Width = ((GetPlayerVital(MyIndex, Vitals.Thirst) / ThirstBar_Width) / (GetPlayerMaxVital(MyIndex, Vitals.Thirst) / ThirstBar_Width)) * ThirstBar_Width End If>! ' Error handler Exit Suberrorhandler: HandleError "HandlePlayerThirst", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd SubI have been trying to fix this error for ages. so hopefully someone will be able too. Link to comment Share on other sites More sharing options...
zerohero Posted July 19, 2012 Share Posted July 19, 2012 Do you have your 'SPlayerThirst' set up in the server correctly? If so post that too. Link to comment Share on other sites More sharing options...
Santini Posted July 19, 2012 Author Share Posted July 19, 2012 Here it is:>! Public Enum ServerPackets SAlertMsg = 1 SLoginOk SNewCharClasses SClassesData SInGame SPlayerInv SPlayerInvUpdate SPlayerWornEq SPlayerHp SPlayerMp SPlayerStats SPlayerData SPlayerMove SNpcMove SPlayerDir SNpcDir SPlayerXY SPlayerXYMap SAttack SNpcAttack SCheckForMap SMapData SMapItemData SMapNpcData SMapDone SGlobalMsg SAdminMsg SPlayerMsg SMapMsg SSpawnItem SItemEditor SUpdateItem SREditor SSpawnNpc SNpcDead SNpcEditor SUpdateNpc SMapKey SEditMap SShopEditor SUpdateShop SSpellEditor SUpdateSpell SSpells SLeft SResourceCache SResourceEditor SUpdateResource SSendPing SDoorAnimation SActionMsg SPlayerEXP SBlood SAnimationEditor SUpdateAnimation SAnimation SMapNpcVitals SCooldown SClearSpellBuffer SSayMsg SOpenShop SResetShopAction SStunned SMapWornEq SBank STrade SCloseTrade STradeUpdate STradeStatus STarget SHotbar SHighIndex SSound STradeRequest SPartyInvite SPartyUpdate SPartyVitals SQuestEditor SUpdateQuest SPlayerQuest SQuestMessage SSpawnEvent SEventMove SEventDir SEventChat SEventStart SEventEnd SPlayBGM SPlaySound SFadeoutBGM SStopSound SSwitchesAndVariables SMapEventData SChatBubble SSpecialEffect SPlayerHunger SPlayerThirst ' Make sure SMSG_COUNT is below everything else SMSG_COUNTEnd EnumThe error happens during Initializing TCP settings when loading the client.Thanks for trying to help. :) Link to comment Share on other sites More sharing options...
zerohero Posted July 19, 2012 Share Posted July 19, 2012 Sorry I meant actually in the server code do you have the functiona set up? If so can we see that Link to comment Share on other sites More sharing options...
Santini Posted July 19, 2012 Author Share Posted July 19, 2012 The only thing corresponding to SPlayerThirst on the server side is this:>! Sub SendVital(ByVal Index As Long, ByVal Vital As Vitals) Dim packet As String Dim Buffer As clsBuffer Set Buffer = New clsBuffer>! Select Case Vital Case HP Buffer.WriteLong SPlayerHp Buffer.WriteLong GetPlayerMaxVital(Index, Vitals.HP) Buffer.WriteLong GetPlayerVital(Index, Vitals.HP) Case MP Buffer.WriteLong SPlayerMp Buffer.WriteLong GetPlayerMaxVital(Index, Vitals.MP) Buffer.WriteLong GetPlayerVital(Index, Vitals.MP) Case Hunger Buffer.WriteLong SPlayerHunger Buffer.WriteLong GetPlayerMaxVital(Index, Vitals.Hunger) Buffer.WriteLong GetPlayerVital(Index, Vitals.Hunger) Case Thirst Buffer.WriteLong SPlayerThirst Buffer.WriteLong GetPlayerMaxVital(Index, Vitals.Thirst) Buffer.WriteLong GetPlayerVital(Index, Vitals.Thirst) End Select>! SendDataTo Index, Buffer.ToArray() Set Buffer = NothingEnd Sub Link to comment Share on other sites More sharing options...
Ruins of Hell Posted July 21, 2012 Share Posted July 21, 2012 Does the ServerPackets client-side match the ServerPackets server-side? 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