 |
Jaguar2 Newbie
Joined: 26 Mar 2003 Posts: 4 Location: USA
|
Posted: Fri Apr 11, 2008 11:27 am
#sub gone haywire... |
Okay... create a trigger on the text blarg that does the following "#if (1=1) {#sub {moo}}"
Then... use "#echo blarg".
You get: "moo"
It works. Cool.
Next... use "#echo blarg blarg".
You get: "moo (1=1) {#sub {moo}}"
Okay... that's not quite right...
So we try "#echo blarg blarg blarg".
You get: "moo (1=1) {#sub {moo}} (1=1) {#sub {moo}}"
Okay... that's not a big annoyance. It's not like it causes zMUD to go in to catastrophic meltdown... no... for that we need the original trigger that started this experiment.
#REGEX {(\a+\d+)} {
#if (@FormatMode="Shopping") {#substitute {~<send "probe %1|weaponprobe %1|QuickBuy %1" "probe|weaponprobe|buy">%1~</send>}}
#if (@FormatMode="Wielding") {#substitute {~<send "probe %1|weaponprobe %1|unwield %1" "Probe|Weaponprobe|Unwield">%1~</send>}}
#if (@FormatMode="Holding") {#substitute {~<send "probe %1|weaponprobe %1|wield %1|wear %1|#exec put %1 in @PackName|#exec put %1 in @PouchName" "Probe|Weaponprobe|Wield|Wear|Pack|Pouch">%1~</send>}}
#if (@FormatMode="Wearing") {#substitute {~<send "probe %1|weaponprobe %1|remove %1" "Probe|Weaponprobe|Remove">%1~</send>}}
#if (@FormatMode="InfoHere") {#substitute {~<send "probe %1|setenemy %1|get %1" "Probe|Target|Get">%1~</send>}}
#if (@FormatMode="InPack") {#substitute {~<send "#exec get %1 from @PackName|#exec get %1 from @PackName" "Get|Wield">%1~</send>}}
#if (@FormatMode="InPouch") {#substitute {~<send "#exec get %1 from @PouchName|#exec get %1 from @PouchName" "Get|Wield">%1~</send>}}
}
This is a trigger designed for Achaea that turns vial1 into a clickable menu depending on what @formatmode is set to, which is set by different triggers to determine whether I'm looking at stuff in a shop, being worn, etc... When I use #echo vial1 it works beautifully. When I use "#echo vial1 vial2" I get
"
vial1 (Wearing=Shopping) {#substitute {vial2}}
#if (Wearing=Wielding) {#substitute {<send "probe vial2|weaponprobe vial2|unwield vial2" "Probe|Weaponprobe|Unwield">vial2</send>}}
#if (Wearing=Holding) {#substitute {<send "probe vial2|weaponprobe vial2|wield vial2|wear vial2|#exec put vial2 in @PackName|#exec put vial2 in @PouchName" "Probe|Weaponprobe|Wield|Wear|Pack|Pouch">vial2</send>}}
#if (Wearing=Wearing) {#substitute {<send "probe vial2|weaponprobe vial2|remove vial2" "Probe|Weaponprobe|Remove">vial2</send>}}
#if (Wearing=InfoHere) {#substitute {<send "probe vial2|setenemy vial2|get vial2" "Probe|Target|Get">vial2</send>}}
#if (Wearing=InPack) {#substitute {<send "#exec get vial2 from @PackName|#exec get vial2 from @PackName" "Get|Wield">vial2</send>}}
#if (Wearing=InPouch) {#substitute {<send "#exec get vial2 from @PouchName|#exec get vial2 from @PouchName" "Get|Wield">vial2</send>}}
"
The first Vial1 and the first Vial2 in those lists are infact clickable links.
if I use "#echo vial1 vial2 vial3"... zmud goes entirely haywire. It prints a whole bunch of text to the buffer before popping up a box labeled "Fatal Trigger Error" with the text "Trigger Loop Detected". It gives me the options of "Ok" and "Disable Triggers" If I click disable triggers it recovers about half of the time, and half of the time it hangs eternally. If I click "OK" it seems to hang a bit before bringing the same box back up. If it does recover, zmud won't display any text to the buffer until I go to layout and empty scrollback. |
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Apr 11, 2008 12:10 pm |
The problem seems to be using #IF with #SUB inside. My guess is that zMUD is trying to determine the difference between using #SUB to do an immediate substitute of the trigger text or creating a new #SUB trigger and failing to make a correct distinction.
I would recommend you have class folders that get enabled/disabled when you switch format modes, each with a substitution trigger to do the MXP menu for that mode. |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Apr 11, 2008 12:36 pm |
Another possible workaround:
#if (@FormatMode="shopping") {substring="blah blah blah"}
#if (@FormatMode="wielding") {substring="blah blah blah"}
#sub @substring |
|
|
 |
Jaguar2 Newbie
Joined: 26 Mar 2003 Posts: 4 Location: USA
|
Posted: Fri Apr 11, 2008 9:31 pm |
Fang, your suggestion failed. I tried it first with
"
#if (@FormatMode="Wearing") {#var ReformatText {~<send "#exec get %1 from @PouchName|#exec get %1 from @PouchName" "Get|Wield">%1~</send>}}
#Sub @ReformatText
"
With FormatMode set to wearing. If I try "#echo vial1" I get "<send "#exec get vial1 from @PouchName|#exec get vial1 from @PouchName" "Get|Wield">vial1</send>" to display. If I try #echo vial1 vial2... it bombs as describe in the first post.
Larkins workaround functions. It actually appears to be a result of 2 things. The first is it almost seems like zmud tries to temporarily flag any trigger that uses #sub and a substitution trigger, I'm guessing to improve processing speed. So the first trigger on any line opperates normally, but any subsequent triggers on the same line have this problem. It seems to assume the trigger is just a #sub trigger and thus performs the #sub function using whatever follows the first word (or command?) as the #sub text. This can be seen if you make a trigger that does a #echo a followed by a #sub and once again activating it twice on the same line. The first operates normally, the second seems to ignore the #echo and operates as if the #echo were a #sub and uses the entire rest of the trigger as the #sub text.
The bigger problem seems to come that I'm guessing it gets itself stuck in a loop as a result of the fact that my #sub contains the text being substituted inside of itself, and I'm guessing as a result of interaction in some fashion with the above problem ends up #subing it's own substitution text infinately. Have a work around, this is definately a bug I think though. *nods* |
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Apr 12, 2008 1:09 am |
Unfortunately, even if it is a bug, it probably will never get fixed for zMUD. Zugg is concentrating all his efforts on CMUD and CMUDPro that it's highly unlikely he'll ever release another version of zMUD. In fact, he's said so before. However, it'll be interesting to see if this behavior happens in CMUD too.
Charneus |
|
|
 |
Jaguar2 Newbie
Joined: 26 Mar 2003 Posts: 4 Location: USA
|
Posted: Sat Apr 12, 2008 7:00 am |
I can't particularily blame him. If cMUD wasn't so buggy I'd probably switch to it. Unfortunately, from what I've seen of it on my fiancee's computer I'd prefer not to deal with it at the moment. If the cheap upgrade from zMUD to CMUD was still available I might think about it, but right now I'm not willing to shell out the money necessary for cMUD.
|
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sat Apr 12, 2008 7:06 am |
This is my workaround I've only done it for one of the #IFS
#CLASS {Sub}
#VAR FormatMode {Wearing}
#VAR PouchName {}
#VAR subbed {}
#REGEX {(.*(\a+\d+).*)} {#var subbed %subregex("%1","(\a+\d+)",'~~<send "probe %%1|weaponprobe %%1|remove %%1" "Probe|Weaponprobe|Remove">%%1~~</send>')
#if (@FormatMode="Wearing") {#exec {#substitute {@subbed} } }} "" {param=1}
#CLASS 0 |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
|
|