TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Up & Down linked rooms visible in the same level

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Thu Sep 17, 2015 5:56 pm    Post subject: Up & Down linked rooms visible in the same level Reply with quote

Rooms [A] and [B] are linked together, you go UP from [A] and you are in [B], you go DOWN form [B] and you are in [A], still them are visually detached from each other Wink
Code:

   +
[A]                            [B]
                               -


This was a question I have seen a lot, it's not as straightforward to obtain, and I found a solution, with some limits, but it's working and easy to use:

Code:

#nop updownlink {distance} {room direction} {initial exit}

#alias updownlink
{
        #map get roomvnum updstartroom;
        #path load {%3;%2};
        #path save backward updtmpdir;
        #list updtmpdir create {%2;%3} $updtmpdir;
        #loop 1 2 updcntdir
        {
                #math {updposdir} {$updcntdir*2};
                #map dig $updtmpdir[$updposdir];
                #map move $updtmpdir[$updposdir];
                #math {updposdir} {$updcntdir*2-1};
                #loop 1 %1 updcnt
                {
                        #map roomflag void;
                        #map dig $updtmpdir[$updposdir];
                        #map move $updtmpdir[$updposdir];
                };
                #map roomflag void;
                #math {updposdir} {4/$updcntdir};
                #if {$updcntdir==1}
                {
                        #map dig $updtmpdir[$updposdir];
                }
                {
                        #map link $updtmpdir[$updposdir] $updstartroom both;
                };
                #map move $updtmpdir[$updposdir];
                #math {updposdir} {$updcntdir*2};
                #map unlink $updtmpdir[$updposdir];
        };
        #unvar updstartroom;
        #unvar updtmpdir;
        #unvar updcntdir;
        #unvar updcnt;
        #unvar updposdir;
}


An example, starting from room [A], using
"updownlink 10 e u"
will create a new room to the east, distant 10 rooms from [A], and linked to the UP exit of [A]
(The result is similar to the one on top of this post)

You can create rooms in every directions.


***LIMITS*** (removed in the next script)

When 2 rooms are linked with this method it can't be used anymore on them, you can't end up having a room with both UP & DOWN exits visible.

Code:

--- THAT'S NOT POSSIBLE --- (have a look at the next script)

                                   +                      +
   [B]                         [A]                    [C]
  -                            -


Anyway I'm working on it, I think there's a way, playing with DIG... I'll update if I find a solution. (SOLUTION IN THE NEXT SCRIPT Wink )


**** INFO ****

Just a little explanation as how it works... both rooms are connected by many void rooms (on the upper and lower level), one line of rooms link the UP exit of [A] to the UP entry of [B], while another line of rooms link the DOWN exit of [B] to the DOWN entry of [A].
Void rooms makes [A] move directly to [B], then the DOWN link of [A] and the UP link of [B] are removed unilaterally.


Last edited by PowerGod on Fri Sep 18, 2015 10:29 am; edited 2 times in total
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Fri Sep 18, 2015 2:11 am    Post subject: Reply with quote

Found the solution for the second problem, both up and down exits from a central room can be connected to different rooms Smile

I just force all the rooms created to be new, to be sure old rooms are not linked.

So, that's now possible: [A] up goes to [B] while [A] down goes to [C], but still both [B] and [C] sends to [A]

Code:

#nop starting from room [A]
#nop this will create [B]
updownlink2 10 w u
#nop this will create [C]
updownlink2 7 e d

                                   +                      +
   [B]                         [A]                    [C]
  -                            -


Code:

#alias updownlink2
{
        #map get roomvnum updstartroom;
        #path load {%3;%2};
        #path save backward updtmpdir;
        #list updtmpdir create {%2;%3} $updtmpdir;
        #loop 1 2 updcntdir
        {
                #math {updposdir} {$updcntdir*2};
                #map get roomvnum {updlastroom};
                #map dig {upddig} {NEW};
                #map move upddig;
                #map get roomvnum {upddig};
                #map goto $updlastroom;
                #map link $updtmpdir[$updposdir] $upddig both;
                #map unlink {upddig};
                #map move $updtmpdir[$updposdir];
                #math {updposdir} {$updcntdir*2-1};
                #loop 1 %1 updcnt
                {
                        #map roomflag void;
                        #map get roomvnum {updlastroom};
                        #map dig {upddig} {NEW};
                        #map move upddig;
                        #map get roomvnum {upddig};
                        #map goto $updlastroom;
                        #map link $updtmpdir[$updposdir] $upddig both;
                        #map unlink {upddig};
                        #map move $updtmpdir[$updposdir];
                };
                #map roomflag void;
                #math {updposdir} {4/$updcntdir};
                #if {$updcntdir==1}
                {
                        #map get roomvnum {updlastroom};
                        #map dig {upddig} {NEW};
                        #map move upddig;
                        #map get roomvnum {upddig};
                        #map goto $updlastroom;
                        #map link $updtmpdir[$updposdir] $upddig;
                        #map unlink {upddig};

                }
                {
                        #map link $updtmpdir[$updposdir] $updstartroom;
                };
                #map move $updtmpdir[$updposdir];
                #math {updposdir} {$updcntdir*2};
                #nop #map unlink $updtmpdir[$updposdir];
        };
        #unvar updstartroom;
        #unvar updtmpdir;
        #unvar updcntdir;
        #unvar updcnt;
        #unvar updposdir;
        #unvar upddig;
        #unvar updlastroom;
}
Back to top
View user's profile Send private message
Grainne



Joined: 29 Apr 2016
Posts: 1

PostPosted: Fri Apr 29, 2016 1:02 pm    Post subject: Reply with quote

This is good stuff, thank you for sharing
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Thu May 05, 2016 1:51 pm    Post subject: Reply with quote

Grainne wrote:
This is good stuff, thank you for sharing


Just did my part Coffee
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group