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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Lyrael
Beginner


Joined: 17 Mar 2004
Posts: 17
Location: USA

PostPosted: Fri Jul 06, 2007 5:20 am   

Help for Achaea specifically
 
Hi all,

I'm afraid I'm a bit of a thunk-head when it comes to scripting - but I'm trying to painfully and slowly understand at least some of it.

At any rate, I recently started playing a game/MUD called Achaea and tried to command line paste some scripts intended for zMud. Of course they're not working. And I have no idea how to "fix" them.

the first thing I'm wanting to do is take the output from a number of commands related to dumping out a list of names and then wanting to be able to color code the names in that list whenever they are output from the MUD, whether it be in a who listing, seeing them in a room, hearing them over a channel, etc.

the command output looks like this (with typically in excess of 300 names):


Code:
Calliope,Clio,Euterpe,Thalmia,Melpomene,Tepsichore,Erato,Polyhymnia,Urania


Here is the script, written by a player named Trevize for zMud 7.21

Code:
#CLASS {Shadow}
#CLASS 0
#DELC  {Shadow|Enemies}
#CLASS {Shadow|Enemies}
#VAR enemiesversion {1.1}
#VAR enemycolor {}
#ADDKEY enemycolor {city} {12}
#ADDKEY enemycolor {house} {12}
#ADDKEY enemycolor {order} {12}
#VAR enemychecking {}
#ADDKEY enemychecking {city} {1}
#ADDKEY enemychecking {house} {1}
#ADDKEY enemychecking {order} {1}
#CLASS 0
#CLASS {Shadow|Enemies|enemyscript}
#ALIAS enemycheck {#if (@enemychecking.order=1) {order enemies};#if (@enemychecking.house=1) {house enemies};#if (@enemychecking.city=1) {city enemies}}
#ALIAS excludelist {#FORALL @{%1} {#delitem %2 %i}}
#ALIAS enemy {#if ("%1"="on") {#t+ orderehighlight;#t+ houseehighlight;#t+ cityehighlight;#say %ansi( 7)Enemy highlighting on.} {#if ("%1"="off") {#t- orderehighlight;#t- houseehighlight;#t- cityehighlight;#say %ansi( 7)Enemy highlighting off.} {~enemy %1}}}
#VAR enemylist {}
#VAR temp {} {}
#VAR orderenemies {}
#VAR cityenemies {}
#VAR houseenemies {}
#REGEX "enemywatch" {^Enemies of (the |)(Divine Order|City|).*$} {#if ("%1"="Divine Order") {orderenemies=%null;enemylist=order} {#if ("%1"="City") {cityenemies=%null;enemylist=city} {houseenemies=%null;enemylist=house}};temp=%null;#t- orderehighlight;#t- houseehighlight;#t- cityehighlight}
#COND {.*} {#t+ enemycapture trigger;#t+ enemystop trigger} {regex}
#REGEX "enemystop" {^Total\: \d+$} {#t- enemycapture trigger;temp=%replace( @temp, " ", "");#if (@enemylist="order") {orderenemies=@temp} {#if (@enemylist="city") {cityenemies=@temp} {#if (@enemylist="house") {houseenemies=@temp}}};temp=%null;#t- enemystop trigger;#t+ orderehighlight;#t+ houseehighlight;#t+ cityehighlight;excludelist orderenemies houseenemies;excludelist houseenemies cityenemies} "" {disable}
#REGEX "enemycapture" {(.*)} {temp=%concat( @temp, %replace( "%1", ",", "|"))} "" {disable}
#REGEX "cityehighlight" {\b(?:@cityenemies)\b} {#cw @enemycolor.city} "" {case}
#REGEX "houseehighlight" {\b(?:@houseenemies)\b} {#cw @enemycolor.house} "" {case}
#REGEX "orderehighlight" {\b(?:@orderenemies)\b} {#cw @enemycolor.order} "" {case}
#CLASS 0
#SAY [Shadow] Enemies script 1.1 installed.


Link to his site with explanation and use instructions: http://achaea.fadedparadox.com/zmud/index.php

It's not working for me. The only command I can run is the "enemycheck", and this still appears to grab and store the information in the wrong variable, and the alias to turn on and off the name highlighting trigger doesn't work for me at all.

Could anyone offer any suggestions or thoughts on how I might be able to get this to work in CMud?

Thanks in advance for any help - most appreciated.

Lyrael
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Jul 06, 2007 11:15 am   
 
I think there's a problem with the enemywatch trigger. It's capturing (the |) into %1 and checking the wrong thing in the code. It should probably be checking %2 for "Divine Order" or "City" instead. I would recommend using (.+) for the enemycapture trigger, too.

Of course, that's just to get it working in zMUD, for which the script was written. To make it work in CMUD, you'll likely need to make more changes. Ask Trevize for help.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Jul 06, 2007 11:24 am   
 
Read this section of the CMUD help files - this part is the relevant one. You need to remove the quotes from around the %nn variables, and then it should start working. In future, you can run the compatability report from the File menu of the package editor. This will flag up many common problems when converting, including this one.

Does the output still include the words Enemies of (the) City or Enemies of (the) Divine order, and have a line at the end reading "Total:"? The script relies on having those. It also seems like the script is expecting spaces between the names, though it shouldn't affect operation. I used this sample text to test the script:

Quote:
Enemies of the City:
Calliope, Clio, Euterpe, Thalmia, Melpomene, Tepsichore, Erato, Polyhymnia, Urania
Total: 92


If your text from the MUD doesn't match that (with or without the spaces) the script probably needs editing.

There's also a typo in the enemywatch trigger that should've been breaking the script back in zMUD - you need to change (the |) to (?:the |). With the %1 change and that one, it's working fine for me.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Lyrael
Beginner


Joined: 17 Mar 2004
Posts: 17
Location: USA

PostPosted: Sun Jul 08, 2007 12:37 am   
 
Wow, thanks everyone. I really appreciate the help. I made the changes suggested and all seems to be fine now. Very much appreciated.

Lyrael
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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