First off, the trigger wasn't working with the {1,3} for some reason. It was just grabbing the last argument.
<triggers>
<trigger
enabled="y"
match="^ (?:\[([ \d]{4})\] (\w+)\s*)(?:\[([ \d]{4})\] (\w+)\s*)?(?:\[([ \d]{4})\] (\w+)\s*)?"
name="zzzztestingthing"
regexp="y"
script="riftcapture"
sequence="100"
>
</trigger>
</triggers>
As far as the code went, I'm not sure where everything got messed up, but now that I'm actually back on a computer where I could test things out:
riftitems={}
function riftcapture( sTrig, sLine, wildcards )
riftitems[ wildcards[2] ] = tonumber( wildcards[1] )
if wildcards[4] then
riftitems[ wildcards[4] ] = tonumber( wildcards[3] )
if wildcards[6] then
riftitems[ wildcards[6] ] = tonumber( wildcards[5] )
end
end
end
riftsort = { { "tints", {"yellowtint", "redtint", "bluetint", "purpletint", "greentint", "goldtint" } },
{ "herbs", {"sparkleberry", "wormwood", "yarrow", "pennyroyal", "sargassum", "weed",
"arnica", "calamus", "chevril", "colewort", "coltsfoot", "faeleaf", "flax",
"galingale", "kafe", "kombu", "marjoram", "merbloom", "mistletoe", "myrtle",
"reishi", "rosehips", "sage" } },
{ "commodities", {"wood", "gems", "rope", "gold", "coal", "leather" } },
{ "gems", {"moonstone", "ruby", "emerald", "amethyst", "coral", "pearl", "beryl", "bloodstone",
"garnet", "jade", "onyx", "opal", "sapphire", "turquoise" } }
}
function showrift()
for _,i in ipairs( riftsort ) do
Note( "*("..string.upper(i[1])..")*" )
for _,j in ipairs( i[2] ) do
if riftitems[j] ~= nil then
Tell( string.format( " [%d] %s", riftitems[j], j ) )
end
end
Note( "" )
end
Here's the output when I did the test:
[ 125] amethyst [ 40] arnica [ 86] bluetint
[ 159] calamus [ 59] chervil [ 2] coal
[ 10] colewort [ 3] coltsfoot [ 225] faeleaf
[ 10] flax [ 7] galingale [ 40] gems
[ 34] gold [ 34] goldtint [ 130] greentint
[ 120] kafe [ 6] kombu [ 144] leather
[ 38] marjoram [ 10] merbloom [ 10] mistletoe
*(TINTS)*
[86] bluetint [130] greentint [34] goldtint
*(HERBS)*
[40] arnica [159] calamus [10] colewort [3] coltsfoot [225] faeleaf [10] flax [7] galingale [120] kafe [6] kombu [38] marjoram [10] merbloom [10] mistletoe
*(COMMODITIES)*
[40] gems [34] gold [2] coal [144] leather
*(GEMS)*
[125] amethyst
I'd set up an alias so that when you enter the command to look into the rift, it clears the table. |