|
Spectara Newbie
Joined: 06 Nov 2005 Posts: 9
|
Posted: Tue May 12, 2009 4:43 pm
Crashing on in-line variable coloring |
I have all the necessary code for extracting player names into a string list, however when I attempt to use the following:
#TR {{@player}} {#CW cyan}
CMUD becomes unresponsive and I have to force it to close. I have used something like this in Zmud for years and I believe this is the correct usage for Cmud as I have looked through other posts and seen this exact pattern used. All I want to do with this trigger is color the text of any player when it is received from the mud, such as a player entering/leaving/doing an action or looking at the WHO list in game. Checking the test pattern in the package editor indicates that the trigger WORKS, but getting it to work WITHOUT crashing Cmud would be helpful. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue May 12, 2009 4:46 pm |
Make sure the @player variable is not empty or does not contain a blank name. This problem was fixed in the 3.x beta versions but will causes 2.37 to hang on some blank patterns.
|
|
|
|
Spectara Newbie
Joined: 06 Nov 2005 Posts: 9
|
Posted: Tue May 12, 2009 5:13 pm |
I updated to the beta version and it fixed half of the problem. I now correctly match and color the names in text from the mud except when I try to retrieve the list of players that I populate the variable with. In that instance I am still crashing.
The text that I am pulling from looks like the following:
-=-=-| USERS |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
player 1 player 2 player 3 player 4
player 5 player 6 player 7 player 8
player 9 player 10 player 11 player 12
player 13 player 14 player 15 player 16
player 17 player 18 player 19 player 20
20 players currently in *********
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
*edit* forum won't post extra spaces... the length for each name is set at 18 spaces. If the name is too long it gets cut off, too short and there are extra spaces added to make it 18 characters long.
When I recieve the first line, I reset the variable so it doesn't have useless information in it and turn on the following trigger.
I am pulling the names with
#TRIGGER {(&18)(&18)(&18)(&18)} {#additem player %word(%1,1);#additem player %word(%2,1);#additem player %word(%3,1);#additem player %word(%4,1)}
#TRIGGER {(&18)(&18)(&18)} {#additem player %word(%1,1);#additem player %word(%2,1);#additem player %word(%3,1)}
#TRIGGER {(&18)(&18)} {#additem player %word(%1,1);#additem player %word(%2,1)}
#TRIGGER {(&18)} {#additem player %word(%1,1)}
When I hit *players currently in* I turn the triggers off and %pop off some of the gibberish that gets sucked in.
Again, I have checked the test pattern with a line copied directly from this display but it crashes when actually used.
I do not have any blank lines inserted into the variable, with the exception of a line AFTER my last name, which I can manually delete but always come back after I click off of the variable (I believe Cmud does this itself so you have a blank line to add to the variable). |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue May 12, 2009 5:57 pm |
That's a horrid way of doing this! I don't even know what &18 means. Use a regex and a multistate trigger:
#trig {-=-=-| USERS |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- } {#var players "";#t+ playercapture}
#cond {^%d players currently in} {#t- playercapture}
#regex "playercapture" {^(\w+)(?: (\w+))?(?: (\w+))?(?: (\w+))?} {#additem players %1;#if (%2) {#additem players %2};#if (%3) {#additem players %3};#if (%4) {#additem players %4}} "" {disable}
will hopefully do all you need it to. It's fully automated every time you call up that list of players. You didn't give any real output for the players, so I've assumed that they're single words only. |
|
|
|
Spectara Newbie
Joined: 06 Nov 2005 Posts: 9
|
Posted: Tue May 12, 2009 6:09 pm |
Names do not have to be a single word. (&18) captures 18 characters, and then I take the first word and save it to the player list. So if somebody has more than one word in their name, I capture enough for my purpose, but still get information for each of the 4 players in the line.
The code you provided results in a fatal loop error for each line of text. |
|
|
|
Spectara Newbie
Joined: 06 Nov 2005 Posts: 9
|
Posted: Tue May 12, 2009 6:58 pm |
Got it.
#trig {-=-=-| USERS |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- } {#var players "";#t+ playercapture}
#cond {^%d players currently in} {#t- playercapture}
#regex "playercapture" {^(\w+)\s+(\w+)?\s+(\w+)?\s+(\w+)?} {#additem players %1;#if (%2) {#additem players %2};#if (%3) {#additem players %3};#if (%4) {#additem players %4}} "" {disable}
Also managed to fix the coloring issue I was having. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue May 12, 2009 7:39 pm |
You need to beware doing it that way, though, because it requires that the line includes those three (or more) spaces, even when it contains fewer than four people. That's the reason that the spaces were optional in my regex as well as the words themselves. If the problem was purely that my regex was looking for one space where yours looks for one or more, then change the spaces in mine to \s+.
I don't know what you mean by "fatal loop error" - is CMUD actually locking up, or do you just mean that a trigger loop is occurring? I don't see either of those problems here, so it must be some interference with a script you have running. |
|
|
|
|
|