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


Joined: 10 Jul 2006
Posts: 30

PostPosted: Fri Feb 14, 2014 12:31 pm   

MXP #SUB eating </send> tag
 
So I cannot for the life of me figure out what's going wrong here. Basically CMUD seems to hate MXP for IRE games, so I'm writing up a script to internally handle the MXP stuff. I figure I'll use the code later to do fun stuff with my own scripts anyways, so it's a good exercise...but something is going weird and I can't figure out why.

Basically my script is this:

Capture what the game's mxp click is: #trigger {~[*~] ~(say~) (*)} {#var mxpaction %1}

Color trigger to snag what the highlighted words are: #trigger {ansi mess} {#var mxpcolorword %1;#alarm mxptrigger +1 {#var mxpcolorword {arglebargleyargle}}}

Then the actual client-side mxp, based on when the color keywords fire: #trigger {%q{@mxpcolorword}%q} {#sub {~<send 'say @mxpaction'~><color blue>@mxpcolorword</color>~</send~>}}

The output then looks like this (bolded stuff are keywords in a pretty blue).

You say, "Tell me about some general points of interest."
Fred, a Spirean Sciomancer says, "What can I help you locate?"
[*] (say) I need to locate the bounty office.
[*] (say) I'm looking for the 'say 'say I'm looking for the post office.'>post office.
[*] (say) Where is the bank?


Basically, what's going on is that the </send> part of the sub is just completely eaten, as far as I can tell, entirely at random. I turn on debug and the problematic mxp responses (and this issue persists on pretty much every mob dialogue) just are straight up missing </send> in debug mode. I can kinda do a janky hack to make it almost work if I start making nested <send>s around everything, but it's messy and not really fully functional.

Anyone know what's going on here?
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Feb 20, 2014 3:34 am   
 
Show us how you are building the command. It appears you are prefixing <SEND> and suffixing </SEND> to the text. The problem might be there.
_________________
Sic itur ad astra.
Reply with quote
jjloraine
Novice


Joined: 10 Jul 2006
Posts: 30

PostPosted: Thu Feb 20, 2014 4:33 pm   
 
What do you mean? Isn't that how you make mxp? I'm not sure what other code you want me to paste; I pasted the whole script up above.

From the manual:

Using MXP in the #SUBSTITUTE command

Instead of using the #MXP command to send Secure MXP commands to the screen, you can also create a trigger and then use the #SUBSTITUTE command to add MXP commands to the text. For example,

#TRIGGER {north} {#SUB {<send>north</send>}}
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Feb 20, 2014 6:42 pm   
 
Haven't tested it, but I noticed you're quoting the tags in your code: ~<send 'say @mxpaction'~>. The example doesn't do that... maybe that's the problem?
Reply with quote
jjloraine
Novice


Joined: 10 Jul 2006
Posts: 30

PostPosted: Thu Feb 20, 2014 7:04 pm   
 
You need the quotes to indicate that the entire block (say @variable) is the command to be executed when clicked. If I put " instead of ' then the </send> isn't randomly eaten. However using " instead of ' means that the variable isn't expanded or even recognized and only say is sent. The ' is from examples zugg himself posted.

I guess a workaround fix here (I'm guessing the issue really is probably some sort of bug with mxp, I know there were issues with #sub a long time ago) would be a way to expand out that variable while retaining the quotes.
Reply with quote
jjloraine
Novice


Joined: 10 Jul 2006
Posts: 30

PostPosted: Thu Feb 20, 2014 7:18 pm   
 
I did...

trigger: ~[*~] ~(say~) (*)
#var mxprefix "say "
#var mxpaction @mxprefix%1

And changed the sub to:
#sub {<send "%expand(@mxpaction)"><color blue>@mxpcolorword</color></send>}

This isn't dropping the </send> anymore, but the processing order is wonky and stuff is now slowed down so only that last pattern captured is being subbed in (ie every value of @mxpaction is the same). Still, progress!
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Feb 21, 2014 12:04 am   
 
Sorry, I meant the tildes, that's the quote character in CMUD.
Code:
#trigger {%q{@mxpcolorword}%q} {#sub {<send 'say @mxpaction'><color blue>@mxpcolorword</color></send>}}
Reply with quote
jjloraine
Novice


Joined: 10 Jul 2006
Posts: 30

PostPosted: Fri Feb 21, 2014 12:44 am   
 
Ah, naw the tildes don't matter. Some scripts use them, some don't, but they don't seem to make any difference. I tried putting them in and out and it didn't make a difference.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Feb 21, 2014 11:07 pm   
 
Quote:

#trigger {~[~*~] ~(say~) ($action:*)} {
#call %match($action,"%e[1;34m(*)%e[0m",$highlighted)
$action = %stripansi($action)
$action = %replace($action,$highlighted,"<color blue>"$highlighted"</color>")
#PSUB $action %x1
}


1)The bolded part is the specific ansi color code sent to you (you can find out what it is using the debugger window)
2)this trigger needs to have the ansi trigger option checked
3)the trigger pattern may need some tweaking to match the ansi codes provided for the other sections of the pattern

This one trigger will replace all the other triggers you mentioned in the original post (no need for 4 triggers for this).
_________________
EDIT: I didn't like my old signature
Reply with quote
jjloraine
Novice


Joined: 10 Jul 2006
Posts: 30

PostPosted: Sat Feb 22, 2014 8:06 pm   
 
One trigger to rule them all!

Nifty, didn't know you could use local variables in patterns like that! That's really useful to learn.

The trigger you've gave doesn't seem to do mxp though? That's why I went with a variety of steps, to try to shoehorn in the mxp stuff (ie if you click the line it'll say that line of dialogue), while also retaining the highlighted keywords (eg, when you talk to a mob it shows a full question you can click to repeat that line back, but a word or phrase will be highlighted so you can write your own reply using that word. Sometimes I'm lazy and want to click, sometimes I want to use the keyword and write my own reply). For some reason CMUD won't fire on mxp dialogue from Aetolia, so this script is trying to manually put in the click functionality.
Reply with quote
jjloraine
Novice


Joined: 10 Jul 2006
Posts: 30

PostPosted: Sat Feb 22, 2014 9:10 pm   
 
Ok. I broke stuff down a ton - the color stuff is cool to learn, but that's not really the problem here that I'm experiencing. My workaround may not be as efficient, but it's not what's causing the error.

If I do:

$test = %1
#gag
#mxp <send 'test'>$test</send>

It'll echo back every line fine and send the command 'test' when I click. Debug:

You nod your head at Fred, a Spirean Sciomancer.
With a curt nod, Fred, a Spirean Sciomancer says, "Comrade. What do you need?"
<send 'test'>I'm looking for a specific guildhall.</send>
<send 'test'>I have a city function I need to complete.</send>
<send 'test'>I'm looking for somewhere to relax or be entertained.</send>
<send 'test'>I need to do some shopping.</send>
<send 'test'>Tell me about some general points of interest.</send>
<send 'test'>I'm looking for the Institute.</send>

However, if I do:

$test = %1
#gag
#mxp <send '%1'>$test</send>

That's when lines start vanishing and stuff gets unhappy. Debug looks fine:

With a curt nod, Fred, a Spirean Sciomancer says, "Comrade. What do you need?"
<send 'I'm looking for a specific guildhall.'>I'm looking for a specific guildhall.</send>
<send 'I have a city function I need to complete.'>I have a city function I need to complete.</send>
<send 'I'm looking for somewhere to relax or be entertained.'>I'm looking for somewhere to relax or be entertained.</send>
<send 'I need to do some shopping.'>I need to do some shopping.</send>
<send 'Tell me about some general points of interest.'>Tell me about some general points of interest.</send>
<send 'I'm looking for the Institute.'>I'm looking for the Institute.</send>

But the actual output looks like this:

With a curt nod, Fred, a Spirean Sciomancer says, "Comrade. What do you need?"

I have a city function I need to complete.

I need to do some shopping.
Tell me about some general points of interest.

H:7342/7342 M:5066/5066 E:100% W:100% S:100% XP:57.33% [db eb lr]

So basically what's going in is that something is making the mxp display get funky when I have the send command set to something that varies from line to line, such as a variable that changes value.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Feb 23, 2014 3:16 am   
 
Quote:
<send 'I'm looking for a specific guildhall.'>I'm looking for a specific guildhall.</send>


The reason why those lines don't show is because the single quote is being used for parameter containment in the send tag and a single quote is found in the parameter data. While I can certainly see how it is suggestive, both ' and " are interchangeable so long as you don't mix and match for a single parameter.

Right:
<send 'parameter'>text</send>
<send "parameter">text</send>

Wrong:
<send 'parameter">text</send>

This can still all be done in that one trigger, but if your game is already sending you this tag info then you more than likely simply have to tweak the MXP preference settings to allow it to start working (unless the tag has a typo or is also suffering from this same-quotes problem), thereby removing the need for the trigger in the first place.
_________________
EDIT: I didn't like my old signature
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