Rene said:
To clarify, in the function how would I get the number from wildcard[1]? The line of code would just be 'wildcard[1](%1)'?
Don't worry, i'll try to help you as i can, even though ( never forget) Fiendish and Nick Gammon are WAY more exert than anyone else.
As previously said ( i put again to be more clear and give you sure reference ) i suggest you put the following code in the edit windows just below the trigger box where you put your trigger. Remember, you have to select (in the box Sendto ) Script
So, create a table with keys like that:
local litNumb = {
one = 1,
two = 2,
three = 3,
four = 4,
five = 5,
six = 6,
seven = 7,
eight = 8,
nine = 9,
ten = 10,
eleven = 11,
twelve = 12,
thirteen = 13,
fourteen = 14,
fifteen = 15,
sixteen = 16,
seventeen = 17,
eighteen = 18,
nineteen = 19,
twenty = 20 } -- end litNum
..then to lookup at the number you need only to code:
local RealNum = litNum ["%1"]
.. So refer to the wildcard putting it in quotation marks .
Obviusly, make some trial and be sure %1 contain only the bit of string with the number, as you written in the table, or you'll get a fail in the match and the RealNum variable will be Nil .
So i suggest (before you code everything) to put just after the above code: print ("Triggered!")
if RealNum ~= nil then
print ("this is the content of wildcard [1] --> " .. "%1")
print ("and this the literal converted to number --> " .. RealNum)
end -- if
Just to be sure and test your trigger.
Tell us what's the outcome! |