Help - Search - Members - Calendar
Full Version: Making Lists
Achaea's Forums > Off-Topic > Tech Support
Jonathin
Just so I can get this done and out of the way, so I don't have to come to the forums everytime I need help with this:

I want to make a list out of another list. The first list looks like Thing, thing2, thing3. like QW or INV.
I want it to go into a string list.
I'm not sure how to get it to add each specific thing, and for it to ignore the comma.
Gorlasintan
#REGEX {^You are holding\:$} {#T+ inv_cap trigger}
#REGEX "inv_cap" {^([A-Za-z1-9,'-\s])\} {#T- inv_cap trigger;#VAR inventorylist {%replace( "%1", ", ", "|")}} "" "" {disable}

Or something similar.
Jonathin
QUOTE (Gorlasintan @ Oct 1 2009, 11:24 AM) *
#REGEX {^You are holding\:$} {#T+ inv_cap trigger}
#REGEX "inv_cap" {^([A-Za-z1-9,'-\s])\} {#T- inv_cap trigger;#VAR inventorylist {%replace( "%1", ", ", "|")}} "" "" {disable}

Or something similar.


So, with that, it sets the whole thing1, thing2, thing3. to the variable, then replaces the ,s and the .s?

^in simple terms.
Gorlasintan
The periods aren't a part of what is being processed in the #VAR statement. It looks like I forgot that in the trigger. The backslash at the end of the second #REGEX is supposed to be escaping the final period.

Basically, what happens, in order is this:

1. Extract the list of items in the trigger, sans the ending period (again, typo on my part).
2. Run through the raw string from the mud, replace the ", " sequences with "|".
3. Place the new string into the #VAR statement, and execute it as normal.

So you go from

item one, item two, item three

to

item one|item two|item three

and then

#VAR inventorylist {item one|item two|item three}

as it executes step-by-step.
Jonathin
Ooh, thanks, I get it now.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.