edsantana Posted May 15, 2011 Author Share Posted May 15, 2011 **Objective :** Hide and Show the Inventory/PartyHello 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 = FalseEnd ifEnd 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 More sharing options...
Grimnnak Posted May 16, 2011 Share Posted May 16, 2011 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 More sharing options...
edsantana Posted May 16, 2011 Author Share Posted May 16, 2011 im sorry but dont you have to create two conditions (if/else) one for each state of the frame?from the way i see your code. its just a loop. can you explain more ? Link to comment Share on other sites More sharing options...
Grimnnak Posted May 16, 2011 Share Posted May 16, 2011 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 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