Realtime Chat Input
Posted: Thu Jan 18, 2007 9:04 am
In games like Half Life 2: Deathmatch, or any other multiplayer game, you can press a key combination to enter text, to send to other players... How do i go about updating a string with new keys entered, and control for backspace etc...
Ive tried using a thread with the following code (partial), but it crashes for some reason...
This function is called into a seperate thread when Control + C are pressed on the kryboard... "AddChat" points to another procedure which runs fine.
The Examine keyboard only runs once, either in the main loop or in this loop, depending on the value KeyLock.
Any suggestions?
Thanks
Mike
Ive tried using a thread with the following code (partial), but it crashes for some reason...
Code: Select all
Procedure ControlInput(a)
Repeat
ExamineKeyboard()
In$=KeyboardInkey()
If In$
TextInput$+In$
Debug In$
If KeyboardReleased(#PB_Key_Delete)
TextInput$=Left(TextInput$,Len(TextInput$)-1)
EndIf
EndIf
Until KeyboardPushed(#PB_Key_Return)
AddChat(UCase(Username)+": "+TextInput$,1)
Chat=0
Keylock=0
TextInput$=""
EndProcedure
The Examine keyboard only runs once, either in the main loop or in this loop, depending on the value KeyLock.
Any suggestions?
Thanks
Mike