Adjacent and structuring world

hi everybody :slight_smile:

i hope you are all developing with haste …im stuck with problem i encountered …perhaps again i missunderstud something… i have lets say 3 rooms and one door between two rooms with one rule. i have problem with designing structure of story couse i found out atleast on mac (this time) that i cannot describe adjacent rooms and put doors in between…or at least i dont know how. heres example of code.

kitchen is a room. hallway is a room. halway is south of kitchen. bedroom is a room.bedroom is south of hallway. silky door is a door. silky door is north of bedroom and south of hallway

this on mac doesnt compile i gues i have two things in same place regarding halway and bedroom. as i understand error …now i can descride either adjacent rooms or connect rooms with doors but id like to have single way throughout the story describing thing and another thing is …when i connect rooms via doors [list of adjacent rooms] returns “nothing” as in following rule

after of looking:
    if looking in room:
        say "you see nearby locations: [list of adjacent rooms]";
        continue the action;
    continue the action; 

thank you for helping out :slight_smile:

When you create a door, the door needs to be placed in between the rooms it connects before those rooms are connected to each other. This is the error you’re facing. You’re trying to put a door between hallway and bedroom after you already connected those rooms to each other. As you discovered, Inform won’t allow this.

Try this:

kitchen is a room.
hallway is south of kitchen.
silky door is a door.
silky door is south of hallway and north of bedroom.

Btw, you can see in this code, just mentioning the bedroom as part of the creation of the silky door actually creates the bedroom.

-Wade

1 Like

thank for confiming…but how then to adjust the rule to get listed rooms if there are doors between. even reading material will suffice :smiley: if you have links… everything is welcome

thank you

Oops sorry, I missed that bit!

Okay, I have a way to do it, though someone might give you something more efficient involving a definition.

This piece of code scans each of the directions after a LOOK. If there’s a room in that direction, and no door in the way, the room will be a seen. If there is a door in the way, the room will only be seen if the door is open. And a list will only be printed if any rooms were visible. (You can test this by closing the door behind you in the southmost room, then looking)

Carry out looking:
	let ROOMLIST be a list of rooms;[create an empty list]
	repeat with Z running through directions:[nsew etc.]
		let TARGET be the room-or-door Z from the location;
		if TARGET is not nothing:[if it's not nothing, there is a room in that direction. Maybe with a door.]
			if TARGET is not a door:
				add TARGET to ROOMLIST;[if no door, note the room was seen]
			otherwise if TARGET is open:[if there is a door, we'll only say the room was seen if the door's open]
				add room Z from the location to ROOMLIST;
	if number of entries in ROOMLIST is not 0:[make sure the list of seen rooms has at least 1 entry before printing]
		say "You see nearby locations: [ROOMLIST].";

After I wrote this, I thought ‘Well, it’d probably be better if it also said which direction each visible room was in.’ But I’m going to bed now. Hopefully you can learn something from this example :slight_smile:

-Wade

Include Versatile Listing by Daniel Stelzer.

Definition: a direction (called the way) is appropriate if the room-or-door (way) from the location is a room or the room-or-door (way) from the location is an open door.

Definition: a direction (called the way) is blocked if the room-or-door (way) from the location is a closed door.

To say distant details of (the place - a room):
    if the place is visited, say "[the place]";
    otherwise say "somewhere new".

To list available directions:
    say "From here you can go ";
    if there is an available direction:
        print a list of "[the direction being listed] to [distant details of the room (direction being listed) from the location]" for available directions, disjunctive;
    otherwise:
        say "nowhere";
    if there is a blocked direction:
        say ", and there are blocked doors [the list of blocked directions]";
    say ".".

After looking:
    list available directions;
    continue the action.

This extension isn’t publicly released yet but I’m attaching it here.
Versatile Listing-v1.i7x (5.8 KB)

1 Like

thank you both :slight_smile: its working :slight_smile: ill pollish it even further later…but thank you for most helpfull advice :slight_smile:

1 Like

You can replicate this map even more succinctly by just writing:

hallway is south of kitchen.
a door called silky door is south.
bedroom is south.