advice on how to do something in Inform 7

Games in project or under development. The posts and games in this section can not ask for money.

advice on how to do something in Inform 7

Postby lamont Sanford » Sat, 12Mar03 05:11

First off a quick bit of backstory. I have been working on something for awhile and began running into compiling errors due to the amount of figures used, the bug report is filed. Anyway I decided to break the project up into 2 pieces. The game takes place over the course of a week beginning on monday and ending on friday. I broke part 1 up from mon- weds night and part 2 picking up on thurs morning. Ok now the problem is that actions you do or do not do during the earlier days directly or indirectly affect how things play out later so to carry settings over to the second part I decided to spit out a few passwords at the end of part 1 that you will then enter at the start of part 2 and these will carry settings over. The one problem I couldnt figure how to do is to bring the amount of money you have on you across but I will fudge my way through with that,

NOW, here is the problem I am now trying to do this but im not sure how, This is what I have at the moment.

Code: Select all
pregame is a scene.
pregame begins when play begins.

starting location is a room.

when play begins:
   now the player is in starting location.

when play begins:
   say "[paragraph break][paragraph break]Please enter the words listed at the end of (games name) below."

When play begins:
   change the command prompt to "Please enter first word > "
   
   
First Password is an indexed text that varies. Second Password is an indexed text that varies.  Third Password is an indexed text that varies. Fourth Password is an indexed text that varies. Fifth Password is an indexed text that varies.



To decide whether collecting First Password:
   if the command prompt is "Please enter first word > ", yes;
   no.

To decide whether collecting Second Password:
   if the command prompt is "Please enter second word > ", yes;
   no.

To decide whether collecting Third Password:
   if the command prompt is "Please enter third word > ", yes;
   no.

To decide whether collecting Fourth Password:
   if the command prompt is "Please enter fourth word > ", yes;
   no.

To decide whether collecting Fifth Password:
   if the command prompt is "Please enter fifth word > ", yes;
   no.




After reading a command when collecting first password:
   if the the player's command is "monkey":
      say "[paragraph break] Thank you.";
   change the command prompt to "Please enter second word";
   (here I would make changes that the entered password would cause).


so if theres 5 passwords and about 5 choices for each of the passwords how would I actually code that out?

Thanks alot
lamont Sanford
star of the reef
 
Posts: 327
Joined: Fri, 11Mar11 00:00

Re: advice on how to do something in Inform 7

Postby Squeeky » Sat, 12Mar03 06:57

Are you allowed a programming structure like that below?
Javascript for instance allows an "IF" structure using the keywords SWITCH and CASE.

Basically the structure is:
myVariable = "xxxxxxx"
switch (myVariable)
case "babe":
some form of action;
break;
case "bed":
some form of action;
break;
default:
action might be "try again".

I'm not going to try to be more precise as inform may not allow whatever I might propose (that said, I've use that structure previously but not under Javascript in a BASIC context quite some years ago). I suggest that you use "select case" or "switch" in a search engine. If javascript does in fact apply add that into the search.

Note my advice is that of a very low level amateur! :crazy:
Squeaky is clean, I'm just a tad messy!
User avatar
Squeeky
Spirit of the oceans
 
Posts: 4169
Joined: Mon, 08Jan07 00:00
Location: Australia
sex: Masculine

Re: advice on how to do something in Inform 7

Postby bosbrand » Sat, 12Mar03 08:16

I found the following example:

if X is:

-- 1: say "A switch statement masquerades as an if statement. 'Unless' cannot be used.";
-- 2: say "Python style only.";
-- otherwise: say "There is no fall-through between cases, and no goto to restore it.";

in this Inform 7 tutorial.
bosbrand
great white shark
 
Posts: 41
Joined: Sun, 11Mar27 23:00

Re: advice on how to do something in Inform 7

Postby lamont Sanford » Sat, 12Mar03 21:41

Thanks for the replies. Looks like I was 1 word off. changing

> After reading a command when collecting first password:
> if the the player's command is "monkey":

to

> After reading a command when collecting first password:
> if the the player's command matches "monkey":

does the trick.
lamont Sanford
star of the reef
 
Posts: 327
Joined: Fri, 11Mar11 00:00


Return to Projects

Who is online

Users browsing this forum: No registered users and 12 guests

cron
eXTReMe Tracker