Exvayate Posted December 4, 2011 Author Share Posted December 4, 2011 First time dealing with buffers :PSituation: I've made individual buttons to click for the 5 windows (ie:Inventory/Options/Spells/Char/Party) and I haven't tampered with any of the code besides the stock code for it to open a window then closing a previous one that was open.And for the reason for individual buttons is because I've created hotkeys and I don't know how to assign hotkeys to a case in an array and such. Trying to keep is as simple as possible for myself.So here's the code for the button to open the spells list:Private Sub picSpellButton_Click() If picSpells.Visible = False Then ' send packet Set Buffer = New clsBuffer Buffer.WriteLong CSpells SendData Buffer.ToArray() Set Buffer = Nothing ' show the window picSpells.Visible = True ' play sound PlaySound Sound_ButtonClick Else picSpells.Visible = False ' play sound PlaySound Sound_ButtonClick End IfEnd SubI have changed the color highlighted problem in vb6.I get the message: Error: Variable not defined.At first I thought it was because the code was no longer in the array, but I honestly don't know how to troubleshoot a problem that has to deal with an array.Thanks in advance! :] Link to comment Share on other sites More sharing options...
Robin Posted December 4, 2011 Share Posted December 4, 2011 You didn't dim the buffer. Go look at existing packet handlers.Also, don't build packets in control events. mod[Client/Server]TCP is used for that shit. Link to comment Share on other sites More sharing options...
Exvayate Posted December 8, 2011 Author Share Posted December 8, 2011 I wanted to figure this out on my own after you gave me this information and I did!I have found out how to dim the buffer:Dim Buffer As clsBufferDim i As LongThanks Robin! Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2011 Share Posted December 8, 2011 Well done. It took you 4 days to find some code I pointed out for you and you still managed to get it wrong.i is a completely different variable. Link to comment Share on other sites More sharing options...
Exvayate Posted December 9, 2011 Author Share Posted December 9, 2011 Well I was still able to load the spells onto the spell window? :SIs i a variable that corresponds with inventory?Looking at the array of imgButton()_ClickIt tells you that if any of the 6 are pressed, then it will proceed to:Dim Buffer As clsBufferDim i As LongAND THEN open the window that corresponds with the case number.I can't understand why it could be wrong. (Plus it's a simple copy+paste method)And from what I've seen, the code:Dim Buffer As clsBufferDim i As LongApplies to all 6 windows if one were to open.Pretty much all I am doing for my buttons, is that I am just seperating the commands in the cases and assigning them to seperate command buttons so I can implement Hotkeys. Link to comment Share on other sites More sharing options...
guzmanm Posted December 9, 2011 Share Posted December 9, 2011 @Exvayate:> Well I was still able to load the spells onto the spell window? :S> > Is i a variable that corresponds with inventory?> > Looking at the array of imgButton()_Click> > It tells you that if any of the 6 are pressed, then it will proceed to:> > Dim Buffer As clsBuffer> Dim i As Long> > AND THEN open the window that corresponds with the case number.> > I can't understand why it could be wrong. (Plus it's a simple copy+paste method)> And from what I've seen, the code:> > Dim Buffer As clsBuffer> Dim i As Long> > Applies to all 6 windows if one were to open.> > Pretty much all I am doing for my buttons, is that I am just seperating the commands in the cases and assigning them to seperate command buttons so I can implement Hotkeys.Everything you "dim" is a variable which you must define yourself, but Robin uses "Dim i As long" to handle stuff like: For i = 1 to MAX_CLASSES, blah blah blah, "Class" & i, in which i will be the amount of class number 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