So I have an poison apple. The player can eat it, but of course they’ll die. I’m not exactly sure I’m using dangerous correctly here. It really doesn’t seem to do anything but suppress a bare ‘eat’ command with no direct object.
What I’d really like to do is present the actor with an “Are you sure?” message before they continue.
I looked over the documentation, but the topics covering dangerous are pretty thin.
Thanks in advance!
++ apple: Food, Thing 'apple' 'apple'
"The apple is so pretty, it looks as though it was plucked from the Garden of Eden.
Actually, it looks a little too perfect. "
dobjFor(Eat)
{
verify()
{
dangerous;
}
action()
{
"Not only did it look good, it was full of poison. ";
finishGameMsg(ftDeath, [finishOptionCredits]);
}
}
;
Right, dangerous isn’t exactly what you want, though it’s not a bad idea to have it too.
It’s a little hard to find unfortunately, but T3 has a global function yesOrNo (look in the symbols index of the Library Reference Manual).
If you’re having trouble finding something in the docs another good resource is the old newsgroup. You can search here too of course but the newsgroup has more T3 topics, since it’s been around longer, so I usually try that first.
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
versionInfo: GameID
IFID = 'foo'
;
gameMain: GameMainDef
initialPlayerChar = me
;
startRoom: Room 'The Cottage'
;
+ me: Actor
;
++ apple: Food 'apple' 'apple'
"The apple is so pretty, it looks as though it was plucked from the Garden of Eden.
Actually, it looks a little too perfect. "
dobjFor(Eat)
{
verify()
{
dangerous;
}
check()
{
"Are you sure? ";
if(!yesOrNo()) failCheck('You have second thoughts. ');
}
action()
{
"Not only did it look good, it was full of poison. ";
finishGameMsg(ftDeath, [finishOptionCredits]);
}
}
;
Note that the IF newsgroups (rec.arts.int-fiction and rec.games.int-fiction) are quite dead by now. Only a few people follow them these days. They’re still good for searching though.
Nikos, when I was searching the newsgroup I came across an old (2003?) T3 example you posted for this very subject, but the download link was long gone. I was wondering if you still have that source lying around and if it works more or less with the latest T3, maybe you could post it?
I’m attaching the file. It’s still from 2003, and it still works as intended (as far as I can tell.) The forum doesn’t allow uploading of Tads source code (*.t files), so I’ve renamed it to *.txt.
There’s also a very similar module at the archive. That one also allows “maybe” as an answer. You can find it in the “examples” directory: ifarchive.org/if-archive/pro … /examples/
Simply pick what works for you ncYesNo.txt (5.44 KB)