Help "building a statue"

Okay I’m dumb, but I can’t make this work.

In my game you’re bringing sets of blocks (“BLEGOS”, a LEGO parody) to an NPC which he adds to the statue on the couch next to him until it is complete (and then you win). There are 12 sets of blocks, therefore there are 13 different statues in different stages of completion. statue1, statue2 etc are “statues” and Duchess’ blocks, Cracker’s blocks etc are “blegos”. All I can come up with is something like:

Carry out giving blegos to Bloo: say "'Hey, thanks man!' quips Bloo, taking the blocks from you and sticking them onto the statue."; if the couch contains the statue1 begin; remove statue1 from play; move statue2 to the couch; end if; if the couch contains the statue2 begin; remove statue2 from play; move statue3 to the couch; end if;

(and so on)

Or:

[code]Every turn while the statue1 is on the couch:
Carry out giving blegos to Bloo:
say “‘Hey, thanks man!’ quips Bloo, taking the blocks from you and sticking them onto the statue.”;
remove statue1 from play;
move statue2 to the couch.

Every turn while the statue2 is on the couch:
Carry out giving blegos to Bloo:
say “‘Hey, thanks man!’ quips Bloo, taking the blocks from you and sticking them onto the statue.”;
remove statue2 from play;
move statue3 to the couch.[/code]

both of which results in a chain reaction when you give him one set of blegos where all the statue objects swap one after the other, finalising in the statue13 being on the couch and the game ending. I only want one replacement to happen each time you give Bloo some blegos. :neutral_face: I thought the second example would have worked, but no. I feel dumb because this is probably something easy, but I can’t figure it out. (I also don’t know how to remove the blegos you just gave to Bloo from play, although Bloo’s possessions are concealed so it looks fine and I’m not sure it’s important.) Thanks.

That happens because the game first checks if there’s a statue1 on the couch. If there is, it replaces it with statue2. Then it checks if there’s a statue2 on the couch, which there again is, because it was just put there. The easiest solution is to add ‘otherwise’, which prevents this:

Carry out giving blegos to Bloo: say "'Hey, thanks man!' quips Bloo, taking the blocks from you and sticking them onto the statue."; if the couch contains the statue1 begin; remove statue1 from play; move statue2 to the couch; otherwise if the couch contains the statue2; remove statue2 from play; move statue3 to the couch; otherwise if [...] end if;

Here’s another a bit cleaner approach:

[code]Statue is a kind of thing.
Statue1, statue2 and statue3 [etc] are statues.

Statue has a thing that varies called the next contraption.

The next contraption of statue1 is statue2.
The next contraption of statue2 is statue3. [etc]

Carry out giving blegos to Bloo:
say “‘Hey, thanks man!’ quips Bloo, taking the blocks from you and sticking them onto the statue.”;
let swappy be a random statue on the couch;
now the next contraption of swappy is on the couch;
remove swappy from play.[/code]

(I see Nitku has already answered your question, but I’ll post my reply anyway. You can compare our approaches and decide which works better for you.)

You could do this:

Carry out giving blegos (called blocks) to Bloo: say "'Hey, thanks man!' quips Bloo, taking the blocks from you and sticking them onto the statue."; remove blocks from play; if the couch contains the statue1 begin; remove statue1 from play; move statue2 to the couch; stop the action; end if; if the couch contains the statue2 begin; remove statue2 from play; move statue3 to the couch; stop the action; end if; [etc]

(Notice that “(called blocks)” gives the blegos in question a name, so we can remove them from play later. Or, if you prefer not to name them, you can just say “remove the noun from play”.)

This works, but means a lot of repetitious code. Unless you’re going to have something different happen each time the player gives Bloo some blegos, a better way would be something like this:

[code]Table of Statue Stages
stage
statue2
statue3
statue4
statue5
statue6
statue7
statue8
statue9
statue10
statue11
statue12
statue13

Carry out giving blegos (called blocks) to Bloo:
say “‘Hey, thanks man!’ quips Bloo, taking the blocks from you and sticking them onto the statue.”;
remove the blocks from play;
let old statue be a random statue in the couch;
remove old statue from play;
repeat through the Table of Statue Stages begin;
let new statue be the stage entry;
move new statue to the couch;
blank out the whole row;
break;
end repeat;
if statue13 is in couch begin;
say “‘Well, that looks finished to me!’”;
end the game in victory;
end if.[/code]

We have to use “random statue in the couch” to select the statue currently there, because although we know there will never be more than one statue on the couch, Inform doesn’t. Also, we use “repeat through the Table of Statues” even though we only want one statue per turn because “repeat through” skips the rows we’ve already blanked out.

That’s the beauty of programming, isn’t it: there are a thousand and one ways to solve any given problem!

Personally I would’ve coded the blockbuilding something like this:

The statue is on the couch. The statue has a number called construction phase. The construction phase of the statue is 1.

The description of the statue is "[statue-description][run paragraph on]".

To say statue-description:
	if the construction phase of the statue < 4
	begin;
		say "There's not much built yet.";
	otherwise if the construction phase of the statue < 8;
		say "It's coming along nicely.";
	otherwise if the construction phase of the statue < 12;
		say "It looks like a statue already.";
	otherwise if the construction phase of the statue is 12;
		say "Almost finished!";
	otherwise;
		say "All done!";
	end if.

Carry out giving blegos (called blocks) to Bloo:
	say "'Hey, thanks man!' quips Bloo, taking the blocks from you and sticking them onto the statue.";
	remove blocks from play;
	increase the construction phase of the statue by 1.

YOU GUYS RULE BIG TIME. :smiley: I thought of adding in all the “otherwises” after going to bed, but I may use one of these other solutions. Thanks a lot. :slight_smile:

edit: I decided to use the very last example (thanks Nitku) - the only problem is, “remove blocks from play” is not working, the blocks are all showing in Bloo’s inventory. Since I can make his inventory invisible and just say he’s not carrying anything in his description, I guess I can live with it, but does anyone know how to actually remove the blocks from play? I’d prefer it. Thanks. :slight_smile: