Script - hi-lighter:
function loadHL()
if enemy_list == nil then enemy_list = {} end
if friend_list == nil then friend_list = {} end
-- add in more lists here, if you feel like it. IE shallam_list, mhaldor_list
if hl_nums == nil then
hl_nums = {}
for i,v in ipairs(enemy_list) do
if not hl_nums[v] then
hl_nums[v] = tempTrigger( v ,[[hlEnemy(matches[1]) ]] )
end
end
for i,v in ipairs(friend_list) do
if not hl_nums[v] then
hl_nums[v] = tempTrigger( v ,[[hlFriend(matches[1]) ]] )
end
end
--[[ For each list you create, you'll need a function that is like the following
list_name is the name of the list from above
hlList is the actual COLOURING function for the list
for i,v in ipairs(list_name) do
if not hl_nums[v] then
hl_nums[v] = tempTrigger( v ,[[hlList(matches[1]) ]] )
end
end
--]]
end -- if hl_nums
end -- function
function hlFriend(who)
local c = 1;
local k = 1;
while k > 0 do
if c > 3 then break; end;
k = string.find( line, who, k )
if k == nil then return; end
local nC = '';
nC = string.match( line, '.',k+string.len(who) )
if nC == '.' or nC == ',' or nC == ';' or nC == ':' or nC == ' ' or nC == "'" then
k = selectString(who, c)
if k > -1 then
c = c + 1;
setFgColor(0,255,127);
resetFormat();
else
return;
end
end
k = k + string.len(who);
end
end
function hlEnemy( who )
local c = 1;
local k = 1;
while k > 0 do
if c > 3 then break; end;
k = string.find( line, who, k )
if k == nil then return; end
local nC = '';
nC = string.match( line, '.',k+string.len(who) )
if nC == '.' or nC == ',' or nC == ';' or nC == ':' or nC == ' ' or nC == "'" then
k = selectString(who, c)
if k > -1 then
c = c + 1;
setFgColor(255,0,0);
setItalics(true);
resetFormat();
else
return;
end
end
k = k + string.len(who);
end
end
--[[ Copy the above function, and change the 'setFgColor' and ' function hl<your function/list name>'
Match, RegEx: ^(add|remove) (\w+) (from|to) (friends|enemies| <other cities/lists you create here>)$
Code:
local action = matches[2]
local who = matches[3]:title()
local where = matches[5]
-- Look below, and for each 'action', add in the lists/cities you made functions/lists for. IE, if where = 'mhaldor, if where = 'shallam'
if action == 'add' then
if where == 'friends' then
if not friend_list then friend_list = {} end
if table.contains(friend_list,who) == false then
table.insert(friend_list,who)
hl_nums[who] = tempTrigger( who ,[[hlFriend(matches[1]) ]] )
al_alert(string.format('%s added to %s!', who, where))
else -- if
al_alert(string.format('%s already in %s!', who, where))
end -- if
elseif where == 'enemies' then
if not enemy_list then enemy_list = {} end
if table.contains(enemy_list,who) == false then
table.insert(enemy_list,who)
hl_nums[who] = tempTrigger( who ,[[hlEnemy(matches[1]) ]] )
al_alert(string.format('%s added to %s!', who, where))
else -- if
al_alert(string.format('%s already in %s!', who, where))
end -- if
end -- if
end -- if
if action == 'remove' then
if where == 'friends' then
if table.contains(friend_list,who) then
table.remove(friend_list,tfind(friend_list,who))
if hl_nums[who] then killTrigger(hl_nums[who])end
al_alert(string.format('%s removed from %s!', who, where))
else
al_alert(string.format('%s not in %s!', who, where))
end -- if
elseif where == 'enemies' then
if table.contains(enemy_list, who) == true then
table.remove(enemy_list, tfind(enemy_list,who))
if hl_nums[who] then killTrigger(hl_nums[who])end
al_alert(string.format('%s removed from %s!', who, where))
else
al_alert(string.format('%s not in %s!', who, where))
end -- if
end -- if
end -- if
Hope that helps!