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

Buffer Variable not defined


Exvayate
 Share

Recommended Posts

First time dealing with buffers :P

Situation: 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 If
End Sub

I 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

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.
Link to comment
Share on other sites

@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

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...