function createWormholeTrigger ()
if CurrentRoom == "" or OldRoom == "" then
Note("")
Note("You need to collect both sides of the wormhole to create the triggers.")
Note("")
else
CurrentRoomHold = CurrentRoom
OldRoomHold = OldRoom
CurrentRoom = string.gsub (CurrentRoom, "[^A-Za-z0-9 ]", "\%1")
OldRoom = string.gsub (OldRoom, "[^A-Za-z0-9 ]", "\%1")
CurrentArea = string.gsub (CurrentArea, "[^A-Za-z0-9 ]", "\%1")
OldArea = string.gsub (OldArea, "[^A-Za-z0-9 ]", "\%1")
CurrentDesc = string.gsub (CurrentDesc, "[^A-Za-z0-9 ]", "\%1")
OldDesc = string.gsub (OldDesc, "[^A-Za-z0-9 ]", "\%1")
StringRoomListCur = CurrentRoom .. "\. \(" .. CurrentArea .. "\)\n" .. CurrentDesc
StringRoomListOld = OldRoom .. "\. \(" .. OldArea .. "\)\n" .. OldDesc
--Note(StringRoomListCur)
--Note(StringRoomListOld)
if IsTrigger(string.gsub (CurrentRoomHold, "[^A-Za-z0-9]", "_")) then
AddTriggerEx(string.gsub (CurrentRoomHold, "[^A-Za-z0-9]", "_"), StringRoomListCur, "[WORMHOLE\: " .. OldArea .. "\, " .. OldRoom .. "]", 41, -1, 0, "", "", 2, 100)
SetTriggerOption(string.gsub (CurrentRoomHold, "[^A-Za-z0-9]", "_"), "multi_line", "1")
SetTriggerOption(string.gsub (CurrentRoomHold, "[^A-Za-z0-9]", "_"), "lines_to_match", "2")
SetTriggerOption(string.gsub (CurrentRoomHold, "[^A-Za-z0-9]", "_"), "group", "AAAA")
--When really IsTrigger it shows up at 0.
else
-- here would be a trigger setup for ones with the same name to start adding numbers
-- on the end of it.
end
if IsTrigger(string.gsub (OldRoomHold, "[^A-Za-z0-9]", "_")) then
AddTriggerEx(string.gsub (OldRoomHold, "[^A-Za-z0-9]", "_"), StringRoomListOld, "[WORMHOLE\: " .. CurrentArea .. "\, " .. CurrentRoom .. "]", 41, -1, 0, "", "", 2, 100)
SetTriggerOption(string.gsub (OldRoomHold, "[^A-Za-z0-9]", "_"), "multi_line", "1")
SetTriggerOption(string.gsub (OldRoomHold, "[^A-Za-z0-9]", "_"), "lines_to_match", "2")
SetTriggerOption(string.gsub (OldRoomHold, "[^A-Za-z0-9]", "_"), "group", "AAAA")
else
-- Here would be if there is already a trigger with the same name to start adding numbers
-- on the end of it.
end
end
end
I decided to go with the script file because it's just easier. I edit now because I saw the option out of the corner of my eye flipping between windows.
Can't seem to make it work on areas that have spaces in their names. Working on that problem now. -- Figured out the issue - you can't have trigger names with - in it. The new code turns anything non-alphanumeric into _'s. |