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

[EO] Frame hide/show *Minor Fix


edsantana
 Share

Recommended Posts

**Objective :** Hide and Show the  Inventory/Party

Hello guys.
This little code modification is just it, small and simple, so it can help any new comer and people who are just starting to take the first steps in Vb.

This follows the Logic Line of many games out there. If you click a button it shows you a frame, if you click the same button, while the same frame is open, it closes it. 

**Logic path  :**
" if not picX.Visible then  picX.visible = True 
Else 
if picX.Visible then picX.visible = False
End if
End if"

**The Code :**  _*note this is all done client side *_
Open your **frmMAIN** (code)  and find the **imgButton_Click** private sub.
Find the select case within the sub and replace with the following code.

```
Select Case Index
        Case 1
            If Not picInventory.Visible Then
                ' show the window
                picInventory.Visible = True
                picCharacter.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
                BltInventory
                ' play sound
                PlaySound Sound_ButtonClick
            Else
            If picInventory.Visible Then
                'hide the window
                picInventory.Visible = False
                picCharacter.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
            End If
            End If
        Case 2
            If Not picSpells.Visible Then
                ' send packet
                Set Buffer = New clsBuffer
                Buffer.WriteLong CSpells
                SendData Buffer.ToArray()
                Set Buffer = Nothing
                ' show the window
                picSpells.Visible = True
                picInventory.Visible = False
                picCharacter.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
                ' play sound
                PlaySound Sound_ButtonClick
                    Else
                If picSpells.Visible Then
                ' Hide the window
                picSpells.Visible = False
                picInventory.Visible = False
                picCharacter.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
                    End If
            End If
        Case 3
            If Not picCharacter.Visible Then
                ' send packet
                SendRequestPlayerData
                ' show the window
                picCharacter.Visible = True
                picInventory.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
                ' play sound
                PlaySound Sound_ButtonClick
                ' Render
                BltEquipment
                BltFace
            Else
                If picCharacter.Visible Then
                ' Hide Window
                picCharacter.Visible = False
                picInventory.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
                End If
            End If
        Case 4
            If Not picOptions.Visible Then
                ' show the window
                picCharacter.Visible = False
                picInventory.Visible = False
                picSpells.Visible = False
                picOptions.Visible = True
                picParty.Visible = False
                ' play sound
                PlaySound Sound_ButtonClick
            Else
                If picOptions.Visible Then
                ' Hide window
                picCharacter.Visible = False
                picInventory.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False

            End If
            End If
        Case 5
            If myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex Then
                SendTradeRequest
                ' play sound
                PlaySound Sound_ButtonClick
            Else
                AddText "Invalid trade target.", BrightRed
            End If
        Case 6
            If Not picParty.Visible Then
                ' show the window
                picCharacter.Visible = False
                picInventory.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = True
                ' play sound
                PlaySound Sound_ButtonClick
            Else
                If picParty.Visible Then
                ' Hide Window
                picCharacter.Visible = False
                picInventory.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False

            End If
            End If

    End Select
```
et voila ! its done. Compile and test it.  remember allways keepbackups, if you fail try again.

*Hardcore members, please forgive me if this is a repost, and if you find any errors please tell me .

Have Fun.  ;)
Link to comment
Share on other sites

You dont need all that code take a look at my PicInventory:                                                                  picInventory.Visible = Not picInventory.Visible
                picCharacter.Visible = False
                picSpells.Visible = False
                picOptions.Visible = False
                picParty.Visible = False
                BltInventory
                ' play sound
                PlaySound Sound_ButtonClick
Link to comment
Share on other sites

This will allow you to Open your picInventory, And then close it, the way your doing it is wrong, Using this way is more efficient, and This line:picInventory.Visible = Not picInventory.Visible Tells the client if its open, then if clicked again then it will close it.
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...