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
Istroath
Novice


Joined: 11 Feb 2005
Posts: 39

PostPosted: Wed Feb 16, 2005 5:08 pm   

Mapper
 
dose anyone know how to make the mapper look at the exits and see if there is a possible exit that dosent match reg u d n w e s se sw nw ne and then just simply color the room and so i may come back to it at a later time to check it out? this is what the room and exits would look like to better understand what im asking.

^roomname(u, d, e, w, n, s, ne, anything, nw, se, and sw)$

exit "anything" could be well just about anything lol but it would have to be a single word. so what i would love this client todo is scan the exit info and look for a possible "anything exit" and if it finds something to color the room blue so i can come back to it latter and see what its all about
also i should note that if there is only one exit in the room then it would not have the word "and" in the exit info also the "anything exit" could be the only exit makeing this code a little bit to tricky for me to handle alone
thank you for your time guys
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Wed Feb 16, 2005 6:12 pm   
 
Took about 5 minutes of fiddling (and youll more than likely have to play with the line trigger), but if you capture the whole line to %1 and exits to another variable (in my case exits are in %3) then this worked for me. Convert the exits to a list and save to variable then loop through each one and if the exit is more than two characters long highlight it... of course assumes short exit names.


^((*): (*)).$ <--- full line, room name, room exits

#VA List %REPLACE( "%3", ", ", "|")
#FORALL @List {#IF %len( %i)>2 {#pcol blue {%match( "%1", "%i")-1} {%match( "%1", "%i")+%len( %i)-2}}}
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Wed Feb 16, 2005 7:30 pm   
 
Oh yeah, didnt have the mapper open for testing at the time so this just detects the "anything exit" and highlights it in the mud. In your case, if you get a match, youll need to search the mapper for the room by room name and when you have that change the room color... sorry its not more complete but I think youll get the idea from the code above. Mr. Green
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Wed Feb 16, 2005 9:46 pm   
 
The biggest complication for this is matching the line, because the roomname is variable and all the exit information is variable the only constant in the line is the (). I would suggest we attempt to limit the scope of the trigger by detecting when you are moving, and also by placing the trigger in the System|Automapper class it will only be active while mapping. In order to detect when you are moving we will start with some valid map data, if your map is currently inaccurate the trigger will not work properly. Such as for rooms that have special exits that were not added already.

#CLASS {System|AutoMapper}
#VAR ExitData {} {}
#VAR ExitLine {} {}
#ALIAS onroomenter {ExitData=%roomexit}
#ONINPUT {^{@ExitData}$} {}
#COND {^*~((*)~)$} {ExitLine=%replace(%replace("%1",", ","|"),"and ","")}
#ALIAS onroomcreate {#FORALL @ExitLine {#IF (%match("%i","%t")=0) {#NOOP %roomexit(,%additem("%i",%roomexit))%roomcol(,blue)}}}
#CLASS 0
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Istroath
Novice


Joined: 11 Feb 2005
Posts: 39

PostPosted: Thu Feb 17, 2005 12:35 am   
 
well this is the logic i have the code dosnt work but i belive the ligic is sound so maby you could help me put this into code that works properly

#CLASS {mapping related}
#VAR REGEXITS {n|nw|w|sw|s|se|e|ne|u|d|and}
#VAR ROOMTEMP {Some grassy plains}
#VAR EXITSTEMP {n|e|s|and|w}
#TRIGGER {^(*)~((*)~)$} {#VAR ROOMTEMP "%1";#VAR EXITSTEMP %replace(%replace("%2",",","")," ","|");%if(@ROOMTEMP=%roomname,#FORALL @EXITSTEMP {%if(%ismember(%i,@REGEXITS),#NOOP,%roomcol(,blue))},#NOOP)}}
#CLASS 0

i have 2 questions about this 1st why cant i put # commands in an %if statement
if there is a way to do that it would make codeing a tone easyer
2nd what i tried todo to fix this was put all the # in aliases and have the %if call the alias instead but what was happening was the trigger would fire before the %roomname had a chance to update causeing a 0 return value but if i glanced in the room again the code would work and change the room color BUT also send the colorcode to the mud
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Thu Feb 17, 2005 2:25 am   
 
if you want to put #commands in an %if statement do this:
Code:
#exec %if(@coming,"#echo hello","#echo goodbye")


if @coming evaluates to true it should echo hello otherwise it echos false

instead of using the %if function you could use the #if command
Code:
#if (@coming) {#echo hello} {#echo goodbye}


the second snippet would do the exact same thing as the first.


By the way Istroath I was wondering is there any consistent colouring
on the exits line,and if so does your mud allow you to modify or specify
in any way how the line with exits is coloured.
Colouring would make it easier to identify when its a line containing exit information, if one were to use an ansi trigger
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Istroath
Novice


Joined: 11 Feb 2005
Posts: 39

PostPosted: Thu Feb 17, 2005 7:48 pm   
 
well now i have lost everything i tryed to put that coloring room script into the automapper class and got access volations galore and then a write error and finaly zmud shut down. i reopen to find i have lost everything
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Feb 17, 2005 11:50 pm   
 
It's probably too late, but zMUD always saves the previous settings file to the name *_BAK.MUD file within your character folder. For example, if your normal settings file is REALMS.MUD, then the backup is in REALMS_BAK.MUD. You can usually use this to recover from a crash like this. Of course, it's probably too late because once you change your settings again, the backup will get overwritten by the corrupted settings, which is why I usually turn off the AutoUpdate preference and only manually update my settings when I have made a change.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Feb 18, 2005 1:55 am   
 
Sorry about the loss

here is a breakdown of commands and functions, while you can put #commands in a %if statement its not recomened
#COMMANDS are meant to Execute something
%functions are meant to return something

#CLASS {mapping related}
#VAR REGEXITS {n|nw|w|sw|s|se|e|ne|u|d|and}
#VAR ROOMTEMP {Some grassy plains}
#VAR EXITSTEMP {n|e|s|and|w}
#TRIGGER {^(*)~((*)~)$} {
#VAR ROOMTEMP "%1"
#VAR EXITSTEMP %replace(%replace("%2",",","")," ","|")
#IF (%trim(@ROOMTEMP)=%trim(%roomname)) {
#FORALL @EXITSTEMP {#IF (!%ismember(%i,@REGEXITS) {#CALL %roomcol(,blue)}}
}
}
#CLASS 0
_________________
Zmud Support Library
Zmud Knowledge Base

Last edited by nexela on Sat Feb 19, 2005 4:02 pm; edited 1 time in total
Reply with quote
Istroath
Novice


Joined: 11 Feb 2005
Posts: 39

PostPosted: Sat Feb 19, 2005 3:06 pm   
 
oh yea and why dose %roomcol(,blue) send the hexi code to the mud along with coloring the room?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Feb 19, 2005 4:01 pm   
 
Ooops didn't catch that :p *above post edited to reflect*

Because %roomcol is a function it RETURNS a value the correct way to trap the return is by using #CALL
#CALL %roomcol(,blue)
_________________
Zmud Support Library
Zmud Knowledge Base
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