Does anyone know if this extension is still viable, dated 12/19/17? Although the documentation is good, I cannot get it to work as advertised. I have seen that a couple other people are having trouble with it.
Yes, I am running Glulx.
Data is a kind of value. The data are teamSize, name, sex, class, dex, and complete.
Stage is data that varies.
Gathering is a scene. Gathering begins when location is lobby.
Gathering ends when stage is complete.
When Gathering begins:
now stage is teamSize;
Every turn during Gathering:
if stage is teamSize:
now current question is "How many adventureres will be going on this mission?";
now current prompt is "Enter a number between 1 and 4: ";
ask an open question, in number mode;
now stage is name;
else if stage is name:
now current question is "";
now current prompt is "What is the player's name? ";
ask an open question, in text mode;
A number question rule (this is the count players rule):
if stage is teamSize:
if the number understood is greater than 4:
say "Sorry. This mission cannot accommodate more than four adventurers.[line break]";
retry;
if the number understood is less than 1:
say "Let's try to be realistic about this.";
retry;
now the nbrAdventurers is the number understood;
say "OK. Your squad consists of [teamSize] adventurers.";
exit.
After the data is entered, the echo check SAY âOKâŚâ is not printed. Iâm not sure that the number question rule is even executed.
Sorry I think I misunderstood your problem. Could you post a complete example of the code that wonât work? I tried working with your incomplete code up there, but I encountered a different problem, and Iâm not sure if I filled in the holes wrong.
Youâre proceeding too early to the next stage. If you move the line ânow stage is nameâ from where it currently is (directly after the âask an open question, in number modeâ line) to right before the âexitâ line (which is when you are ready to proceed), then it works, or at least it did so for me in a short test.
So, like this (excerpt, relevant parts marked with comments):
Every turn during Gathering:
if stage is teamSize:
now current question is "How many adventureres will be going on this mission?";
now current prompt is "Enter a number between 1 and 4: ";
ask an open question, in number mode;
[now stage is name;] [<- remove it from here]
else if stage is name:
.......
A number question rule (this is the count players rule):
if stage is teamSize:
if the number understood is greater than 4:
say "Sorry. This mission cannot accommodate more than four adventurers.[line break]";
retry;
if the number understood is less than 1:
say "Let's try to be realistic about this.";
retry;
now the nbrAdventurers is the number understood;
say "OK. Your squad consists of [teamSize] adventurers.";
now stage is name; [<- move it here]
exit.
Yes, I moved it and it worked. This whole extension seems like it either uses concurrent processing or takes advantage of Inform using concurrent processing, and yet I think neither does. It makes it very hard to think through coding problems.
Here is a new problem: duplicate questions which should not occur at all.
After looking for the first time:
now stage is teamSize;
Every turn:
if stage is teamSize:
now current question is "How many adventurers will be going on this mission?";
now current prompt is "Enter a number between 1 and 4: ";
ask an open question, in number mode;
if stage is name:
now current question is "";
now current prompt is "What is the name of player 1? "; ask an open question, in text mode;
A number question rule when stage is teamSize:
say "Runnning number question rule. Stage = [stage][line break]";
if the number understood is greater than 4:
say "Sorry. This mission cannot accommodate more than four adventurers.[line break]";
retry;
if the number understood is less than 1:
say "Let's try to be realistic about this.";
retry;
now the nbrAdventurers is the number understood;
say "OK. Your squad consists of [nbrAdventurers] adventurers.";
now stage is name;
exit.
Note two things:
[1] Despite the âfirst turnâ conditional, I am required to type something into the first prompt before the questions start.
[2] The âcurrent questionâ is printed twice, and I cannot set the reason for this at all.
The output is shown below.
I added a âstop the actionâ command at the end of the teamSize block in the âEvery turnâ rule and it removed the duplicate question. Perhaps that will need to be added for each different stage value.
In your second code snippet, thereâs a spot with two statements on the same line, separated by tabs. Itâs the last line in this part:
if stage is name:
now current question is "";
now current prompt is "What is the name of player 1? "; ask an open question, in text mode;
This throws Inform off, and seems to cause the âduplicate questionâ behaviour. When you put the âask ...â part on the next line, it works correctly and only asks the (previous) question once:
if stage is name:
now current question is "";
now current prompt is "What is the name of player 1? ";
ask an open question, in text mode;
I think this has to do with the way the âevery turnâ rules and the implicit looking action on the first turn work, and so on. One way to get the desired output would be to move the first question directly into the âAfter looking for the first time:â rule, like this:
After looking for the first time:
now stage is teamSize;
now current question is "How many adventurers will be going on this mission?";
now current prompt is "Enter a number between 1 and 4: ";
ask an open question, in number mode;
Output:
Release 1 / Serial number 240331 / Inform 7 v10.1.2 / D
Lobby
A lobby where adventurers gather.
How many adventurers will be going on this mission?
Enter a number between 1 and 4: 3
OK. Your squad consists of 3 adventurers.