Ok, sorry for the delay everyone. but no one else's scripts had been working for me. I decided to learn Lua, and finally get this thing to work for me. I tried Ked's script, but received a ton of errors, along with my friend who also uses Lua. The main issue was getting around the fact that the beginning characters could be ", " or the first name, and the last characters would be either the last name or "," or ", " or "." So getting around all of these conditions was a pain.. heh
so, if anyone could tell me how to clean this up, I would appreciate it.
For the mud, Aetolia:
H:1500 M:1374 [eb]
Acino, Adamant, Aelia, Althalus, Amelas, Amiya, Ansnom, Ansury, Arbre, Aren,
Arinwen, Arivan, Armin, Arorn, Aspoehro, Aviv, Bain, Beren, Borscin, Butoken,
Charlius, Choderic, Chthon, Daelin, Dagan, Desian, Draqon, Ecikoria, Elinja,
Elorin, Emikalia, Entildron, Eretria, Erzsebet, Estelyx, Evilo, Ezrax, Feichin,
Garoul, Gawdin, Gex, Graythe, Halisstra, Ianus, Imiroari, Indalecio, Istoria,
Jeisha, Jherrek, Jorachim, Karim, Kidasu, Kuroken, Lynette, Macian, Makano,
Maximas, Merelii, Mikal, Minois, Morana, Nahual, Nelien, Neoma, Nero, Nicholas,
Numax, Nymeria, Osifer, Plato, Posh, Qix, Ranac, Rasta, Rastaban, Reach,
Requilem, Reuel, Rhelora, Roselynn, Ryath, Ryban, Rynthia, Sagla, Saigusa,
Savanna, Scottswarbrick, Serafena, Sesoh, Sethiel, Sylfaen, Tetchta, Theris,
Tremaday, Truft, Tsatra, Turc, Vaneas, Victoria, Virillya, Visk, Xandradi, Xanrl
, Ynael, Yura, Yurameki, Zanzarious, Zaurtha, Zerath, Zizor, Zoharim, and
Zossima.
H:1500 M:1374 [eb]
becomes:
H:1500 M:1374 [eb]
Acino, Adamant, Aelia, Althalus, Amelas, Amiya, Ansnom, Ansury, Arbre, Aren,
Arinwen, Arivan, Armin, Arorn, Aspoehro, Aviv, Bain, Beren, Borscin, Butoken,
Charlius, Choderic, Chthon, Daelin, Dagan, Desian, Draqon, Ecikoria, Elinja,
Elorin, Emikalia, Entildron, Eretria, Erzsebet, Estelyx, Evilo, Ezrax, Feichin,
Garoul, Gawdin, Gex, Graythe, Halisstra, Ianus, Imiroari, Indalecio, Istoria,
Jeisha, Jherrek, Jorachim, Karim, Kidasu, Kuroken, Laedien, Lynette, Macian,
Makano, Maximas, Merelii, Mikal, Minois, Morana, Nahual, Nelien, Neoma, Nero,
Nicholas, Numax, Nymeria, Osifer, Plato, Posh, Qix, Ranac, Rasta, Rastaban,
Reach, Requilem, Reuel, Rhelora, Roselynn, Ryath, Ryban, Rynthia, Sagla, Saigusa,
Savanna, Scottswarbrick, Serafena, Sesoh, Sethiel, Sylfaen, Tetchta, Theris,
Tremaday, Truft, Tsatra, Turc, Vaneas, Victoria, Virillya, Visk, Xandradi, Xanrl,
Ynael, Yura, Yurameki, Zanzarious, Zaurtha, Zerath, Zizor, Zoharim,
Zossima.
H:1500 M:1374 [eb]
<aliases>
<alias
script="enable_shownames"
match="^cqw$"
enabled="y"
group="auto-theft"
regexp="y"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
</alias>
</aliases>
<triggers>
<trigger
group="auto-theft"
match="^H\:(\d+) M\:(\d+) [(.*?)]$"
name="theft_prompt"
regexp="y"
script="disable_shownames"
sequence="1"
>
</trigger>
<trigger
group="auto-theft"
keep_evaluating="y"
match="^(.*?)$"
name="theft_qw"
omit_from_log="y"
omit_from_output="y"
regexp="y"
repeat="y"
script="test_shownames"
sequence="100"
>
</trigger>
</triggers>
function enable_shownames (n,o,wc)
EnableTrigger ("theft_qw", true)
EnableTrigger ("theft_prompt", true)
Send ("qw")
end
function disable_shownames (n,o,wc)
EnableTrigger ("theft_qw", false)
EnableTrigger ("theft_prompt", false)
end
function test_shownames (n,o,wc)
local qw_line = wc[1]
if string.sub (qw_line, string.len(qw_line)) ~= "," and string.sub (qw_line, string.len(qw_line)) ~= " " then
qw_line = qw_line .. ","
end
if string.sub (qw_line, 1, 2) == ", " then
qw_line = string.gsub (qw_line, ", ", "", 1)
end
qw_line = string.gsub (qw_line, "and ", "")
local names = utils.split(qw_line, ",")
table.remove (names)
for key, value in ipairs(names) do
value = string.gsub(value, " ", "")
if key == table.maxn (names) then
if string.sub (value, string.len(value)) == "." then
value = string.sub (value, 1, string.len(value)-1)
Hyperlink ("honours " .. value , value, "click here to honours " .. value, "blue", "white", 0)
ColourNote ("dimgray", "white", ".")
return
end
end
Hyperlink ("honours " .. value , value, "click here to honours " .. value, "blue", "white", 0)
if key == table.maxn (names) then
ColourNote ("dimgray", "white", ",")
return
end
ColourTell ("dimgray", "white", ", ")
end
end
can you tell me what you think? And how can I make this code neater/look nicer? |