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
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Sun Sep 04, 2005 6:23 am   

<SpecialCharacters>
 
I am using 7.13b now.

I have tried a variety of methods, including %* and no matter what I do zMud filters out <>'s around a word.

Quote:
To vote: vote <name> for leader


Code:
#CLASS {System}
#TRIGGER {^To vote:&%*} {#WIN test %1}
#CLASS 0


Quote:
To vote: vote name for leader


Note it removes the <brackets> around the word. If it finds stand alone > or < characters which don't match around a single word, it will pass them into the window, otherwise it removes them.

Is there any way aroud this?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Sep 04, 2005 8:16 am   
 
#TRIGGER {^To vote: vote ~<(%w)~> for leader.} {#WIN test %1}

For special characters in triggers, use the tilde (~) before the characters. This includes parantheses and other special characters.

Charneus
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Sun Sep 04, 2005 10:20 am   
 
I want a solution that doesn't require me to know where the <>'s are in advance. That line was an example out of room description paragraph.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Sep 04, 2005 11:14 am   
 
Then try this?

Code:
#TRIGGER {%* ~<%*~> %*} {#WIN test %1}


This is untested, but I believe it will achieve the effect you're hoping for.

Or if you're using your previous quote, then it'd look like this:

Code:
#TRIGGER {^To vote:%* ~<%*~>} {#WIN test %1}


Or maybe a simple solution would be in the Preferences:

Go to View, Preferences, General, General Parsing. In the second column, uncheck the box next to "Allow <> for expand."

That, I believe, would also resolve your problem.

Charneus
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Sep 04, 2005 4:40 pm   
 
%1 from your trigger pattern is not actually defined. The system is nice enough to through the entire line in there, but that can not be relied on, as it is undocumented and may change at any time. Also you have some misused pattern things. The & should only be used when followed by a variable name, or when quoted ~& so it means match an ampersand. Next off %1 is being expanded early (look up expansion or early in the help), then your Preference setting of "Allow <> for expand" takes over and preforms the stripping of the <>. This setting can be adjusted in Script Parser|General Parsing, I recommend turning it off to increase control over script behavior. I also reccommend turning off "Allow [] for eval". I never use either of the shortcuts and often find they get in the way of more complex manual parsings of text.

You should read up on Pattern matching in the help. It is found in the reference section. Also take a look at Predefined Variables, they can be your friends.
#TRIGGER {^To vote:*} {#WIN test {%line}}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Sun Sep 04, 2005 9:19 pm   
 
Humm.... alright. Playing with some of this. I now have indentation working correctly but it is still eating my <>'s and some other special characters for that matter. I am suddenly very afraid of semicolons.

Is it possible to simply turn all this expansion nonsense off and be done with it? I do not want it to be parseing special characters and such from WITHIN a variable! That's just plain silly.

Code:
         [FISH] <ARE> !GOOD 'EAT' "'DEM" ":UP" (GOOD) {JA} ;STOP NO!!

Code:

#CLASS {System}
#VAR DescLine ""
#TRIGGER {^(*)$} {
  #VAR DescLine "%1"
  #WIN test_desc @DescLine
  #TAG desc @DescLine
  }
#CLASS 0


Code:
"          [FISH] ARE !GOOD 'EAT' "'DEM" ":UP" (GOOD) {JA} "
"STOP NO!! "


As you can see it botched the <>'s and terrfyingly enough took the semicolon and sent it back at itself to be captured again in a new line of text.

The settings I tried were Allow [] for eval OFF, Allow <> for expand ON *Cries* and Expand Vars OFF. The reason I left <> expand on is because if I turn it off, I get this instead.

Code:
"          [FISH]  !GOOD 'EAT' "'DEM" ":UP" (GOOD) {JA} "
"STOP NO!! "


HOW HARD CAN IT BE TO SIMPLY GRAB A LINE OF TEXT WITHOUT CHANGING IT IN ANY WAY! *CRIES*

P.S. Note to self. Study up on #CONDITION next, since it's apparently possible for players to use ANSI code in their room description blocks which screws up my idea of filtering the description block out by color. *CRIES*
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Sun Sep 04, 2005 9:37 pm   
 
OOoooooooohhhhh..... Well I fixed one small part of that. Found and disabled the ; special character which I don't actually use in any way. Pretty print is much easier to read.

I still have the <> problem however. And I am hoping to find and head off any other such zMud filtering issues before I get too deeply invested in a bunch of code.
Reply with quote
Zugg
MASTER


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

PostPosted: Sun Sep 04, 2005 10:06 pm   
 
The problem isn't with the trigger. The <> *are* getting stored in %1. The problem (as Vijilante mentioned) is that when you use store %1 in a variable or try and print it out or send it to another window, the <> are getting parsed as the immediate expansion symbols.

Go into your Preferences and turn off the "Expand <>..." option and see if that helps. You can also try using the %literal function when assigning %1, such as:

#VAR temp %literal(%1)

and see if that works better. But turning off the <> expansion option is the best if you never need to use it.

The other problem that might be causing this is that if your window is in MXP secure mode, it might be treating the value in <> as an unknown HTML tag and stripping it. You can try turning off MXP emulation to see if that helps to determine if that's the problem.

Anyway, as I mentioned, I think zMUD *is* capturing the text correctly, but then when you try to print it out it is getting parsed.
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Sun Sep 04, 2005 10:28 pm   
 
Okay. Pardon me for ranting but my patience is really coming to an end here.

turning off ; didn't work in my actual code. I even did a FIND on my script and verified that there was not even one single ; character in the text. Yet if I disable it, it sticks my entire script in the shredder and spits out little confetti.

Also, my indentation code doesn't work either.

Code:
#VAR DescLine ""
#TRIGGER {^(*)$} {
  #VAR DescLine "%1"
  #WIN test_desc @DescLine
  #TAG desc @DescLine
  }


This will work. It captures the entire line, complete with indentation. With the proper settings it doesn't even choke much at special characters in the text. I would very much not like it to choke at all, thank you very much.

Code:
#TRIGGER {^%e[44m(*)%e[0m$} {
  #VAR DescLine {%1%lf}
  #TAG desc @DescLine
  #WIN test_desc @DescLine
  #COLOR "#80FFFF,#000080"
  } "" {color}


This however, Churns out text indented like.... And it still pukes at special characters. If anyone ever uses a semi colon in their description block I am simply screwed, and I know of a few rooms where it will choke on the <>'s

Code:

Here is where Sentinels practice their martial and magical skills.  Murals
 and paintings of optical illusions abound, where Sentinels practice the fine
 art of observation.  Filled with puzzles and brain-teasers, it is here also
 that Sentinels practice the fine art of forensics in pursuing criminals.  You
 can train your skills here.
 There is a sign here.


For referance, the original text is formatted like....

Code:
  Here is where Sentinels practice their martial and magical skills.  Murals
and paintings of optical illusions abound, where Sentinels practice the fine
art of observation.  Filled with puzzles and brain-teasers, it is here also
that Sentinels practice the fine art of forensics in pursuing criminals.  You
can train your skills here.
There is a sign here.


Also note that I used

Code:
  #VAR DescLine {%1%lf}


This was very intentional. When I instead used...

Code:
  #VAR DescLine %concat("%1","%lf"}



It gave me headaches with removing commas from my descriptions.

So It still isn't formatting correctly, and it's still liable to blow up if it encounters special characters. Please help.
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Sun Sep 04, 2005 11:18 pm   
 
%literal how I love thee.....

Still trying to iron out the details but I'm making progress again with this %literal idea. thanks much for that Zugg
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Mon Sep 05, 2005 12:27 am   
 
HooRay! Progress. Still one last problem I am hoping to fix.

What I have so far.

Code:
#CLASS {System|AutoMapperALL}
#VAR DescLine ""

#TRIGGER {^%e[42m(*)%e[0m$} {
  #VAR RoomTitle %concat( %literal( "%1"))
  #TAG name {@RoomTitle}
  #VAR RoomTitle %upper(@RoomTitle)
  #WIN test_desc @RoomTitle
  #COLOR "#FFFF00,#800000"
  } "" {color}
#TRIGGER {^%e[44m(*)%e[0m$} {
  #VAR DescLine %concat( %literal( "%1"), "%lf")
  #TAG desc @DescLine
  #WIN test_desc @DescLine
  #COLOR "#80FFFF,#000080"
  } "" {color}
#TRIGGER {^$} {
  #VAR DescLine {%lf}
  #TAG desc {@DescLine}
  #WIN test_desc {@DescLine}
  }
#TRIGGER {obvious exits} {
  #TAG exit
  #WIN test_desc Exits:
  }
 #CLASS 0


It captures the entire description block, complete with <>'s. It does however still have one little formatting problem. If it receives a line from the mud prior to doing a CTR-L reload of the room, it will appear in the descripion field as....
Code:

This chamber contains the statue of the Sentinel Commander.  There are
 pictures and sculptures all around the room depicting the glorious history of
 the sentinels. You may try to become champion with the 'champion' command.
 You can also view the last leaders and mentors with 'read leader' and 'read
 mentor' respectively. To see the current mentor, use 'mentor check' To run for
 mentor, vote for yourself for mentor.
 To vote: vote <name> for leader
 or: vote <name> for mentor
    It is dimly lit here.


If it does not... It will appear as....
Code:

   This chamber contains the statue of the Sentinel Commander.  There are
 pictures and sculptures all around the room depicting the glorious history of
 the sentinels. You may try to become champion with the 'champion' command.
 You can also view the last leaders and mentors with 'read leader' and 'read
 mentor' respectively. To see the current mentor, use 'mentor check' To run for
 mentor, vote for yourself for mentor.
 To vote: vote <name> for leader
 or: vote <name> for mentor
    It is dimly lit here.


I have absolutely no idea why it does that, I only know that it does. I have stared at the raw lines in and there seems to be no reason for it to behave in this way. I even have the copy of the data sitting in my test_desc window and it shows correctly in either case. It is only in the properties/room description window that there is an inconsistancy.

If I could simply iron out this one last inconsistancy I would be very happy.

If it helps in any way, here is the raw text from the MuD. The first look formatted incorrectly. the second did not. Both formatted correctly in my test_desc window.

Code:

look
Chamber of the Ancients
  This chamber contains the statue of the Sentinel Commander.  There are
pictures and sculptures all around the room depicting the glorious history of
the sentinels. You may try to become champion with the 'champion' command. 
You can also view the last leaders and mentors with 'read leader' and 'read
mentor' respectively. To see the current mentor, use 'mentor check' To run for
mentor, vote for yourself for mentor.
To vote: vote <name> for leader
or: vote <name> for mentor
   It is dimly lit here.
The only obvious exit is north.
9 images of Pastry girl
Hp: 547/547 Sp: 48/48 Ep: 204/204 Gold: 0 Exp: 7700 >look

Chamber of the Ancients
  This chamber contains the statue of the Sentinel Commander.  There are
pictures and sculptures all around the room depicting the glorious history of
the sentinels. You may try to become champion with the 'champion' command. 
You can also view the last leaders and mentors with 'read leader' and 'read
mentor' respectively. To see the current mentor, use 'mentor check' To run for
mentor, vote for yourself for mentor.
To vote: vote <name> for leader
or: vote <name> for mentor
   It is dimly lit here.
The only obvious exit is north.
9 images of Pastry girl
Hp: 547/547 Sp: 48/48 Ep: 204/204 Gold: 0 Exp: 7700 >
Yamashi [mentor]: almsot same for guild who
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Mon Sep 05, 2005 12:43 pm   
 
Alright. Nevermind I seem to have solved that on on my own.

I would like to note that apparently the description field in the mapper seems unable to display leading spaces on the first line of text. This was a visual nuisance to me so I resolved it by consistantly sending an empty line and a linefeed as the first line of text each time for the description field.

I'm getting close to a finished product here. It's going to be a monster, but it will be up in the finished scripts forumns when I think it's sufficiently ready. =)
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