intfiction.org

The Interactive Fiction Community Forum
It is currently Tue Dec 11, 2018 3:12 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon Feb 12, 2018 3:07 am 
Offline

Joined: Sat Feb 10, 2018 7:42 pm
Posts: 9
Just to double check.
Is it one door per compass object thingie?

I'm trying to make a room (a hallway, actually) a sort of hub for quite a few other rooms.
Can this be done with an arbitrary amount of doors? Or will I have to split the hallway into chunks every time a "wall side" has all its slots exhausted.
As in, the hallway goes from west to east, leaving northeast, north and northwest for "doors on the northern wall", if things are restricted by slots.

That feels kind of clunky to me, but the many door solution might be clunky, as well, just differently.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 4:46 am 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 301
Location: Michigan
I have a vague recollection of working on something like this. I think I ended up going the route of creating a new door class that was an enterable container, then upon entry, I moved the player to whichever room I liked. I would have another "door-container-teleporter" in that room which would return the player to the hall...

I believe I was using/looking-at some of the code in the Elevator example as well: http://ifwiki.org/index.php/Elevator_an ... _6_example)

In the end, I decided to simply segment the hall.

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 9:49 am 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 301
Location: Michigan
The Window Room example might help as well, since it's a set of rooms in which you can see what's in other rooms:

http://inform-fiction.org/manual/html/sa6.html#ans100

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 10:01 am 
Offline
User avatar

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2797
Location: US - Central
I know this is an I6 question, but I created an I7 extension called "Easy Doors" that allows the author to place doors anywhere without using map connections. I basically just made a new object that behaves like a door and moves the player to a linked destination when they ENTER it. If you do a lot of these, you'll want a mechanism so that you can link two such doors so they remain consistently closed/open and locked/unlocked on both sides.

_________________
http://hanonondricek.wixsite.com/pyramidif
https://pyramidif.itch.io/


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 10:20 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5832
Any number of doors in a room can accept ENTER DOOR. However, if the player types NORTH there can only be one door to the north from that room -- you're putting it in the n_to property.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 1:42 pm 
Offline

Joined: Sat Feb 10, 2018 7:42 pm
Posts: 9
Thanks for the replies. The examples are good inspiration and I'll try and make something from them on the side.
(For now I"m working on some other rooms)
Also, thanks for the extension, I'll be using it from now on, most likely, but the problem remains.
I can't seem to enter the door unless the big hall has the door set as its "n_to".

I might just end up segmenting the hall if this continues to be a roadblock for too long, hehe.
For now, though, not giving up just yet, merely putting it as a side problem.

I'll try making the doors catch the go or enter message and set the parent to their direction or something for now.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 3:36 pm 
Offline

Joined: Sat Feb 10, 2018 7:42 pm
Posts: 9
I've been having some success by giving the hallway an "n_to" but keeping it "0".
The door to be entered then sets that up to lead into the room the door leads to, which has the corresponding "s_to".

It's somewhat clunky, though, maybe defining a new compass direction is the way to go?
Like "manydoor_to", or something.
I'll post the code here if I manage to figure the whole thing out.
Right now I have to do a bit of bookkeeping like calling library messages to deal with closed door cases and stuff, which is a bit smelly to me, but I think I'm on the right track, or at least vaguely right one.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 5:28 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5832
I didn't realize that the library would get upset about the door when the room's direction property is unset. I apologize for the bad advice.

Would it suffice to have a scenery object which is *not* a door, but just looks like a door? Have it handle the Enter action (in a before clause) by moving the player to a new room. That would avoid everything to do with directionality.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Feb 12, 2018 10:41 pm 
Offline

Joined: Sat Feb 10, 2018 7:42 pm
Posts: 9
zarf wrote:
I didn't realize that the library would get upset about the door when the room's direction property is unset. I apologize for the bad advice.

Would it suffice to have a scenery object which is *not* a door, but just looks like a door? Have it handle the Enter action (in a before clause) by moving the player to a new room. That would avoid everything to do with directionality.


No worries about that, worst that happens is me asking me questions :P.
But yeah, I came up with a solution and it still requires the "room with the many doors" to have "settable directions" the doors can temporarily write to when entered, but it works.

Code:
Include "Parser";
Include "VerbLib";
!uses the easydoors extension
Include "easydoors";

Class ManyDoor class Doorway with
    react_before[;
        Go:
            if(noun ~=self) rfalse;
    ],
    after[;
        Go: self.side2_to.(self.side1_dir) =0;
    ],
    before [;
        Enter:
            if (noun ==self)
            {self.automat();}

            if(self hasnt open)return L__M(##Enter, 3, self);
            location.(self.side1_dir) = self.door_to();
    ];

Object BigHall "Many Door Hall" with
    description
        "This hall is bigger than the average hall,
         and has two doors on the northern wall that must be entered by name.",

    n_to, !the north wall is lined with many doors, which will overwrite "n_to" upon
          !entering and once the player is through, set it back to 0
    has light;

Object Room1 "The first room" with
    description "Clearly the better room.",
    s_to BigHall, !simple way out that works with "s" or "go south" etc
    has light;
Object Room2 "The second room" with
   description "Wishes to be the first room",
   s_to BigHall,!simple way out that works with "s" or "go south" etc
   has light;

ManyDoor TestDoor1 "Northern Door #1"
   with name 'first',
   side1_to Room1, 
   side1_dir n_to,
   side2_to BigHall,
   side2_dir s_to,
   isconcealed 0,
   autoopen 1,
   found_in BigHall Room1;
ManyDoor TestDoor2 "Northern Door #2"
   with name 'second',
   side1_to Room2,
   side1_dir n_to,
   side2_to BigHall,     
   side2_dir s_to,   
   isconcealed 0,
   autoopen 1,
   found_in BigHall Room2;

[ Initialise;
location = BigHall;
];

Include "Grammar";

It's not the best solution, it would be better if the room asked "which door" when going north, but at least it works and retains the easydoor functionality, too.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group