1. Newbie Question
- Posted by Trixar_za Mar 26, 2009
- 794 views
Hey, I'm pretty new to coding and euphoria. So I would really appreciate help with the following:
I want to read from the input without stopping the process - how can I do this? For example, I'm creating a (very basic) MUD client, but it currently STOPS when I use gets(0)- and doesn't read from the socket unless I type something.
I'm using a mod of the irc_test.ew that came with euTCP4u if that helps.
Thanks in advance!
2. Re: Newbie Question
- Posted by euphoric (admin) Mar 26, 2009
- 827 views
I want to read from the input without stopping the process - how can I do this?
You'll need to put a get_key() inside your polling loop (get_key() doesn't wait for input). For example (pseudo-code):
while 1 do x = get_key() if x = RETURN_KEY then process(word) elsif x = DELETE_KEY word = word[1..$-1] elsif x = ESC_KEY then exit -- exits the primary polling/processing loop else word &= x end if process_mud_stuff() end while
3. Re: Newbie Question
- Posted by Trixar_za Mar 26, 2009
- 824 views
Thanks that solved it, now I just have to write it so I don't lose the first character (or make it process all characters before the return key) - but I think I'll try working that out on my own :)
Thanks again :)