intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Nov 18, 2018 2:35 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 06, 2018 11:02 pm 
Offline

Joined: Sun Aug 19, 2018 3:04 pm
Posts: 20
Hey, y'all!

I'm working on a small program for a friend, sort of a quiz review-type thing.

Is there any way for me to have certain prompts, as in an object does "say 'what is 2+2'", then whatever you type next will be compared to the true answer. If correct, the next problem will be displayed, such as 4+4, but if that is failed, the program returns to asking what 2+2 is. It should end after several questions with a variable changing from false to true.

If anyone knows how I would go about this, I'd be very thankful.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Sep 06, 2018 11:16 pm 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 298
Location: Michigan
The Questions extension?

http://inform7.com/extensions/Michael%2 ... oc_26.html

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Sep 08, 2018 10:39 am 
Offline

Joined: Fri Aug 05, 2016 2:46 pm
Posts: 29
Another way would be to check the command prompt.
Code:
When play begins:
 now the command prompt is "what is 2+2? >"

After reading a command when the command prompt is "what is 2+2? >":
 if the player's command matches the regular expression "4|four":
  say "correct!";
  now the command prompt is "what is 6*8? >";
 otherwise:
  say "Incorrect!";
 reject the player's command.

Sorry about possible errors. I'm on my phone.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group