How do you call DECIDE phrases

Hi,

I’m just helping a couple of students with a game they’re making. The aim of the game is to collect three statues, then put them on a shrine which opens up a secret lair beneath a Roman villa. A bit wacky, but I think that I’m fine with that part. They want to have a hint character who gives custom hints based on which statues have been collected. I’ve come up with a couple of ways to get this working BUT as I was working on it, I realized that I don’t really understand how to make DECIDE phrases operate.

In the code below, I created a custom ‘calculate’ command to do what I wanted DECIDE to do. When I had ‘decide which number is N-hint’ in the larger code block it didn’t seem to ever change from 0. When I tried to put a phrase ‘decide on N-hint;’ into the blocks about ‘After taking the x statue’, it threw an error. Thanks for the help if anyone can explain what I’m not understanding about DECIDE and how it works.

"Decide Test" by Mr B

Section - Talk to

Understand the commands "ask" and "tell" and "say" and "answer" as something new.
Understand "ask [text]" or "tell [text]" or "answer [text]" or "say [text]" as a mistake ("[talk to instead]").

Instead of asking someone to try doing something:
	say "[talk to instead][paragraph break]".
Instead of answering someone that something:
	say "[talk to instead][paragraph break]".

To say talk to instead:
	say "(To communicate in [story title], TALK TO a character.) "

Understand "talk to [someone]" as talking to. Understand "talk to [something]" as talking to. Talking to is an action applying to one visible thing.

Carry out talking to something which is not a person:
	say "The [noun] doesn't seem talkative right now."
	

Section - Decide Test

Atrium is a room. Salvius is a man in Atrium.

A statue is a kind of thing. Statue-count is a number variable. Statue-count is 0.

The Neptune statue, the Apollo statue and the Aphrodite statue are statues in Atrium.

TS-Aph is a truth state variable. TS-Nep is a truth state variable. TS-Apo is a truth state variable.
TS-Lair is a truth state variable.

After taking Aphrodite statue for the first time:
	now TS-Aph is true;
	calculate N-Hint;
	continue the action. 
	
After taking Neptune statue for the first time:
	now TS-Nep is true;
	calculate N-Hint;
	continue the action. 
	
After taking Apollo statue for the first time:
	now TS-Apo is true;
	calculate N-Hint;
	continue the action. 

N-Hint is a number that varies. N-Hint is 0.

Every turn:
	say "N-hint: [N-hint]."

To calculate N-Hint:
	if TS-Aph is true and TS-Nep is false and TS-Apo is false, now N-Hint is 1;
	if TS-Aph is false and TS-Nep is true and TS-Apo is false, now N-Hint is 2;
	if TS-Aph is false and TS-Nep is false and TS-Apo is true, now N-Hint is 3;
	if TS-Aph is true and TS-Nep is true and TS-Apo is false, now N-Hint is 4;
	if TS-Aph is false and TS-Nep is true and TS-Apo true, now N-Hint is 5;
	if TS-Aph is true and TS-Nep is false and TS-Apo true, now N-Hint is 6;
	if TS-Aph is true and TS-Nep is true and TS-Apo is true and TS-Lair is false, now N-Hint is 7;
	if TS-Aph is true and TS-Nep is true and TS-Apo is true and TS-Lair is true, now N-Hint is 8.
	
Instead of talking to Salvius:
	say "[Salvius-hint]"
	
To say Salvius-hint:
	if N-hint is 0:
		say "Get looking!";
	else if N-hint is 1:
		say "You've got Aphrodite!";
	else:
		say "Still got to write the rest..."
		

Decide-phrases return a value of some sort, so you generally want to do something with that value.

To decide what number is the total hints given:
    if the Apollo statue is handled, decide on 2;
    if the Aphrodite statue is handled, decide on 1;
    decide on 0.

To say Salvius hint:
    let the hint count be the total hints given;
    if the hint count is 0...
3 Likes

Thanks, that makes sense.

So ‘hint count’ is the temporary variable and then it connects to the decision phrase of ‘total hints given’?

Do people generally use that format of ‘let temp variable be the decision variable’ to call it up?

Just trying to get my head straight on this!

In general it’s good to assign a calculated value to a temporary variable if you’re going to use the value multiple times, especially if the value is expensive to compute, such as values requiring traversing the map.

1 Like

Yep! But you absolutely don’t have to:

if the total hints given is 0:

Or:

if the total hints given is:
    -- 0: effect;
    -- 1: effect;
    otherwise: effect;
1 Like