Newsgroups: rec.arts.int-fiction
Path: gmd.de!nntp.gmd.de!xlink.net!howland.reston.ans.net!newsserver.jvnc.net!raffles.technet.sg!ntuix!ntuvax.ntu.ac.sg!bh7113977
From: bh7113977@ntuvax.ntu.ac.sg (Teo Kwang Liak)
Subject: Re: INFORM question
News-Software: VAX/VMS VNEWS 1.41    
Sender: news@ntuix.ntu.ac.sg (USENET News System)
Nntp-Posting-Host: v9000.ntu.ac.sg
Organization: Nanyang Technological University - Singapore
Message-ID: <5JUL199400025737@ntuvax.ntu.ac.sg>
References: <2v73rp$hma@ucunix.san.uc.edu> <2v87al$afe@newsstand.cit.cornell.edu>
Date: Mon, 4 Jul 1994 22:02:00 GMT
Lines: 55

In article <2v87al$afe@newsstand.cit.cornell.edu>, Collin Pieper <clp5@cornell.edu> writes...
>In article <2v73rp$hma@ucunix.san.uc.edu> Andrew P. Vogel,
>vogelap@ucunix.san.uc.edu writes:
>>Hi everyone. I would like to have my Inform game ask the user first
>thing 
>>if they'd like to restore a game, but am having some trouble making it 
>>work properly.
>>
>>Within Initialize I want to prompt for 'Would you like to restore a
>game? 
>>Y/N' and then based on the answer call the RESTORE or the start of the 
>>game. Could someone suggest how to code this?
>>
> 
>Here's a little code that should do the trick.  It's pretty much stolen
>from Graham's library code...
> 
>[ RestoreSample i;
>    print "Would you like to restore a game? >";
>    for(::)
>    {   read buffer parse;
>        i = parse-->1;
>        if (i==#w$yes or #w$y) RestoreSub();
>        if (i==#w$no or #w$n) rtrue;
>        print "Please answer yes or no. >"; 
>    }
>];
> 
>[ Initialise;
>  RestoreSample();
>  location = Blank_Room;
>  print "^^^^^Welcome to the shell...^^";
>];
> 
>This just loops until the an appropriate response and then calls the
>library's restore routine.
> 
>Collin
> 

I haven't tried the above code yet, but shouldn't the "location" statement
be placed before the "RestoreSample()" call? 

Another way (this one makes use of Graham's Standard VerbLib libarary),

[ Initialise;
  location = Start_Room  ! Put the game's initialise commands here
  print "Would you like to restore a game? >";
  if (YesOrNo()==1)  ! YesOrNo check for yes/no (returns 1 for yes, 0 for no)
    <Restore>;  ! Execute the restore command
  else
    print "^^The introduction^^";   ! otherwise print the introduction
];

Teo Kwang Liak
