Exvayate Posted December 8, 2011 Author Share Posted December 8, 2011 Damn I ask a bunch of questions. But it's okay because this can help the community as well!So here I have created a command which toggles the window on picInventory:```Private Sub picInvButton_Click() If picInventory.Visible = False Then ' show the window picInventory.Visible = True BltInventory ' play sound PlaySound Sound_ButtonClick Else picInventory.Visible = False ' play sound PlaySound Sound_ButtonClick End IfEnd Sub```Here I have set the hotkey in which executes the previous window toggling command:```Private Sub picInvButton_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyI Then picInvButton_Click End IfEnd Sub```But when I login to my game and immediately press the hotkey, I, it does NOT open picInventory like I told the program to.However when I click on the button to open picInventory AND THEN press the hotkey, I, only then will the hotkey toggle the Inventory window.I have also created hotkeys for the other buttons for the other windows (Spells/Options/Character/Equipment)But the same situation occurs, where those windows cannot be toggled unless they've been previously clicked.ALSO! After clicking all of the windows to be able to "set" the hotkeys, will NOT allow you to press hotkey I and then S to toggle both windows. So the ONLY way the window can be toggle is clicking it first, then press the key. Then if you wanted to toggle another window, you HAVE to do the same process.I could use some help on how I can be able to press the keys and have all of them toggle as SOON as I enter the game. Link to comment Share on other sites More sharing options...
Richy420Rich Posted December 8, 2011 Share Posted December 8, 2011 Edited: Sorry man, I was about to edit this and then my internet dropped, I misread your question..You need to call for the hotkeys inside the picscreen (Which picscreen is already is calling hotkeys inside modInput - CheckInputKeys … Which you can place your code inside.)But as well, you have to make the Private declarations Public of all of your buttons.Such as Private Sub picInvButton_Click()Would be Public Sub picInvButton_Click()And repeat that for all of the private subs you're trying to call from the module. Link to comment Share on other sites More sharing options...
Exvayate Posted December 8, 2011 Author Share Posted December 8, 2011 Hmm I've been searching via GoogleAnd they say you have to set their key previews to true soKeyPreview = True[insert technical stuff here]But I did that and inserted it to each individual hotkey command and nothing was different. Link to comment Share on other sites More sharing options...
Exvayate Posted December 9, 2011 Author Share Posted December 9, 2011 I placed my code, under ModInput > CheckInputKeysAs well as changing all private subs to public```KeyPreview = True If KeyCode = vbKeyI Then picInvButton_Click End If```And it gave me error: variable undefinedI even tried mimiciing robin's stick code like this:``` If GetKeyState(vbKeyI) < 0 Then picInvButton_Click = True End If```Whyyyyy am I not doing this right? -_- Link to comment Share on other sites More sharing options...
erkro1 Posted December 9, 2011 Share Posted December 9, 2011 I think you can only call a click event by clicking it, just make a new sub with :```If picInventory.Visible = False Then ' show the window picInventory.Visible = True BltInventory ' play sound PlaySound Sound_ButtonClick Else picInventory.Visible = False ' play sound PlaySound Sound_ButtonClick End If```in it and make it call that sub, that must work. Link to comment Share on other sites More sharing options...
blkcrow Posted December 9, 2011 Share Posted December 9, 2011 you have declared sub picInventoryButton as private change it to public 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