Saturday, February 16, 2019

Using a variable with future events

So I had mentioned variables before in this post. So here is a quick example of using a variable, it will also show off the every turn rule.

The moment it gets hot is a time that varies.
The moment it gets hot is initially 7:35 PM.

The Empty Art Gallery is a room. "It looks like someone took all of the art in here."
The parking lot is a room. "This is a very empty parking lot several blocks form the art gallery."

The parking lot is west of the empty art gallery.

When play begins:
    Now the time of day is 7:31 PM;
    The heat cranks in three turns from now.

Every turn:
    If the time of day is before the moment it gets hot:
        say "Such a nice day.";
    otherwise:
        say "The heat is unbearable.".
        
At the time when the heat cranks:
    Say "I think the heat is cranking up.";
    Increase the moment it gets hot by 3 minutes.
    
Test me with "z/z/z/z/z/z/z/z".

Now if you want to play around with it, you can compare how long you have to wait before the moment it gets hot to this.

The moment it gets hot is a time that varies.
The moment it gets hot is initially 7:35 PM.

The Empty Art Gallery is a room. "It looks like someone took all of the art in here."
The parking lot is a room. "This is a very empty parking lot several blocks form the art gallery."

The parking lot is west of the empty art gallery.

When play begins:
    Now the time of day is 7:31 PM.
    [The heat cranks in three turns from now.]

Every turn:
    If the time of day is before the moment it gets hot:
        say "Such a nice day.";
    otherwise:
        say "The heat is unbearable.".
        
[At the time when the heat cranks:
    Say "I think the heat is cranking up.";
    Increase the moment it gets hot by 3 minutes.]
    
Test me with "z/z/z/z/z/z/z/z".

As you can see I commented out the the heat cranks scheduled event. So the time variable that holds when the moment it gets hot never increases by three minutes.

Now you'll notice that I'm using minutes and setting explictly the time here. This is Inform time and pretty much every action, even just standing there, costs one minute. However, you can create rules that alter the default cost of time per move. You can even create rules that have some actions cost no time what-so-ever. You can see an example of this from the Recipie Book in Chapter 4 with Timeless.

No comments:

Post a Comment

Implementing Help in a Story