|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Wed Apr 21, 2004 2:22 am
Graphic Showing Exits of a Room |
Has anyone ever came up with a small picture that graphically shows the exits of the room you're in? This feature was in the Cerberus client created for the MUD Cardea and I found it very useful.
|
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Wed Apr 21, 2004 2:23 am |
Oh yes, I forgot to mention: preferably for Achaea.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Apr 21, 2004 3:24 am |
There is a compass.zsc file that comes standard with zMud. It is designed to be imported into your mud file. I prefer using it in a seperate window. To do so simply make a child window with the name of compass and it should load automatically (#WIN compass). Either way you will have to provide a trigger or, if your are using the mapper, an onroomenter alias to pass the exit information into the ShowExits alias. If you do use a child window then you will also have to edit the button commands to make use of the focus character (default ":") to send the directions to the proper window and then you should save the settings for that child window to keep the changes.
Alternately you could just look at it for ideas and make your own. |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Wed Apr 21, 2004 10:04 pm |
Hehe, I understood most of that...I think. What kind of trigger should I provide? What do you mean by edit the button commands and the focus character?
Thanks for the reply. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Apr 23, 2004 1:51 am |
You need a trigger that will match the line containing the exits. It then has to extract the exits and pas them to ShowExits in the format that ShowExits wants. Without actually knowing how Achaea currently looks I can't really tell you more.
Editting buttons seems obvious enough, and since you asked about it I would assume you went with the child window route. You should at the help page on Multiplaying for more information on the focus character. I am not going to duplicate the help files here. |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Sat Apr 24, 2004 1:46 am |
I'm afraid I'm new at ZMud scripting. I have an idea of how to extract the exits, but how do I pass them on to ShowExits? What format does it want?
This is what Achaea's exit line looks like:
You see exits leading northeast, east, southeast, and south.
or
You see a single exit leading south. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Apr 24, 2004 4:32 pm |
#TRIGGER {^You see {exits|a single exit} leading (*).$} {ShowExits {%replace(%replace("%1","and ",""),", ","|")}}
|
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Sat Apr 24, 2004 9:07 pm |
Thanks for your help. This is a pretty difficult problem for me.
|
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Sat Apr 24, 2004 10:36 pm |
Hmm...I'm not sure if I have the compass.zsc file. Is the window supposed to be completely blank when I type #WIN compass?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Apr 25, 2004 3:53 am |
My apologies, it doesn't load automatically. You will have to import it. This is done in the Settings Editor.
|
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Sun Apr 25, 2004 7:11 am |
What folder is it in? I looked in my Achaea folder and my ZMud folder and didn't find it.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Apr 25, 2004 8:21 am |
Hrm it should be in the zMud folder, in any case I will just post it. I made a few changes so buttons would position properly, and wouldn't overwrite any existing buttons you have.
#CLASS {Compass}
#ALIAS ShowExits {#call %btnenable(btnnw,%ismember(nw,%1));#call %btnenable(btnn,%ismember(n,%1));#call %btnenable(btnne,%ismember(ne,%1));#call %btnenable(btnw,%ismember(w,%1));#call %btnenable(btne,%ismember(e,%1));#call %btnenable(btnsw,%ismember(sw,%1));#call %btnenable(btns,%ismember(s,%1));#call %btnenable(btnse,%ismember(se,%1));#call %btnenable(btnd,%ismember(d,%1));#call %btnenable(btnu,%ismember(u,%1));#call %btnenable(btnout,%ismember(out,%1))}
#BUTTON 900 {} {nw} {} {} {} {} {ARROWNW} {Size} {23} {23} {Pos} {1} {1} {} {} {} {} "" {Explore} {nw} {btnnw} {4}
#BUTTON 901 {} {n} {} {} {} {} {ARROWU} {Size} {23} {23} {Pos} {1} {24} {} {} {} {} "" {Explore} {north} {btnn} {4}
#BUTTON 902 {} {ne} {} {} {} {} {ARROWNE} {Size} {23} {23} {Pos} {1} {47} {} {} {} {} "" {Explore} {ne} {btnne} {4}
#BUTTON 903 {} {w} {} {} {} {} {ARROWL} {Size} {23} {23} {Pos} {24} {1} {} {} {} {} "" {Explore} {west} {btnw} {4}
#BUTTON 904 {} {look} {} {} {} {} {TARGET} {Size} {23} {23} {Pos} {24} {24} {} {} {} {} "" {Explore} {look} {btnlook} {4}
#BUTTON 905 {} {e} {} {} {} {} {ARROWR} {Size} {23} {23} {Pos} {24} {47} {} {} {} {} "" {Explore} {east} {btne} {4}
#BUTTON 906 {} {sw} {} {} {} {} {ARROWSW} {Size} {23} {23} {Pos} {47} {1} {} {} {} {} "" {Explore} {sw} {btnsw} {4}
#BUTTON 907 {} {s} {} {} {} {} {ARROWD} {Size} {23} {23} {Pos} {47} {24} {} {} {} {} "" {Explore} {south} {btns} {4}
#BUTTON 908 {} {se} {} {} {} {} {ARROWSE} {Size} {23} {23} {Pos} {47} {47} {} {} {} {} "" {Explore} {se} {btnse} {4}
#BUTTON 909 {} {u} {} {} {} {} {DIRN} {Size} {23} {23} {Pos} {12} {70} {} {} {} {} "" {Explore} {up} {btnu} {4}
#BUTTON 910 {} {d} {} {} {} {} {DIRS} {Size} {23} {23} {Pos} {36} {70} {} {} {} {} "" {Explore} {down} {btnd} {4}
#BUTTON 911 {} {out} {} {} {} {} {DOOROPEN} {Size} {23} {23} {Pos} {24} {93} {} {} {} {} "" {Explore} {out} {btnout} {4}
#CLASS 0 |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Mon Apr 26, 2004 4:06 am |
Well, it's finally working somewhat. I replaced all the abbreviated directions inside %ismember and after the {explore} with the actual directions (north, northwest, etc.) in the buttons and now they're showing up and updating correctly. I do wish there is a graphic for the exit "in" and doors though.
Because I currently have no buttons, it's sitting in the northwest corner of my Achaea window. Would any buttons added in the future interfere with this compass? |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Mon Apr 26, 2004 4:12 am |
Actually, I still have a slight problem. Here's the exit line:
You see exits leading north (open door), northeast (open door), east, southeast (open door), south, southwest (open door), west, and northwest (open door).
This line is so long it takes up two lines. So I have no clue how to make the trigger read it all.
Here's my edited compass class with the edited trigger inside:
#CLASS {Compass} {enable}
#ALIAS ShowExits {
#call %btnenable(btnnw,%ismember(northwest,%1))
#call %btnenable(btnn,%ismember(north,%1))
#call %btnenable(btnne,%ismember(northeast,%1))
#call %btnenable(btnw,%ismember(west,%1))
#call %btnenable(btne,%ismember(east,%1))
#call %btnenable(btnsw,%ismember(southwest,%1))
#call %btnenable(btns,%ismember(south,%1))
#call %btnenable(btnse,%ismember(southeast,%1))
#call %btnenable(btnd,%ismember(down,%1))
#call %btnenable(btnu,%ismember(up,%1))
#call %btnenable(btnout,%ismember(out,%1))
}
#TRIGGER {You see {exits|a single exit} leading (*).} {ShowExits {%replace( %replace( %replace( %replace( "%1", ", and ", "|"), " (open door)", ""), " and ", "|"), ", ", "|")}}
#BUTTON 1 {} {nw} {} {} {} {} {ARROWNW} {Size} {23} {23} {Pos} {1} {1} {} {} {} {} "" {Explore} {northwest} {btnnw} {4}
#BUTTON 2 {} {n} {} {} {} {} {ARROWU} {Size} {23} {23} {Pos} {1} {24} {} {} {} {} "" {Explore} {north} {btnn} {4}
#BUTTON 3 {} {ne} {} {} {} {} {ARROWNE} {Size} {23} {23} {Pos} {1} {47} {} {} {} {} "" {Explore} {northeast} {btnne} {4}
#BUTTON 4 {} {w} {} {} {} {} {ARROWL} {Size} {23} {23} {Pos} {24} {1} {} {} {} {} "" {Explore} {west} {btnw} {4}
#BUTTON 5 {} {look} {} {} {} {} {TARGET} {Size} {23} {23} {Pos} {24} {24} {} {} {} {} "" {Explore} {look} {btnlook} {4}
#BUTTON 6 {} {e} {} {} {} {} {ARROWR} {Size} {23} {23} {Pos} {24} {47} {} {} {} {} "" {Explore} {east} {btne} {4}
#BUTTON 7 {} {sw} {} {} {} {} {ARROWSW} {Size} {23} {23} {Pos} {47} {1} {} {} {} {} "" {Explore} {southwest} {btnsw} {4}
#BUTTON 8 {} {s} {} {} {} {} {ARROWD} {Size} {23} {23} {Pos} {47} {24} {} {} {} {} "" {Explore} {south} {btns} {4}
#BUTTON 9 {} {se} {} {} {} {} {ARROWSE} {Size} {23} {23} {Pos} {47} {47} {} {} {} {} "" {Explore} {southeast} {btnse} {4}
#BUTTON 10 {} {u} {} {} {} {} {DIRN} {Size} {23} {23} {Pos} {12} {70} {} {} {} {} "" {Explore} {up} {btnu} {4}
#BUTTON 11 {} {d} {} {} {} {} {DIRS} {Size} {23} {23} {Pos} {36} {70} {} {} {} {} "" {Explore} {down} {btnd} {4}
#BUTTON 12 {} {out} {} {} {} {} {DOOROPEN} {Size} {23} {23} {Pos} {24} {93} {} {} {} {} "" {Explore} {out} {btnout} {4}
#CLASS 0
Is there anything I'm doing wrong? |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Thu Apr 29, 2004 3:03 am |
I was thinking that in order to capture multiline exits, I could take the period out of the pattern of the trigger:
^You see {exits|a single exit} leading (*)
and then use #IF %1=~(*.){multilines=0}{multilines=1} to activate a second condition of the same trigger. If multilines=0, then I proceed with sending the exits to ShowExits. However, if multilines=1, then I store the exits in a string list and do "" {disable} to disable the first condition and move on to the second. And the second condition of the trigger then extract the rest of the exits, concatenate them with the string list, and then pass them to ShowExits.
Does this sound like a feasible idea? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Apr 29, 2004 4:09 am |
You can see a similar trigger in Squinting in all directions. I'd suggest a separate trigger for single exit rooms, which aren't ever likely to have a second line. You might even want a third trigger for no-exit rooms.
#TR {You see a single exit leading (*).} {#VAR squintlist {%1}}
Change the variable name to suit your own purpose. |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Thu Apr 29, 2004 5:05 am |
Thank you. I modified it a little and it works very well. However, there's still a small problem, regarding (open door) at the beginning of the second line of the exit line. Here's the exit line:
You see exits leading north (closed door), northeast, east (open door), south (open door), southwest (open door), west, and northwest (open door).
The (open door) after "south" is at the beginning of the second line. I ran my triggers and my string list listed "south southwest" as one of the directions. It seems unable to replace the comma after the (open door) with a |. Would you have any idea why?
Here are my modified triggers:
#TRIGGER {You see exits leading (*)} {
ShowExits {%replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( "%1", ", and", ","), ",", "|"), "(open", ""), "(closed", ""), "door)", ""), ".", ""), "and", "|"), " ", "")}
#VAR exitlist {%replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( "%1", ", and", ","), ",", "|"), "(open", ""), "(closed", ""), "door)", ""), ".", ""), "and", "|"), " ", "")}
}
#COND {({north|east|south|west|and}*).} {ShowExits {@{exitlist} %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( "%1", ", and", ","), ",", "|"), "(open", ""), "(closed", ""), "door)", ""), ".", ""), "and", "|"), " ", "")}} {within|param=1} |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Apr 29, 2004 2:05 pm |
You inserted a space between @{exitlist} and %replace. Remove it.
|
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Fri Apr 30, 2004 5:13 am |
Hmm...didn't seem to work. "Southsouthwest" is now listed as a direction.
In any case, it's not terribly important. I can live with it. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Apr 30, 2004 9:50 am |
Okay, I see the problem. The #CONDITION pattern begins with a limited set of words in order to limit it to lines which are likely to be continuations of the exits list. Since door isn't in that set, the comma following door gets left out.
Solution: add door to the list.
#COND {({north|east|south|west|and|door}*.} {ShowExits {@{exitlist}%replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( "%1", ", and", ","), ",", "|"), "(open", ""), "(closed", ""), "door)", ""), ".", ""), "and", "|"), " ", "")}} {within|param=1} |
|
|
|
Y3KPanic Novice
Joined: 21 Apr 2004 Posts: 34
|
Posted: Fri Apr 30, 2004 5:54 pm |
Perfect. Thanks for your help =).
|
|
|
|
|
|
|
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
|
|