after hours of trial&errors, i finally got Generic Mapper working... Once.
at the same time, 2 of new problem raised heads
nonetheless, it is a big progress. thanks for many advice.
in successful case, 3 basic triggers become like this. (im working on adapting to Avatar MUD)
1) 'Exits' trigger
pattern:
^\[Exits\: ([\w\s]+)\]$
script:
map.prompt.exits = matches[2]
raiseEvent("onNewRoom")
print(map.prompt.exits) -- additional 'debug' line. can be DELETEd after checking
2) 'Room name' trigger
patten:
fg color = dark yellow, bg collor = black (from gui menu)
script:
map.prompt.exits = matches[1]
raiseEvent("onNewRoom")
print(map.prompt.exits) -- additional 'debug' line. can be DELETEd after checking
3) 'Prompt' trigger
pattern:
\<\-\d+\/\d+hp
script:
raiseEvent("onPrompt")
map.prompt.name_found = false -- ADDED AFTER checking. to hide 'searching special exits' text.
other than those 3, i added 4th and 'Failed Move Trigger' (pre-made one).
4) 'onVisionFail' trigger
pattern:
^It is pitch black\.\.\.$
script:
raiseEvent("onVisionFail")
unfortunately, i must say such success was temporal.
if i tried same thing on new profile, i get all the same error again. "
Start Mapping Error: No room detected!"
i used same 3 basic triggers in 'debug mode' to check if expected output being shown.
the result was... only Prompt trigger seems to fail. but i bet its enough for disturbing generic mapper's work.
it never shows "searching special exits" text again.
tried changing patterns, but no success...
i don't understand why these same triggers worked once, and don't for newly created profile.
it should be on the same condition.
besides, there is
one another big problem. (*note*: this is a case that Generic Mapper already working.)
which is what i was afraid in former post... a confliction with other plugins.
when i turned promptbar (graphical HP gauge) on again, naturally old in-line prompt disappears. and Generic Mapper stops working.
can't 'start mapping' nor 'start mapping <new area name>'.
and i see old error message again.
while loading existing "map.dat" is automatically done on login if i put it in the root folder of profile.
i guess promptbar keeps holding prompt's data. cuz it needs to monitor them.
so that there is no chance for Generic Mapper to get prompt's info.
i have tried changing trigger's order(position) in gui menu to change their priority, but no success yet.
the plugin consists of 2 part. trigger and script.
--trigger of promptbar
pattern:
^(.*)<-(\d+)/(\d+)hp (\d+)/(\d+)mp (\d+)/(\d+)mv (-?)(\d+) (\d+)tnl-> <(.+)/(.+)>
script:
PromptBar.setHP(matches[3],matches[4])
PromptBar.setMP(matches[5],matches[6])
PromptBar.setMV(matches[7],matches[8])
PromptBar.setALIGN(matches[9], matches[10])
PromptBar.setTNL(matches[11],1333)
PromptBar.setMONITOR(matches[12],matches[13])
PromptBar.setStatus(matches[2])
deleteLine()
the last line seems to be working as kill-switch once all necessary datas get processed.
is there any possible way for both to co-exist ?
preferably in the way of only gauge to be shown. (original re-appearing prompt hurts my eyes.)
next is script. btw, i have changed 'PromptBar.startY' from original correlation equotion to fixed '882' value to fit in my window size.
--script of promptbar
PromptBar = PromptBar or {}
PromptBar.width = 700
PromptBar.height = 30
PromptBar.buffer = 5
PromptBar.gaugeWidth = 95
mainWidth, mainHeight = getMainWindowSize()
PromptBar.startX = 2
PromptBar.startY = 882
-- default label creation
createGauge("HP", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + PromptBar.buffer, PromptBar.startY, nil, 255, 0, 0)
createGauge("MP", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + 2 * PromptBar.buffer + PromptBar.gaugeWidth, PromptBar.startY, nil, 0, 255, 0)
createGauge("MV", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + 3 * PromptBar.buffer + 2 * PromptBar.gaugeWidth, PromptBar.startY, nil, 255, 255, 0)
createGauge("ALIGN", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + 4 * PromptBar.buffer + 3 * PromptBar.gaugeWidth, PromptBar.startY, nil, 255, 0, 255)
createGauge("TNL", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + 5 * PromptBar.buffer + 4 * PromptBar.gaugeWidth, PromptBar.startY, nil, 0, 0, 255)
createGauge("MONITOR", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + 6 * PromptBar.buffer + 5 * PromptBar.gaugeWidth, PromptBar.startY, nil, 0, 255, 255)
createGauge("STATUS", PromptBar.gaugeWidth, PromptBar.height, PromptBar.startX + 7 * PromptBar.buffer + 6 * PromptBar.gaugeWidth, PromptBar.startY, nil, 128, 128, 128)
function PromptBar.setStatus(status)
length = string.len(status)
if length > 9 then
length = 0
end
setGauge("STATUS", length, 9, status)
end
function PromptBar.setHP(current, max)
setGauge("HP", current, max, current .. " / " .. max)
end
function PromptBar.setMP(current, max)
setGauge("MP", current, max, current .. " / " .. max)
end
function PromptBar.setMV(current, max)
setGauge("MV", current, max, current .. " / " .. max)
end
function PromptBar.setALIGN(sign, align)
setGauge("ALIGN", align, 1000, sign .. align)
end
function PromptBar.setTNL(current, max)
current = max - current
setGauge("TNL", current, max, current .. " / " .. max)
end
function PromptBar.setMONITOR(current, max)
if current == "-" then
setGauge("MONITOR",0,1,nil) else
setGauge("MONITOR", current, max, current .. " / " .. max)
end
end
--align and tnl and monitor will be tricky as will displaying the rest of the status