Re: [CODE] Line input function

From: Patrick Dughi (
Date: 06/07/01

> i am using Circle30bpl18 and i need a function do get input directly
> from the user like the string_write procedure, but it should only get
> ONE line. And then return the results.
> usersname = line_input("Give me your name: ");
> send_to_char(usersname,ch);
> the output should be
> Give me your name: Jim (the users input)  Jim
        Yeah. This is an easy thing to do in a system where you don't use
polling to select input.  However, you can't do this in circlemud. At
least, not like you're thinking.

        Because if you were to get it to work, it would suspend execution
of the entire mud UNTIL that player hit return.  That's why you can't use
things like 'scanf' in your code.

        Instead, what you have to do is jump though a series of hoops, and
you'll end up with something akin to what goes on in the login sequence.

In general, it goes like this:

1       Display a (blocking) message requiring a response
2       Switch the user's STATE to a _new_ CON_ state.
3       When the user next types something out/hits return, that state
           will be evaluated in the interpreter.
4       repeat steps 2-4 as needed.
5       Switch the users STATE back to CON_PLAYING to allow them
        to continue normally.

        Just a quick note; even though the user has a different state of
connection doesn't mean that he's not actually around.  His avatar is
still wherever it was left, subject to being killed, or summoned, etc.

        Sooooo, if you have a special option like that, you _may_ want to
limit it to silent, nomagic, no summon, no mob, etc rooms.


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST