Turn Count since Certain Event

I’ll be glad when I can quit asking for help here. Eventually I’d like to enter a comp, and I don’t feel like I can do that if I’ve gotten a bunch of help. Though whether small non-game-revealing syntax questions disqualify, I don’t know.

I’d like to make something happen ten turns after something else happens.

I’ve tried the following:

[code]
Scenepause is a value that varies. Scenepause is 0.

Every turn during Scene Y:
[If something is true that makes the scene end],
now Scenepause is turn count.

Scene x is a scene. Scene x begins when turn count is > than Scenepause + 10.[/code]

Compiler doesn’t like “now Scenepause is turn count” or “now Scenepause equals turn count”.

If there’s a syntax for something like “Scene x begins when turn count since Y happened is 10”, then I certainly can’t find it or guess it.

Help is appreciated as always.

Really, you shouldn’t worry! You certainly can enter a comp if you’ve gotten help. I guess most (if not all?) authors of comp and non-comp games need programming help from time to time. That’s not at all the same thing as an uncredited co-author!

It’s polite to thank the forum members for their help in the ABOUT or CREDITS text of your game, but that’s all.

Try this – I think it does what you want:

[code]The Test Lab is a room. “Many devious tests are conducted here.”

The player carries a banana. The banana is edible.

Scenepause is a number that varies. Spool is a truth state that varies. Spool is false.

Scene Y is a scene. Scene Y begins when play begins.
Scene X is a scene. Scene X begins when spool is true.

After eating the banana:
let N be the turn count;
now scenepause is N + 5;
continue the action.

Every turn during Scene Y:
if turn count is scenepause:
now spool is true.

Test me with “scenes / eat banana / z / z / z / z / z”.[/code]
It appears you can’t set a variable to turn count directly, but you can set a temporary variable to turn count and then set scenepause to the temp variable. In addition, you need to use a global truth state (here I’ve called it spool) to trigger the start of the new scene. Hope this helps!

–JA

…and it turns out there’s an even easier way to do it:

[code]The player carries a banana. The banana is edible.

Scene Y is a scene. Scene Y begins when play begins.
Scene X is a scene.

Scene X begins when the banana has been nowhere for 7 turns.

Test me with “scenes / eat banana / z / z / z / z / z”.[/code]
It appears that any condition can be used in this syntax. The main limitation is that you can only start a scene in one way, so you couldn’t write two different “Scene X begins when…” rules. But you could easily write a scene-starting rule with two conditions, like this: “Scene X begins when spool has been true for 5 turns or the apple has been polished for 5 turns.” Or, if your scenario is more complex, you could create a global truth state, set it to true in various blocks of code, and then use it to cue up a scene after a delay:

[code]Spool is a truth state that varies. Spool is false.

The player carries an apple and a banana. The banana is edible.

After eating the banana:
now spool is true;
continue the action.

Instead of rubbing the apple:
now spool is true;
say “You rub a shine onto the apple.”

Scene X begins when spool has been true for 5 turns.

Scene Y is a scene. Scene Y begins when play begins.
Scene X is a scene.[/code]
Hope this helps.

–JA

If it were me I’d just freely ask away for any help I needed. I enjoy reading your posts and entertaining myself by finding possible solutions for the issues you present, but I sometimes find it difficult to decide which particular aspect of the questions you pose is your “true” focus or what the actual issue is that you’re having trouble with. Rather than be mysterious, if I were in your place I’d clearly state what I needed help with as the chances are very, very, very, low that anyone playing a game I made six months or a year from now would have their experience “ruined” because they have a photographic memory and recalled some minor discussion in the past on a message board, and my chances of getting my question directly answered would rise significantly.

I was playing around with the question you posed and came up with three distinct ways to solve the issue in addition to the several ways that Jim Aikin already proposed; perhaps one of them will be helpful to you. Between the time I started experimenting and came back to make this post, Jim made his second post so note that that the first option presented below is almost identical to an answer Jim gave above, because I was writing it as he made his post.

Choice #1

[code]The testarea is a room.

Bella is a woman. The description of Bella is “The most beautiful woman you have ever seen; her warm smile makes your knees feel wobbly.”.

Scene Y is a scene. Scene Y begins when play begins.

The player carries a quarter. The description of the quarter is “A shiny twenty-five cent coin.”. Understand “coin” as the quarter.

A jukebox is in the testarea. The description of the jukebox is “A large jukebox sits in the corner of the room, garishly lit with blue and red neon lights. According to its listings, every record in the jukebox is ‘June in January’ by Bing Crosby. A coin slot is set in the front of the jukebox, above which is a small decal that says ‘25 cents.’”. Understand “juke box” or “slot” or “coin slot” or “coinslot” as the jukebox.

Check inserting something into the jukebox:
if the noun is not the quarter:
say “That seems like a bad idea. You might jam the coin slot.” instead.

Instead of inserting the quarter into the jukebox:
remove the noun from play;
say “You slide the quarter into the coin slot, and the ineffably soothing sounds of der Bingster fill the room.”.

Scene X is a scene. Scene X begins when the quarter was off-stage for ten turns.

When Scene X begins:
move Bella to the testarea;
say “As if from nowhere, a mysterious woman appears. ‘My name is Bella,’ she says in a soothing voice. ‘Would you care to dance?’ she charmingly asks.”.[/code]

Choice #2

[code]The testarea is a room.

Bella is a woman. The description of Bella is “The most beautiful woman you have ever seen; her warm smile makes your knees feel wobbly.”.

Scene Y is a scene. Scene Y begins when play begins.

The player carries a quarter. The description of the quarter is “A shiny twenty-five cent coin.”. Understand “coin” as the quarter.

A jukebox is in the testarea. The description of the jukebox is “A large jukebox sits in the corner of the room, garishly lit with blue and red neon lights. According to its listings, every record in the jukebox is ‘June in January’ by Bing Crosby. A coin slot is set in the front of the jukebox, above which is a small decal that says ‘25 cents.’”. Understand “juke box” or “slot” or “coin slot” or “coinslot” as the jukebox.

Instead of inserting the quarter into the jukebox:
remove the noun from play;
say “You slide the quarter into the coin slot, and the ineffably soothing sounds of der Bingster fill the room.”;
Bella materializes in ten turns from now.

At the time when the Bella materializes:
move Bella to the testarea.

Scene X is a scene. Scene X begins when Bella is in the testarea for the first time.

When Scene X begins:
say “As if from nowhere, a mysterious woman appears. ‘My name is Bella,’ she says in a soothing voice. ‘Would you care to dance?’ she charmingly asks.”.[/code]

Choice #3

[code]The testarea is a room.

Bella is a woman. The description of Bella is “The most beautiful woman you have ever seen; her warm smile makes your knees feel wobbly.”.

Scene Y is a scene. Scene Y begins when play begins.

The player carries a quarter. The description of the quarter is “A shiny twenty-five cent coin.”. Understand “coin” as the quarter.

A jukebox is in the testarea. The description of the jukebox is “A large jukebox sits in the corner of the room, garishly lit with blue and red neon lights. According to its listings, every record in the jukebox is ‘June in January’ by Bing Crosby. A coin slot is set in the front of the jukebox, above which is a small decal that says ‘25 cents.’”. Understand “juke box” or “slot” or “coin slot” or “coinslot” as the jukebox.

Time1 is a number that varies. Time1 is usually 0.
Time2 is a number that varies. Time2 is usually 0.

Instead of inserting the quarter into the jukebox:
remove the noun from play;
say “You slide the quarter into the coin slot, and the ineffably soothing sounds of der Bingster fill the room.”;
let N be the turn count;
change time1 to N;
change time2 to N.

Every turn during Scene Y:
unless time2 is 0:
increase time2 by 1;
if time2 - time1 is 10:
move Bella to the testarea.

Scene X is a scene. Scene X begins when Bella is in the testarea for the first time.

When Scene X begins:
say “As if from nowhere, a mysterious woman appears. ‘My name is Bella,’ she says in a soothing voice. ‘Would you care to dance?’ she charmingly asks.”.[/code]

With what Jim wrote, that gives you five or six different ways to make a scene start ten turns after a trigger action. If none of these are applicable but you don’t want to exactly say why, please don’t hesitate to ask for more help.

Jim and Endosphere:

Thanks so much for so many helpful examples!

Endosphere, I often do put my actual code into my posts, but just didn’t feel like it this time… I’m both a little weary of giving away too much of a game I’d like to enter in a comp, but also just thought that the snippet I’m working on right now is a little complicated with an awful lot of irrelevant variables in it.

However, I think I’ll be able to use “Scene X begins when something has been true for 10 turns”, and if I can’t make that work, it looks like I have several more approaches to choose from.

Eriorg, giving credit to the people who have helped me is a great idea; I’ll keep that in mind!

Thanks again!