Advice on changing scenery in same location

Hi,

Thanks to everyone so far for helping me, I’m making good progress with my game. It revolves around being on a boat, so when the player first starts the boat is in a marina. This means various scenery pertains to being in a marina, so I have set a region to cover this.

Once the player goes out to sea, they remain on the boat, but the scenery changes.

Originally I was putting each room in different regions but realised this wasn’t going to work, so I have tried to do this instead:

The Marina and Sub1 are regions.
The player has a region called current region.
When play begins:
	now the current region of the player is Marina.

I have tried two approaches to handling scenery:

The Sky is a backdrop. The description is "[if the current region of the player is Marina]It is an almost cloudless morning, save for the remainder of last night's squall in the far distance to the east.[else if the current region of the player is Sub1]There is no sky.[end if]".
The Hills is a backdrop. The Hills is in the Marina. The description is "Rolling hills embrace the coastline, undulating gracefully with the rhythm of the sea.".

However, I get this:

>x hills
You can't see any such thing.

>x sky
You can't see any such thing

So to make sure I added this in the first room:

After going to the Cockpit:
	now the current region of the player is Marina.

But this returns the same. What am I missing?

1 Like

You don’t need to manually set and change the region of the player – your attempts to do so might be confusing Inform. Just put the relevant rooms in the regions you want to define, put the backdrops in the appropriate places, and that’s all you need:

Marina is a region.  Sub1 is a region.
Coast is a room in marina.  Beach is a room in marina.  It is east of coast.  Submarine is a room in sub1.  It is down from beach.

the sky is a backdrop in marina.  The sky is in sub1. The description is "[if the location is in Marina]It is an almost cloudless morning, save for the remainder of last night's squall in the far distance to the east.[otherwise if location is in Sub1]There is no sky.[end if]"

The hills are a backdrop in marina.  The description is "Rolling hills embrace the coastline, undulating gracefully with the rhythm of the sea."

1 Like

Hi @DeusIrae - but how does this solve the problem of being in a room on the boat? The same room will have different views depending upon the region.

I’m not quite sure I understand what you’re saying – you can have the same backdrop have different descriptions depending on where the player is, per the sky example in the code I posted. Is the idea that the sub is a vehicle and when the player is moving through the “marina” regions within the sub, you want the backdrops to look different? That’s easy enough to do; you can just substitute in a “if the player is enclosed by the sub” conditional, for example. But otherwise I’m not sure what you mean by “the same room will have different views depending on the region”, since rooms don’t move through regions.

Does the boat have to be a room? or would making it a vehicle (i.e., a subkind of container that’s enterable) that moves among rooms work?

If you do want it to be a room, the way to switch regions would be:

starting-region is a region.
Boat is a room. [ or whatever it's called ]
boat is in starting-region.

[... later, within some code block...]
now the map region of the boat is marina;
2 Likes

@DeusIrae

No, the sub is the subterranean region. Obviously, that is a bad example of different regions because that will be completely different to Marina, but let’s say we have another region called ‘sea’, which represents the player being on the boat but out at sea. The player will still be able to examine the sky, but the view will be different to the sky in the marina.

In terms of ‘the same room’: on the boat is a room named Cockpit. You will be in the cockpit both in the marina and out at sea, so viewing the sky needs to change.

@Zed the boat is not a room. There are rooms on the boat, like cockpit, galley, decks etc. Each of those is a room.

Ah, I see – this approach might run into challenges because there are strict rules on how regions overlap: you can have one entirely contained within another (like a house region which entirely includes a first-floor region, a second-floor region, a basement region, etc), but that’s it. So having a mostly-separate boat region and marina region with a single cockpit room that’s in both isn’t going to work.

Probably what you want to do is have a conditional that checks where the cockpit is – is it mapped next to the marina, or not? Or whatever property you’re using to chart whether the boat’s set sail – and then change the description of the backdrop based on that (again, you can have the same backdrop in multiple places so that’s no big deal).

1 Like
r1 is a region.
the moon is a backdrop in r1.

r2 is a region.
the sun is a backdrop in r2.

to move (x - region) to (y - region): (- move {x} to {y}; MoveFloatingObjects(); -).

ship is a region.
cockpit is a room.
cockpit is in ship.

instead of waiting: move ship to r1.
instead of jumping: move ship to r2.

test me with "x moon / z / x moon / jump / x moon / x sun"
2 Likes

Hmmm, the problem with that is setting conditions on each room for each region. This is why it made more sense to define where the player is instead. When we know the player has turned on the ignition key, he moves from the marina to the sea… or his view of the scenery changes from the marina to the sea. Then all I have to do is set conditions on the scenery to say if the player is in the sea, the description is this.

I just wonder if using regions is confusing things and instead just set a new value called player_position. Set the player position to a value like ‘sea’, and then have a condition on the scenery description to match that.

or you could move the backdrops in and out of the ship region as the ship moves.

the moon is a backdrop.
the sun is a backdrop.

ship is a region.
cockpit is a room.
cockpit is in ship.

instead of waiting: now the moon is in ship;
instead of jumping: now the moon is nowhere; now the sun is in ship;

test me with "x moon / z / x moon / jump / x moon / x sun"
2 Likes

OK. The first one you gave me looks more straightforward. However, was I supposed to be able to x the moon at any point?

>x moon
You can't see any such thing.

>x sun
You can't see any such thing.

>jump
>x sun
You see nothing special about the sun.

>x moon
You can't see any such thing.

>jump
>x moon
You can't see any such thing.

no, the test me sequence was demonstrating that the moon is only available after you’ve waited, and up until you jumped. The ship region is in no regions at the beginning.

1 Like

In this example, I only jumped from no region to r2, correct?

waiting moves the ship to r1. jumping moves the ship to r2. The moon is only in r1. The sun is only in r2.

So, yes, in the sample you posted, you went from the ship region not being in a region to it being in r2. The test me sequence in the code goes from no region to r1 to r2.

How is ‘waiting’ defined here? Because that command/response I posted was from the start. Before doing anything else, I x the moon and it wasn’t there.

@Zed tbh it doesn’t really matter. You’ve proved that by putting a region in a region, it seems to make things a lot easier in terms of changing descriptions. This will be tomorrow’s project, thank you.

waiting and jumping are both actions defined in the standard rules. I’m just hijacking them for demonstration purposes.

Maybe this is clearer. At least, it offers different distractions.

r1 is a region.
the moon is a backdrop in r1.

r2 is a region.
the sun is a backdrop in r2.

to move (x - region) to (y - region): (- move {x} to {y}; MoveFloatingObjects(); -).

ship is a region.
cockpit is a room.
cockpit is in ship.

definition: a region is regional if it is not the ship.

region-going is an action applying to one visible thing.
understand "go [any regional region]" as region-going.
carry out region-going: move ship to the noun.

test me with "x moon / go r1 / x moon / go r2 / x moon / x sun"
1 Like

This is great, thank you @Zed

2 Likes

One further question: obviously I don’t want to allow the player to move regions, I want to set this in the code instead. How would I implement an if statement to move region after completing a task?