Newsgroups: rec.arts.int-fiction
From: Suzanne Britton <tril@igs.net>
Subject: Re: [TADS]Accepting an arbitrary response to a question
References: <dedc0c7d.0111040617.be352e5@posting.google.com>
Message-ID: <slrn9uc6cu.1a4.tril@miranda.igs.net>
User-Agent: slrn/0.9.7.2 (Linux)
NNTP-Posting-Host: 216.58.91.200
Date: 4 Nov 2001 22:35:09 -0600
X-Trace: corp.newsgroups.com 1004934909 216.58.91.200 (4 Nov 2001 22:35:09 -0600)
Lines: 33
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support,  spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse@newsfeeds.com>
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 80,000+ UNCENSORED Newsgroups.
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!corp.newsgroups.com
Xref: news.duke.edu rec.arts.int-fiction:94328

> I'm writing a TADS game in which there are several sections where the
> player has to answer questions (such as "what is your name?"). I want
> the player to be able to give any answer he or she wants and the game
> to react to it (i.e. if the player answers "John", the response will
> be "Hello, John". If he answers "examine man", the repsonse will be
> "That's a strange name...").

Probably the best way is to use the input function, bypassing the parser
completely. Make sure to use a special prompt so the player knows that what he
types will not be parsed normally. ">>" is somewhat traditional for this.

get_color: function {
    local answer;

    "What is your favorite color?\n
    >> ";
    answer := input();
    // etc...
}

Suzanne

--
tril@igs.net - http://www.igs.net/~tril/
"I'm aware of that, sweetheart. It's just that when I wake up to a hissing
goat skull on my nightstand, and it hops off and runs across the floor on
spider legs, I sleep a lot better knowing where it ran off to."
                                                          - Ted (Red Meat)


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----
