Here's my current implementation of a writ search function, which as far as I know works well. It does have a bit more functionality, but you can strip that out if you don't need it. Line 446 in WritCreator.lua.
Lua Code:
local function writSearch()
local W = {}
local anyFound = false
if not WritCreater.questExceptions then
return {}, false
end
for i=1 , 25 do
local Qname=GetJournalQuestName(i)
Qname=WritCreater.questExceptions(Qname)
if (GetJournalQuestType(i) == QUEST_TYPE_CRAFTING or string.find(Qname, WritCreater.writNames["G"])) and GetJournalQuestRepeatType(i)==QUEST_REPEAT_DAILY then
for j = 1, #WritCreater.writNames do
if string.find(myLower(Qname),myLower(WritCreater.writNames[j])) then
W[j] = i
anyFound = true
end
end
end
end
return W , anyFound
end
writNames["G"] is "writ", writNames[1 -> 6] are the craft specific names of writs. questExceptions is a pre-format function you can overwrite for specific languages, but not really too important. All of the writNames and questExceptions can be found in the various localization files.