Soaps Posted June 24, 2011 Author Share Posted June 24, 2011 Howdy all. im a bit new to doing the scriping stuff, but im willing to learn and so far ive been pritty good at adding scripts that people have already made.any way i wanted to make a part in my game so players would have to press enter to begin typing then enter again to send the text. this is so i can use other keys make hotkeys for things with out every one always spraying gipperish from button mashing.im still learning my way around VB6 and EO's scource code. so ill probably be asking alot of questions that are simple for every one else. i apologize in advanced.Thanks for the helpEDIT: it would also be ok if the had to press T to chat then enter to send, instead if that makes it easyer. Link to comment Share on other sites More sharing options...
jcsnider Posted June 24, 2011 Share Posted June 24, 2011 Well, here is how to do it.. I am sure there is an easier way but in VB.Net you have a .Focused property for the chatbox telling you if it has focus or not. In vb6 you will need to define a boolean, for the chatbox focus. So place this in modGlobals.```Public chaton as boolean```Now, run over to Public Sub SetFocusOnChat()Replace the whole sub with these two subs.```Public Sub SetFocusOnChat() If Chaton = False Then SetFocusOnGame Exit Sub End If On Error Resume Next 'prevent RTE5, no way to handle error frmMain.txtMyChat.SetFocusEnd SubPublic Sub SetFocusOnGame() If Chaton = True Then SetFocusOnChat Exit Sub End If On Error Resume Next 'prevent RTE5, no way to handle error frmMain.picScreen.SetFocusEnd Sub```Now, find:```If LenB(ChatText) = 0 Then Exit Sub```and replace it with this…```If LenB(ChatText) = 0 Then If KeyAscii = vbKeyReturn Then Chaton = Not Chaton SetFocusOnGame End If Exit Sub End If If Chaton = False Then Exit Sub```Lastly, find these lines of code```' Handle when the player presses the return key If KeyAscii = vbKeyReturn Then```and directly under them add```Chaton = False SetFocusOnGame```Some of this code is messy and I know there are other/better ways of accomplishing this but this works. You simply hit enter, type, and enter again when done.Lemme know if you have any problems. Link to comment Share on other sites More sharing options...
Soaps Posted June 24, 2011 Author Share Posted June 24, 2011 It worked beautifully. Thanks for the help i had no idea how to go about doing somthing like that :DEDIT: i noticed if you press Enter then type it'll still effect what the player dose. so will i have to setup a Boolean for every Key i Setup? if so thats easy enough now that i know a bit more about what im doing.thanks again Link to comment Share on other sites More sharing options...
jcsnider Posted June 25, 2011 Share Posted June 25, 2011 No, not a Boolean for every key. The only Boolean that we used was to tell the client if the chatbox had focus or not because there was no property from the chatbox itself. As for the enter key still affecting item pickup you will want to use space.Find this,```If GetKeyState(vbKeyReturn) < 0 Then CheckMapGetItem End If```replace it with this…```If GetKeyState(vbKeySpace) < 0 And chaton = False Then CheckMapGetItem End If``` Link to comment Share on other sites More sharing options...
Soaps Posted June 25, 2011 Author Share Posted June 25, 2011 will do. but if i set move ment to WASD, if i enter chat mode by pressing enter then iff you type any words with WASD in them then the caracter still moves so i was thinking of somthing likeIf chaton = False Then 'Move Up If GetKeyState(vbKeyW) < 0 Then DirUp = True DirDown = False DirLeft = False DirRight = False Exit SubOr somthing like that Link to comment Share on other sites More sharing options...
jcsnider Posted June 25, 2011 Share Posted June 25, 2011 Yes, that is correct/would work ;) Link to comment Share on other sites More sharing options...
Soaps Posted June 25, 2011 Author Share Posted June 25, 2011 thanks again for all the help. 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