Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Thu Jan 05, 2017 4:28 pm   

zMUD optimization guide?
 
Is there a definitive guide to zMUD optimization, specifically triggers and any thing related to keeping zMUD running fast? I have gained some insight through searching the forums in the past but I am wondering if anyone has gathered all of the tips and tricks and put them together in one place. If not, is there any interest from some of you guru types to want to try and put one together?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Fri Jan 06, 2017 3:23 pm   
 
Tighten up your patterns to be as specific as possible...
Well the #WAIT command did not work as intended in zMUD, far better to use #ALARMs.

Most of the issues have been fixed in the more recent product, CMUD.
_________________
Discord: Shalimarwildcat
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Fri Jan 06, 2017 7:38 pm   
 
Thanks for the reply Shalimar. I am looking for something a lot more specific and in depth. Laughing

There is a dozen different ways to go about using Zscript to get something done, what I am looking for is what the community has found over the years to be "best practices" for scripting in zMUD. I would be surprised if such a compilation of information hasn't been put together before. The help files give very basic examples and none of it to do with optimization.

As to cMUD I own it also, but the mud I play has a lot of zMUD users still. I write zMUD scripts that I share with the community over at WoTmud, eventually I will port everything I have done over to cMUD also, but first I'm trying to get my zMUD scripts as tight as I can get them.

Taziar Medakan @ WoTmud
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Sat Jan 07, 2017 1:08 pm   
 
That's just it, there are so many ways to go about it.
We here try not to stifle people's creativity be saying there is a 'best' way to do things.
Now if you are having trouble trying to get a specific thing done, we can offer suggestions on how to make it work at all.
_________________
Discord: Shalimarwildcat
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Sat Jan 07, 2017 9:56 pm   
 
I have spent 100+ hours reading and searching the forums in just the last year and I want to thank you Shalimar. You have tried to answer and help on almost every recent post. Truly, thanks for continuing to try even as the rest of the community has seemed to dwindle.

Tonight when I get home from work I will try to post a bunch of examples and questions to explain better so you might understand more clearly what I mean.

Thanks again!
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Sun Jan 08, 2017 6:27 am   
 
Here is a great example of what I am talking about: http://forums.zuggsoft.com/forums/viewtopic.php?p=79739

Pay particular attention to Zugg's responses and how he describes how Zscript triggers are optimized and #REGEX triggers use the PCRE library and are not optimized. Zugg says that #REGEX should only be used as a last resort if you can't do something with a normal trigger. This is a great example of what I mean as "best practices". Knowing this, you would never give someone the advice to use a #REGEX trigger if a normal #TRIGGER would work.

My original post is just asking if anyone in the community has put together a list of this kind of information to help others optimize the way they use zMUD scripting.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jan 08, 2017 10:44 am   
 
If you read further Zugg clarified that particular point. I don't recall exactly what version of zMud first switched, or possibly not until CMud, zScript trigger patterns are converted into regex and then compiled by the PCRE. You can test this by renaming the pcre.dll and you should find that all triggers cease to work.

I believe zMud retains the compiled pattern so that the PCRE compile step only needs to be done once for each trigger, again that optimization might have been introduced until CMud. However, using %match, %regex, or %subregex must do that compile step each time it is called.

In short, the zMud optimization guide is switch to CMud.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Sun Jan 08, 2017 2:43 pm   
 
Thanks for joining the conversation Vijilante. Thanks for catching that, I misread that post originally. So #trigger and #regex performance are the same, right?

Since it doesn't sound like there is a performance guide do you guys have any tips, tricks, or advice to pass on regarding zMUD specifically?

Does using the trigger options: case, notrig, and verbatim whenever possible increase trigger performance?

Can anyone provide more examples of how notrig option works exactly, the help files don't explain it well enough for me to feel like I fully understand.

Exp triggers should be avoided in zMUD correct?

Arrays should be avoided in zMUD correct?

Thanks again.

When I finally do have some cMUD questions I will post those in the cMUD section. Cheers!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jan 08, 2017 8:51 pm   
 
Arrays should be avoided in both zMud and CMud as they are COM objects and access external libraries on a slow interface. They should only be used when they are needed for other accesses on the same slow interface.

Expression triggers work alright in zMud, but I can't recall the exact testing moment. {a=1; {test exp triggers};#SHOW something;(end of code)} versus {a=1; #SHOW something;(end of code);{test exp triggers}}

Controlling case and verbatim on triggers makes only a small difference on pattern matching speed. Flagging NoTrigger makes a big difference if your trigger is using #ECHO, #SHOW, #SAY, or #PRINT; otherwise it is completely irrelevant.

And that is why there is no optimization guide for zMud's version of zScript. It is very difficult to provide any sort of hard and fast rules.

About the only constant sort of rule I can say is make your scripts as small as possible, which has the horrible side effect of complete illegibility. Shorten names for everything you can. Go down to 1 letter if possible. This is because the entire script has to be copied with references like %1 being replaced with text, and then it parsed for execution. Looping though something has the same parsing to go through each time. Look up "JavaScript mangling" and you may find a good explanation about this effect. CMud completely eliminates this penalty and then provides other ways to massively optimize code.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Mon Jan 09, 2017 10:13 pm   
 
Good information, Thanks Vijilante!

Can you explain notrig a bit more?
I notice that #ONINPUT triggers automatically default with the notrig option where normal trigger do not.
You say above that notrig only helps when using those specific commands in a trigger, does it matter if the #SHOW, #SAY, ect... are in the trigger itself or are called by an #ALIAS from the trigger?

Talking about keeping scripts concise I have a question.
We use a script a community member wrote a long time ago to search for current room name in our map and then teleport map position to correct room.

You have seen it here: http://forums.zuggsoft.com/forums/viewtopic.php?t=38906

Would taking this and breaking it down into smaller #ALIAS sections and #ABORT-ing out of it when a match is found be an example of what you mean by making scripts smaller?
Would the #ALIAS sections only get parsed up to the point of the #ABORT instead of the entire trigger as it stands now?

Should I be making my commands small as possible also by using the shortest abbreviation? #TR for #TRIGGER, #VAR for #VARIABLE, ect..??

Another question, when using %mapquery to find the room name in the above link'd script it currently searches the entire map database for the name to match, about 300 zones at 100 rooms per zone. If I change the %mapquery to first search the current zone only is that going to give any noticeable performance increase in the search? Or does it not work like that?

Anything else you can think of on the subject would be awesome.

Again, Thank you.

Very Happy
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jan 10, 2017 12:29 pm   
 
An alias called from a trigger is part of the same execution chain and is therefore an output of that trigger.

Generally you should not create complex settings from within a script. Even temporary alarms and triggers can be totally eliminated using multi-state systems with a manual state to lock out the rest of the trigger. #VAR can be replaced using var=something.

Changing the %mapquery in that script to target only 1 zone won't help anything because the whole database has to be searched to find which entries have the correct zone number. Changing the query to handle both name and description at the same time would be an improvement.
FoundRooms=%mapquery (%concat("(NAME = '", @FindRoomName, "') AND (DESC LIKE '", @FindRoomDesc, "%')"))

That particular script has many things wrong with it and can be improved considerably. I won't get into all of it. Breaking it into smaller aliases could be beneficial, but not when you start adding #ABORT. Use good flow control. Put the portion to search by exits into a separate alias and then only call that alias when it is going to do the search. Don't go backwards to change line colors with the #COLOR command, output them in the correct color in the first place. And WTF is this %char(32) at the start of #SAYs, if you want a space there use quotes. " Failed to retrieve room info!"

General optimization rule for all languages...don't repeat code that does not need to be repeated.
Bad:
#FORALL @RoomsFoundByDesc {#IF (@frsubexits(@FindRoomExits)=@frsubexits(%roomexit( %i))) {#ADDITEM RoomsFoundByExits %i}}
Better:
FindRoomExits=@frsubexits(@FindRoomExits)
#FORALL @RoomsFoundByDesc {#IF (@FindRoomExits=@frsubexits(%roomexit( %i))) {#ADDITEM RoomsFoundByExits %i}}

Even better would be to get rid of the frsubexits function, improve the trigger so it captures just the exits, use %lower to match to the results of %roomexit, use %subchar instead of %replace to change to list format, and then:
#FORALL @RoomsFoundByDesc {#IF (@FindRoomExits=%sort(%roomexit( %i))) {#ADDITEM RoomsFoundByExits %i}}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
MisterDwooD
Novice


Joined: 04 Feb 2014
Posts: 42

PostPosted: Tue Jan 10, 2017 5:32 pm   
 
Oh how I wish I had you in my employ for a week. :)

You're awesome for helping Vijilante.
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Wed Jan 11, 2017 4:52 am   
 
Thank you Vijilante, more great information. I plan on re-writing that script so any other suggestions are very welcomed.

Vijilante wrote:
Generally you should not create complex settings from within a script. Even temporary alarms and triggers can be totally eliminated using multi-state systems with a manual state to lock out the rest of the trigger. #VAR can be replaced using var=something.

Can you point me to an example of the above quote?
Reason why var=something format is preferred to #VAR name {something}?
I stopped using var=something because sometimes zMUD would send var=something to the mud instead of setting/creating the variable and sometimes it would work as intended. Any idea what I did wrong there?

Vijilante wrote:
Don't go backwards to change line colors with the #COLOR command, output them in the correct color in the first place.

How do you output color without going backwards with #COLOR? Use MXP tags?

Vijilante wrote:
Even better would be to get rid of the frsubexits function, improve the trigger so it captures just the exits, use %lower to match to the results of %roomexit, use %subchar instead of %replace to change to list format, and then:
#FORALL @RoomsFoundByDesc {#IF (@FindRoomExits=%sort(%roomexit( %i))) {#ADDITEM RoomsFoundByExits %i}}

I will try doing this.

Thank you.


Last edited by Medakan on Wed Jan 11, 2017 9:09 pm; edited 1 time in total
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Wed Jan 11, 2017 9:07 pm   
 
If anyone has any more to add to any of the discussion in the above posts please feel free to contribute.

I am going to take all of the things I am learning and apply them to my script collection posted here: http://www.wotmudarchives.org/forum/viewtopic.php?f=8&t=2409

If anyone is interested in checking them out and willing to give feedback I'd be grateful. These are scripts that I have wrote or adapted from other community members over at WoTmud.

Once I finish off getting them polished for zMUD I will start work on transferring them all over to cMUD and learning all the optimization differences for that.

Thanks in advance!

Very Happy

Taziar Medakan
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jan 11, 2017 11:42 pm   
 
To avoid using #COLOR you would use either %ansi or MXP tags. The %ansi function has a smaller set of colors from which to choose. You can create a function to wrap the MXP for you:
#FUNC MXPColor {%concat("<COLOR FORE=", %1, %if(%2<>"", %concat("BACK=", %2)), ">", %3, "</COLOR>")}

I can create an example for the use of manual to block alarms or triggers, but remember that #T+ and #T- also work very well.
#TRIGGER "IDNeededToWork" {} {} {} "manual"
#COND {-60} {#SAY Sixty seconds are up;#BEEP} {alarm}

Then in a script that wants to activate the alarm:
#STATE IDNeededToWork 1

The benefits of using that method is that you don't have to put a #T- to shut it off, the shut off is automatic. Also it will be in the off state whenever you first load your session. Finally if you place all such triggers in a single class you can use #RESET to put them all back to state 0 in an atdisconnect or atexit alias (see Introduction to Aliases).
_________________
The only good questions are the ones we have never answered before.
Search the Forums

Last edited by Vijilante on Fri Jan 13, 2017 6:03 pm; edited 1 time in total
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Fri Jan 13, 2017 2:45 am   
 
Vijilante,

I reworked this script with what I thought you meant by using #FUNCTION to wrap the MXP tags.
I added extra triggers to turn trackLineTrigger on/off just as an example of how I usually handle that kind of action.
The first two #ALIAS are just help files for users.

Thoughts, suggestions, expletives? :P

First here is an example of mud output with script off:

Code:
The Cityguard Stables
The stables house the horses that are reserved for the guards of the city.
The clean stalls and lack of remaining refuse indicates the meticulous
nature of the stable hands. Horses of every size and breed are boarded
here, taken good care of until their masters are in need of them. The sigil
of the guard stands out above the entrance of the rock barn.
[ obvious exits: W ]
There are some tracks of a ridden mount leaving west.
There are some tracks of a human leaving west.
There are some tracks of a human leaving west.
There are some tracks of a human leaving west.
There are some tracks of a humanoid leaving west.
There are some tracks of a humanoid leaving west.
The corpse of a black cat is lying here.
The corpse of a rat is lying here.
An iron lantern hangs from the wall above the gate.
|1|.A warhorse is here, stamping his feet impatiently.
A man walks among the horses here feeding them and rubbing them down.
|2|.A black stallion prances about.
A man stands here ready to make you a deal on a horse.
|3|.A shaggy brown mare stands here.

* HP:Healthy MV:Full >


And here is script:

Code:
#CLASS {AutoTrack} {disable}
#ALIAS helpAutoTrack {
   #SHOW {""}
   #SHOW {""}
   #SAY {"-----AutoTrack Help File-----"}
   #SHOW {""}
   #SAY {"Color commands use %colorname() color options:"}
   #SHOW {""}
   #SHOW {Example: There are some @trackMXPcolorSub(firebrick,bloody traces,dodgerblue,human,lime,>>,royalblue,east)}
   #SHOW {""}
   #SHOW {"Type: dirCharColor <color> to change text color of symbols that encompass track direction."}
   #SHOW {"Type: dirWordColor <color> to change text color of the direction (north|south|east|west|up|down)."}
   #SHOW {"Type: humanColor <color> to change the text color when autotracking a human."}
   #SHOW {"Type: trollocColor <color> to change the text color when autotracking a trolloc."}
   #SHOW {"Type: fadeColor <color> to change the text color when autotracking a myrddraal."}
   #SHOW {"Type: dreadlordColor <color> to change the text color when autotracking a dreadlord."}
   #SHOW {"Type: mountColor <color> to change the text color when autotracking a ridden mount."}
   #SHOW {""}
   #SHOW {"Note: optional background color syntax for above commands: <typeColor> <color color>"}
   #SHOW {"Example: fadeColor firebrick black"}
   #SHOW {""}
   #SAY {"Caps commands toggle the upper and lower case of patterns in an autotrack line:"}
   #SHOW {""}
   #SHOW {Example: There are some @trackMXPcolorSub(firebrick,BLOODY TRACES,dodgerblue,HUMAN,lime,>>,royalblue,EAST)}
   #SHOW {""}
   #SHOW {"Type: directionCaps to toggle the upper and lower cases of the cardinal directions."}
   #SHOW {"Type: bloodyCaps to toggle the upper and lower cases of bloody traces."}
   #SHOW {"Type: humanCaps to toggle the upper and lower cases of human."}
   #SHOW {"Type: trollocCaps to toggle the upper and lower cases of trolloc."}
   #SHOW {"Type: seanchanCaps to toggle the upper and lower cases of seanchan."}
   #SHOW {"Type: fadeCaps to toggle the upper and lower cases of myrddraal."}
   #SHOW {"Type: dreadlordCaps to toggle the upper and lower cases of dreadlord."}
   #SHOW {"Type: mountCaps to toggle the upper and lower cases of ridden mount."}
   #SHOW {""}
   #SAY {" helpAutoTrackColors to view available colors (spam warning)"}
   #SHOW {""}
   }
#ALIAS helpAutoTrackColors {
   #SAY {"Supported colors are:"}
   #SHOW ~<color aliceblue black> aliceblue ~</color>
   #SHOW ~<color antiquewhite black> antiquewhite ~</color>
   #SHOW ~<color aqua black> aqua ~</color>
   #SHOW ~<color aquamarine black> aquamarine ~</color>
   #SHOW ~<color azure black> azure ~</color>
   #SHOW ~<color beige black> beige ~</color>
   #SHOW ~<color bisque black> bisque ~</color>
   #SHOW ~<color black white> black ~</color>
   #SHOW ~<color blanchedalmond black> blanchedalmond ~</color>
   #SHOW ~<color blue black> blue ~</color>
   #SHOW ~<color blueviolet black> blueviolet ~</color>
   #SHOW ~<color brown black> brown ~</color>
   #SHOW ~<color burlywood black> burlywood ~</color>
   #SHOW ~<color cadetblue black> cadetblue ~</color>
   #SHOW ~<color chartreuse black> chartreuse ~</color>
   #SHOW ~<color chocolate black> chocolate ~</color>
   #SHOW ~<color coral black> coral ~</color>
   #SHOW ~<color cornflowerblue black> cornflowerblue ~</color>
   #SHOW ~<color cornsilk black> cornsilk ~</color>
   #SHOW ~<color crimson black> crimson ~</color>
   #SHOW ~<color cyan black> cyan ~</color>
   #SHOW ~<color darkblue black> darkblue ~</color>
   #SHOW ~<color darkcyan black> darkcyan ~</color>
   #SHOW ~<color darkgoldenrod black> darkgoldenrod ~</color>
   #SHOW ~<color darkgray black> darkgray ~</color>
   #SHOW ~<color darkgreen black> darkgreen ~</color>
   #SHOW ~<color darkkhaki black> darkkhaki ~</color>
   #SHOW ~<color darkmagenta black> darkmagenta ~</color>
   #SHOW ~<color darkolivegreen black> darkolivegreen ~</color>
   #SHOW ~<color darkorange black> darkorange ~</color>
   #SHOW ~<color darkorchid black> darkorchid ~</color>
   #SHOW ~<color darkred black> darkred ~</color>
   #SHOW ~<color darksalmon black> darksalmon ~</color>
   #SHOW ~<color darkseagreen black> darkseagreen ~</color>
   #SHOW ~<color darkslateblue black> darkslateblue ~</color>
   #SHOW ~<color darkslategray black> darkslategray ~</color>
   #SHOW ~<color darkturquoise black> darkturquoise ~</color>
   #SHOW ~<color darkviolet black> darkviolet ~</color>
   #SHOW ~<color deeppink black> deeppink ~</color>
   #SHOW ~<color deepskyblue black> deepskyblue ~</color>
   #SHOW ~<color dimgray black> dimgray ~</color>
   #SHOW ~<color dodgerblue black> dodgerblue ~</color>
   #SHOW ~<color firebrick black> firebrick ~</color>
   #SHOW ~<color floralwhite black> floralwhite ~</color>
   #SHOW ~<color forestgreen black> forestgreen ~</color>
   #SHOW ~<color fuchsia black> fuchsia ~</color>
   #SHOW ~<color gainsboro black> gainsboro ~</color>
   #SHOW ~<color ghostwhite black> ghostwhite ~</color>
   #SHOW ~<color gold black> gold ~</color>
   #SHOW ~<color goldenrod black> goldenrod ~</color>
   #SHOW ~<color gray black> gray ~</color>
   #SHOW ~<color green black> green ~</color>
   #SHOW ~<color greenyellow black> greenyellow ~</color>
   #SHOW ~<color honeydew black> honeydew ~</color>
   #SHOW ~<color hotpink black> hotpink ~</color>
   #SHOW ~<color indianred black> indianred ~</color>
   #SHOW ~<color indigo black> indigo ~</color>
   #SHOW ~<color ivory black> ivory ~</color>
   #SHOW ~<color khaki black> khaki ~</color>
   #SHOW ~<color lavender black> lavender ~</color>
   #SHOW ~<color lavenderblush black> lavenderblush ~</color>
   #SHOW ~<color lawngreen black> lawngreen ~</color>
   #SHOW ~<color lemonchiffon black> lemonchiffon ~</color>
   #SHOW ~<color lightblue black> lightblue ~</color>
   #SHOW ~<color lightcoral black> lightcoral ~</color>
   #SHOW ~<color lightcyan black> lightcyan ~</color>
   #SHOW ~<color lightgoldenrodyellow black> lightgoldenrodyellow ~</color>
   #SHOW ~<color lightgreen black> lightgreen ~</color>
   #SHOW ~<color lightgrey black> lightgrey ~</color>
   #SHOW ~<color lightpink black> lightpink ~</color>
   #SHOW ~<color lightsalmon black> lightsalmon ~</color>
   #SHOW ~<color lightseagreen black> lightseagreen ~</color>
   #SHOW ~<color lightskyblue black> lightskyblue ~</color>
   #SHOW ~<color lightslategray black> lightslategray ~</color>
   #SHOW ~<color lightsteelblue black> lightsteelblue ~</color>
   #SHOW ~<color lightyellow black> lightyellow ~</color>
   #SHOW ~<color lime black> lime ~</color>
   #SHOW ~<color limegreen black> limegreen ~</color>
   #SHOW ~<color linen black> linen ~</color>
   #SHOW ~<color magenta black> magenta ~</color>
   #SHOW ~<color maroon black> maroon ~</color>
   #SHOW ~<color mediumaquamarine black> mediumaquamarine ~</color>
   #SHOW ~<color mediumblue black> mediumblue ~</color>
   #SHOW ~<color mediumorchid black> mediumorchid ~</color>
   #SHOW ~<color mediumpurple black> mediumpurple ~</color>
   #SHOW ~<color mediumseagreen black> mediumseagreen ~</color>
   #SHOW ~<color mediumslateblue black> mediumslateblue ~</color>
   #SHOW ~<color mediumspringgreen black> mediumspringgreen ~</color>
   #SHOW ~<color mediumturquoise black> mediumturquoise ~</color>
   #SHOW ~<color mediumvioletred black> mediumvioletred ~</color>
   #SHOW ~<color midnightblue black> midnightblue ~</color>
   #SHOW ~<color mintcream black> mintcream ~</color>
   #SHOW ~<color mistyrose black> mistyrose ~</color>
   #SHOW ~<color moccasin black> moccasin ~</color>
   #SHOW ~<color navajowhite black> navajowhite ~</color>
   #SHOW ~<color navy black> navy ~</color>
   #SHOW ~<color oldlace black> oldlace ~</color>
   #SHOW ~<color olive black> olive ~</color>
   #SHOW ~<color olivedrab black> olivedrab ~</color>
   #SHOW ~<color orange black> orange ~</color>
   #SHOW ~<color orangered black> orangered ~</color>
   #SHOW ~<color orchid black> orchid ~</color>
   #SHOW ~<color palegoldenrod black> palegoldenrod ~</color>
   #SHOW ~<color palegreen black> palegreen ~</color>
   #SHOW ~<color paleturquoise black> paleturquoise ~</color>
   #SHOW ~<color palevioletred black> palevioletred ~</color>
   #SHOW ~<color papayawhip black> papayawhip ~</color>
   #SHOW ~<color peachpuff black> peachpuff ~</color>
   #SHOW ~<color peru black> peru ~</color>
   #SHOW ~<color pink black> pink ~</color>
   #SHOW ~<color plum black> plum ~</color>
   #SHOW ~<color powderblue black> powderblue ~</color>
   #SHOW ~<color purple black> purple ~</color>
   #SHOW ~<color red black> red ~</color>
   #SHOW ~<color rosybrown black> rosybrown ~</color>
   #SHOW ~<color royalblue black> royalblue ~</color>
   #SHOW ~<color saddlebrown black> saddlebrown ~</color>
   #SHOW ~<color salmon black> salmon ~</color>
   #SHOW ~<color sandybrown black> sandybrown ~</color>
   #SHOW ~<color seagreen black> seagreen ~</color>
   #SHOW ~<color seashell black> seashell ~</color>
   #SHOW ~<color sienna black> sienna ~</color>
   #SHOW ~<color silver black> silver ~</color>
   #SHOW ~<color skyblue black> skyblue ~</color>
   #SHOW ~<color slateblue black> slateblue ~</color>
   #SHOW ~<color slategray black> slategray ~</color>
   #SHOW ~<color snow black> snow ~</color>
   #SHOW ~<color springgreen black> springgreen ~</color>
   #SHOW ~<color steelblue black> steelblue ~</color>
   #SHOW ~<color tan black> tan ~</color>
   #SHOW ~<color teal black> teal ~</color>
   #SHOW ~<color thistle black> thistle ~</color>
   #SHOW ~<color tomato black> tomato ~</color>
   #SHOW ~<color turquoise black> turquoise ~</color>
   #SHOW ~<color violet black> violet ~</color>
   #SHOW ~<color wheat black> wheat ~</color>
   #SHOW ~<color white black> white ~</color>
   #SHOW ~<color whitesmoke black> whitesmoke ~</color>
   #SHOW ~<color yellow black> yellow ~</color>
   #SHOW ~<color yellowgreen black> yellowgreen ~</color>
   }
#ALIAS dirCharColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorCharacter {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorCharacter,character direction)}
      }
   }
#ALIAS dirWordColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorDirection {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorDirection,directional)}
      }
   }
#ALIAS humanColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorHuman {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorHuman,human)}
      }
   }
#ALIAS trollocColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorTrolloc {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorTrolloc,trolloc)}
      }
   }
#ALIAS seanchanColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorSeanchan {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorSeanchan,seanchan)}
      }
   }
#ALIAS fadeColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorMyrddraal {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorMyrddraal,myrddraal)}
      }
   }
#ALIAS dreadlordColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorDreadlord {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorDreadlord,dreadlord)}
      }
   }
#ALIAS mountColor {
   #SHOW {""}
   #IF (%colorname(%1)=536870911 AND %color(%1)=0) {
      #SAY {" "%1 is an invalid color...}
      } {
      #VAR trackColorRiddenMount {%-1}
      #SHOW {"Type: "@trackMXPcolor(@trackColorRiddenMount,ridden mount)}
      }
   }
#ALIAS bloodyCaps {
   #IF (@trackCapBloody) {#VAR trackCapBloody {0}} {#VAR trackCapBloody {1}}
   #IF (@trackCapBloody) {#SAY {BLOODY TRACES are now upper case.}} {#SAY {bloody traces are now lower case.}}
   }
#ALIAS humanCaps {
   #IF (@trackCapHuman) {#VAR trackCapHuman {0}} {#VAR trackCapHuman {1}}
   #IF (@trackCapHuman) {#SAY {HUMAN is now upper case.}} {#SAY {human is now lower case.}}
   }
#ALIAS mountCaps {
   #IF (@trackCapRiddenMount) {#VAR trackCapRiddenMount {0}} {#VAR trackCapRiddenMount {1}}
   #IF (@trackCapRiddenMount) {#SAY {RIDDEN MOUNT is now upper case.}} {#SAY {ridden mount is now lower case.}}
   }
#ALIAS trollocCaps {
   #IF (@trackCapTrolloc) {#VAR trackCapTrolloc {0}} {#VAR trackCapTrolloc {1}}
   #IF (@trackCapTrolloc) {#SAY {TROLLOC is now upper case.}} {#SAY {trolloc is now lower case.}}
   }
#ALIAS seanchanCaps {
   #IF (@trackCapSeanchan) {#VAR trackCapSeanchan {0}} {#VAR trackCapSeanchan {1}}
   #IF (@trackCapSeanchan) {#SAY {SEANCHAN is now upper case.}} {#SAY {seanchan is now lower case.}}
   }
#ALIAS fadeCaps {
   #IF (@trackCapMyrddraal) {#VAR trackCapMyrddraal {0}} {#VAR trackCapMyrddraal {1}}
   #IF (@trackCapMyrddraal) {#SAY {MYRDDRAAL is now upper case.}} {#SAY {myrddraal is now lower case.}}
   }
#ALIAS dreadlordCaps {
   #IF (@trackCapDreadlord) {#VAR trackCapDreadlord {0}} {#VAR trackCapDreadlord {1}}
   #IF (@trackCapDreadlord) {#SAY {DREADLORD is now upper case.}} {#SAY {dreadlord is now lower case.}}
   }
#ALIAS directionCaps {
   #IF (@trackCapDirection) {#VAR trackCapDirection {0}} {#VAR trackCapDirection {1}}
   #IF (@trackCapDirection) {#SAY {NORTH|EAST|SOUTH|WEST|UP|DOWN is now upper case.}} {#SAY {north|east|south|west|up|down is now lower case.}}
   }
#FUNCTION trackMXPcolor {<color %1>%1</color> is now set as your <color %1>%2</color> text color.}
#FUNCTION trackMXPcolorSub {<color %1>%2</color> of a <color %3>%4</color> leaving <color %5>%6</color><color %7>%8</color><color %5>%6</color>}
#VAR trackDirectionalCharacter {}
#VAR trackWestCharacter {"<<"}
#VAR trackEastCharacter {">>"}
#VAR trackNorthCharacter {"^^"}
#VAR trackSouthCharacter {"vv"}
#VAR trackUpCharacter {"++"}
#VAR trackDownCharacter {"--"}
#VAR trackColorDirection {cyan}
#VAR trackColorCharacter {green}
#VAR trackColorHuman {cyan}
#VAR trackColorTrolloc {red}
#VAR trackColorSeanchan {magenta}
#VAR trackColorMyrddraal {red}
#VAR trackColorDreadlord {red}
#VAR trackColorRiddenMount {blue}
#VAR trackColorType {}
#VAR trackColorBloody {red}
#VAR trackColorTracks {}
#VAR trackCapBloody {0}
#VAR trackCapHuman {0}
#VAR trackCapTrolloc {0}
#VAR trackCapSeanchan {0}
#VAR trackCapMyrddraal {0}
#VAR trackCapDreadlord {0}
#VAR trackCapRiddenMount {0}
#VAR trackCapDirection {1}
#VAR trackTypeList {dreadlord|human|myrddraal|ridden mount|seanchan|trolloc}
#VAR trackTracesSub {}
#VAR trackTypeSub {}
#VAR trackDirectionSub {}
#TRIGGER "trackExitsTrigger" {^~[ obvious exits: * ~]$} {
   #T+ {trackLineTrigger}
   #T+ {trackPromptTrigger}
   } "" {case}
#TRIGGER "trackPromptTrigger" {{*|o}{ R | | S }HP:} {
   #T- {trackPromptTrigger}
   #T- {trackLineTrigger}
   } "" {case|disable|nocr|prompt}
#TRIGGER "trackLineTrigger" {^There are some ({tracks|bloody traces}) of a ({@trackTypeList}) leaving (%w).$} {
   #PRIORITY {
      #IF (%1=tracks) {
         #VAR trackColorTracks {}
         #VAR trackTracesSub {%1}
         } {
         #VAR trackColorTracks {@trackColorBloody}
         #IF (@trackCapBloody) {#VAR trackTracesSub {%upper(%1)}} {#VAR trackTracesSub {%1}}
         }
      #IF (%expand(%concat("@trackCap",%replace(%2," ","")))) {#IF (%eval(%concat("@trackCap",%replace(%2," ","")))) {#VAR trackTypeSub {%upper(%2)}} {#VAR trackTypeSub {%2}}} {}
      #IF (%ismember(%2,@trackTypeList)) {#VAR trackColorType {%expand(%concat("@trackColor",%replace(%2," ","")))}} {#VAR trackColorType {}}
      #IF (@trackCapDirection) {#VAR trackDirectionSub {%upper(%3)}} {#VAR trackDirectionSub {%3}}
      #VAR trackDirectionalCharacter {%eval(%concat("@track",%3,"character"))}
      #SUB {There are some @trackMXPcolorSub(@trackColorTracks,@trackTracesSub,@trackColorType,@trackTypeSub,@trackColorCharacter,@trackDirectionalCharacter,@trackColorDirection,@trackDirectionSub)}
      }
   } "" {case|disable}
#CLASS 0


Here is an example with script active:

Code:
The Cityguard Stables
The stables house the horses that are reserved for the guards of the city.
The clean stalls and lack of remaining refuse indicates the meticulous
nature of the stable hands. Horses of every size and breed are boarded
here, taken good care of until their masters are in need of them. The sigil
of the guard stands out above the entrance of the rock barn.
[ obvious exits: W ]
There are some tracks of a ridden mount leaving <<WEST<<
There are some tracks of a human leaving <<WEST<<
There are some tracks of a human leaving <<WEST<<
There are some tracks of a human leaving <<WEST<<
There are some tracks of a humanoid leaving west.
There are some tracks of a humanoid leaving west.
The corpse of a black cat is lying here.
The corpse of a rat is lying here.
An iron lantern hangs from the wall above the gate.
|1|.A warhorse is here, stamping his feet impatiently.
A man walks among the horses here feeding them and rubbing them down.
|2|.A black stallion prances about.
A man stands here ready to make you a deal on a horse.
|3|.A shaggy brown mare stands here.

* HP:Healthy MV:Full >
Reply with quote
Medakan
Novice


Joined: 15 Dec 2015
Posts: 41
Location: Seattle

PostPosted: Fri Jan 13, 2017 3:04 pm   
 
This seems to work well for coloring an entire line using the MXP wrapping:

#FUNCTION testMXPcolor {<color %1>%2</color>}
#SHOW {@testMXPcolor(colorName,Line to be colored text goes here.)}

To add a space in front of text line instead of using the weird %char(32) in find room script:

#SHOW {@testMXPcolor(colorName," "Line to be colored text goes here.)}

Is this what you meant Vijilante?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jan 13, 2017 6:09 pm   
 
Yes about the MXP color. I forgot I have to disable something for my post to display correctly, I fixed that and you can read my previous post.

About those spaces at the start of a line:
#SHOW {@testMXPcolor(colorName," Line to be colored text goes here.")}
#SAY " %1 is an invalid color..."
And for a blank line all you need is #SAY or #SHOW by itself.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net