 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Fri Jun 18, 2010 3:54 am
[3.19f] Triggers in Stringlist Variables (Serious Problem) |
This no longer works so a lot of my triggers are now broken, which is a serious problem for me. I'm not sure if it is intentional or not.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<var name="triggerList" type="StringList" copy="yes">
<value>"This is a (trigger|test)\."|"This is a second (trigger|test)\."</value>
<json>[["This is a (trigger","test)\."],["This is a second (trigger","test)\."]]</json>
</var>
</cmud>
|
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="120" regex="true" copy="yes">
<pattern>^(?:@triggerList)$</pattern>
<value>$param = %params
#print $param</value>
</trigger>
</cmud>
|
I'm not sure what the change is. I suppose the fact it is putting everything in quotes now. Can you no longer put triggers in string lists like that because I have tons. Mainly it is for triggers that are all for the same thing. They won't even fire at all now. I would appreciate some kind of clarification if this is a bug or I need to rewrite everything. If I do I do, but it will just basically suck duplicating tons of code.
I also noticed in the json part the quotes are only on one side of the word in the alternation. I am not even sure what is happening honestly.
Quote: |
"This is a (trigger","test)\."],["This is a second (trigger","test)\." |
|
|
Last edited by oldguy2 on Fri Jun 18, 2010 4:39 am; edited 1 time in total |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Fri Jun 18, 2010 4:19 am |
Well it is definitely the fact it wraps the triggers in quotes that is the problem. If I change the variable to stringlist expanded and remove the quotes it works just fine.
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jun 18, 2010 2:27 pm |
Basically, it looks like the json translator is misinterpreting the pipe character within the string elements as a secondary stringlist separator. I.e. a bug.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Jun 18, 2010 5:04 pm |
Well, what you have really *is* a nested string list by normal definitions. Your first item:
This is a (trigger|test)\.
is a string list of two elements:
This is a (trigger
test)\.
So that is why it is getting stored as a nested list. The Variable itself has no idea that it's going to be used in a trigger pattern or not. So it's just getting handled just like any other nested string list. And the way that is being stored as a nested json array is completely correct:
Code: |
[
[
"This is a (trigger",
"test)\."
],
[
"This is a second (trigger",
"test)\."
]
] |
I think the actual bug is that when CMUD tries to put this nested list back together as a normal string value for a trigger pattern, it is not properly removing the quotes around the nested items. The string format for the nested list in CMUD is this:
Code: |
"This is a (trigger|test)\."|"This is a second (trigger|test)\." |
and my guess is that the trigger parser is removing the outer set of quotes but is not removing the inner set. So I think it is passing this to the trigger pattern matcher:
Code: |
This is a (trigger|test)\."|"This is a second (trigger|test)\. |
which would prevent the pattern from matching.
In any case, I've added this to the bug list to look into. I'll try to get it fixed for the 3.20 release today. |
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Fri Jun 18, 2010 7:57 pm |
Thanks. It just makes life easier being able to use a stringlist variable for these instead of having a gigantic trigger pattern with tons of alternation. With the string list each trigger is on its own line and I can easily see them.
|
|
|
 |
|
|