|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Jan 30, 2010 8:06 am
[3.13] MXP Trigger and %mxp.data assignment |
I was reading in the MXP trigger documentation about how you can make changes to the text that was found in the MXP trigger:
Quote: |
MXPTRIG Example
#MXPTRIG {color red} {%mxp.fore=Blue} "" "Prompt|NoCr"
An example of a prompt MXP trigger. When the <COLOR RED> tag is received, the trigger fires, and the "Fore" argument of the tag is changed from "red" to "Blue". This remaps the MXP colors sent by the MUD. Only arguments of OPEN MXP tags can be changed. |
There is a case in Achaea where you are blacked out and all you get is a "-" for a prompt. I was trying to assign a string to %mxp.data to recreate my prompt in these cases. So that instead of seeing "-" I would see a normal prompt. Nothing seemed to happen when I made the assignment. Is there any reason why this wouldn't be working? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Jan 30, 2010 6:37 pm |
%variables are read-only.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jan 30, 2010 7:00 pm |
MattLofton wrote: |
%variables are read-only. |
Then the documentation from Zugg is incorrect? It clearly says you can change the key of the predefined variable %mxp, so clearly %mxp isn't read-only.
Charneus |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Jan 30, 2010 11:48 pm |
That was my confusion as well. Typically I wouldn't think I could alter those, but it has it there in the documentation, so I was trying it out.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jan 31, 2010 5:48 am |
Sweet, learned something new today!
Reed, what's your example? CMud typically doesn't tell you that whatever legal syntax you had didn't work in a particular situation, so maybe the tag you are trying to modify is flagged as a secure tag? %mxp would most definitely be read-only in those situations.
EDIT: also, just it case you didn't notice it in the helpfile, %mxp is only available in prompt-trigger mode. prompt = match on opening tag (allowing you to intercept the tag attributes), newline = match on ending tag (too late, attributes already locked in and processed). |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sun Jan 31, 2010 6:13 am |
Here's what I was trying to do. I have the non-working %mxp.data statement commented out.
Quote: |
<trigger name="mxp_prompt" type="MXP" priority="10" stop="true" id="6068">
<pattern>Prompt</pattern>
<value>#tag prompt
#if (%0 != "-") {
#call %regex( %mxp.data, "^\d+h, \d+m, \d+e, \d+w ([cexkdb]*)\-", pflags)
}
#RAISEEVENT Prompt
#if (%regex( @pflags, "ex")) {#RAISEEVENT PromptBalanced}
} {
//%mxp.data = %concat(put the reconstructed prompt here)
#RAISEEVENT Prompt
#if (@baleq( )) {#RAISEEVENT PromptBalanced}
}</value>
</trigger>
|
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jan 31, 2010 9:08 pm |
Are you able to change ANY of the %mxp stuff? In 3.12 I was getting weird unclosed tag results for %mxp.fore (ie, color continuing on until the next color change operation, ie, an ansi code was encountered) that turned the color purple instead of the expected blue. I was never at all able to change %mxp.data, but through all the testing I was able to read %mxp just fine.
After upgrading to 3.13, %mxp entirely went read-only, even in the situations in 3.12 I was able to get something to change. Apparently something went kaput in the MXP preferences, because when I try to go to the list of System-provided MXP elements CMud errors out with a message about a delphi variable (cvfInteger) not being large enough. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Feb 01, 2010 12:14 am |
Well, Zugg DID make a change to %mxp.data regarding proper full text between tags. I wonder if something was inadvertently changed while doing so.
Charneus |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Feb 01, 2010 12:24 am |
Matt: I only tried this one thing in 3.13.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Feb 01, 2010 5:28 pm |
You cannot change the %mxp.data variable. The %mxp variable is like a "database variable" and you can only change certain "key" values that represent MXP tag attributes. Like in the help file example where you can change the %mxp.fore key value. And as Matt mentioned, this only works when the "Trigger on Prompt" option is set for the MXP trigger, which causes your MXP trigger to fire before CMUD closes the MXP tag.
Matt: The changes to %mxp.data should not have effected whether other keys in %mxp can be written. However, I *did* reproduce the error with the MXP System elements preference list and have added that to the bug list. |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Feb 01, 2010 6:11 pm |
Perhaps a note in the documentation clarifying this would be useful to others that come down this path. I personally found it confusing when I tried to reconcile the help files with the program's actual response.
|
|
|
|
|
|