1. Newbie Question

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!

new topic     » topic index » view message » categorize

2. Re: Newbie Question

Trixar_za said...

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 
new topic     » goto parent     » topic index » view message » categorize

3. Re: Newbie Question

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 :)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu