|
enjambment Newbie
Joined: 13 Jun 2013 Posts: 1
|
Posted: Thu Jun 13, 2013 5:28 pm
Problem with capturing multiple lines in one variable |
I'm trying to capture a list of items needed to finish a quest or make an item. I have a variable I add them all into. The problem is my trigger is capturing the line it is triggering off of in the variable.
SAMPLE
Code: |
That requires the following:
A piece of marble
A green dragon hide
A black diamond
***************************** |
My variable when expanded will look like this:
That requires the following:, a piece of marble, a green dragon hide, a black diamond
TRIGGERS
#TRIGGER {That requires the following:} {#T+ reqItems}
#COND {~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*} {#T- reqItems}
#TRIGGER "reqItems" {%s(*)} {#IF (%null(@itemList)) {itemList={%1}} {itemList={@itemList, %1}}
Any help is appreciated. Thanks.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Jun 13, 2013 10:26 pm |
To solve your problem as simply as possible, anchor your trigger pattern with the ^ (you use this symbol at the beginning of the pattern).
However, your use of #T-/#T+ is completely unnecessary, as the multistate functionality can easily handle this list:
Code: |
#trigger "tItemList" {^That requires the following:} {itemList = ""}
#condition {^%s(%w*)$} {
#if (@itemlist) {itemlist = %1} {itemlist = @itemlist", "%1}
#state tItemList 1
} {WithinLines|param=1} |
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|
|
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
|
|