Problems with logging notes.

Posted by Rivius on Sun 20 Nov 2011 04:44 PM — 9 posts, 33,330 views.

#0
1) I've noticed that if I omit a trigger from the log, then put in my own custom note while "sending to script" it will display the note twice. This goes away when I do "send to script (after omit)".

2)This bug is harder to reproduce with newer triggers for me and I honestly have tried (hair-pulling involved) to replicate it. But I have one trigger that omits from log and omits from output. I make it display a custom colournote from a pre-compiled script (ie. I enter a function name into the "script" field). For some reason, it shows up perfectly in the output but does not display at all in the log.
Australia Forum Administrator #1
There is a fairly complex sequence of events surrounding each line of text arriving from the MUD, which is documented here:

http://www.gammon.com.au/forum/?id=6554

For your case can you please show the trigger in question?

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


And also the relevant part of the script? (the part the trigger calls)

#2
Sure thing! The trigger in question:


  <trigger
   enabled="y"
   group="Core"
   match="^(?:\d+h)?(?:\, )?(?:\d+m)?(?:\, )?(?:\d+e)?(?:\, )?(?:\d+p)?(?:\, )?(?:\d+en)?(?:\, )?(?:\d+w)?(?:\, )?(?:(?:[1-5])mo)? ([elrxkdbpSsi<>]*)\-$"
   name="core_prompt"
   keep_evaluating="y"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   script="events.prompt"
   sequence="1000"
  >
  </trigger>


calls:


function prompt(name, line, wildcards, styles)
	--If less than two colours, it is an illusion.
	if (#styles < 2) then
		return
	end
	
	prompt_flags = wildcards[1] -- Sets the retrieved flags.
	
	local no_prompt = prompt_actions["no_prompt"]
	
	if not balances.onbal then
		events.tvar_clear("balance_action")
	end
	
	balances.prompt() -- Updates balance stats.
	events.balance() -- Runs balance event.
	affs.recklessness_check() -- Are we a little too crazy?
	inventory.pipe_check()
	
	
	affs.checks()
	
	-- Execute all actions lined up for the prompt.
	for name,action in pairs (prompt_actions) do
		if type(action) == "function" then
			action()
		elseif type(action) == "string" and #action > 0 then
			Execute(action)
		end
		prompt_actions[name] = nil
	end
	pvars = {}
	
	-- Cures your afflictions.
	curing.routine()
	
	if not no_prompt then
		ui.prompt() -- Draws the acorn prompt.
	end
	
	if (#affs.last_cures > 0) then
		Note()
		local c = string.gsub(table.concat(affs.last_cures, ", "), "_", " ")
		ColourNote("white", "", "cleared: ", "silver", "", c)
	end
	affs.last_cures = {}
	
	core.prev_hp, core.prev_mp, core.prev_ep = core.hp or 0, core.mp or 0, core.ep or 0
end


The above function called the ui function (which redraws the prompt)


function prompt() --Draws the prompt in all its prettiness.
	local time_ms = GetInfo(232) 
	local powerfract = ( tonumber(core.power)/ tonumber(GetVariable("vitals_maxpow")) )
	
	local flagcolour = "yellow" --Just colours the flags based on balance status.
	if not (balances.onbal) or (affs.prone) then
		flagcolour = "silver"
	end
	
	ColourTell("silver", "", "[")
	Hyperlink("time_stamp_difference "..time_ms, string.format("%0.2f", time_ms), "Click to get difference.", "lightslategray", "", 0)
	ColourTell("silver", "", "|")
	if not affs.get("recklessness") then
		ColourTell(colourfract(core.hpfract), "", string.format("%d", (core.hpfract * 100)).."%h")
		ColourTell("silver", "", "|")
		ColourTell(colourfract(core.mpfract), "", string.format("%d", (core.mpfract * 100)).."%m")
		ColourTell("silver", "", "|")
		ColourTell(colourfract(core.epfract), "", string.format("%d", (core.epfract * 100)).."%e")
		ColourTell("silver", "", "|")
		ColourTell(colourfract(powerfract), "", core.power.."p")
	else
		ColourTell("chartreuse", "", "Reckless")
	end
	ColourTell("silver", "", "|")
	ColourTell(colourfract(core.enfract), "", string.format("%d", (core.enfract * 100)).."%en")
	ColourTell("silver", "", "|")
	ColourTell(colourfract(core.wpfract), "", string.format("%d", (core.wpfract * 100)).."%w")
	ColourTell("silver", "", "] ")
	ColourTell(flagcolour, "", events.prompt_flags.."- ")

	if core.is_paused() then
		ColourTell("darkred", "", "(", "crimson", "", "psd", "darkred", "", ")" )
	end

	if affs.get("stunned") then
		ColourTell("goldenrod", "", "(", "gold", "", "stn", "goldenrod", "", ")" )
	end
	
	if affs.get("asleep") then
		ColourTell("royalblue", "", "(", "cornflowerblue", "", "slp", "royalblue", "", ")" )
	end
	
	if affs.slow() then
		local c = "slateblue"
		if events.tvars["slow_block"] then
			c = "plum"
		end
		ColourTell("darkslateblue", "", "(", c, "", "slow", "darkslateblue", "", ")" )
	end
	
	if affs.get("jinx") then
		ColourTell("darkorange", "", "(", "orange", "", "jinx", "darkorange", "", ")" )
	end
	
	if #mapper.autowalking > 0 then
		ColourTell("darkgray", "", "(", "silver", "", "moving - "..mapper.autowalking[1], "darkgray", "", ")" )
	elseif events.tvars["autowalk_arrived"] then
		events.tvar_clear("autowalk_arrived")
		ColourTell("darkgray", "", "(", "silver", "", "arrived", "darkgray", "", ")" )
	end
	
	point_changes()
end




Also, thank you for that link. I'll be studying this now :)
Australia Forum Administrator #3
Rivius said:

For some reason, it shows up perfectly in the output but does not display at all in the log.


Well you have omit from log.

What is the problem exactly? What is the "it" that shows up perfectly?
#4
The redrawn note as shown in the last function. Appears in the output, doesn't in the log.
Australia Forum Administrator #5
Are you logging notes?
#6
I am. That appears to be the only note that does not get logged properly.

Here are my log settings:

http://imageshack.us/f/42/logsettings.png/

Compare this log generated by the built in log command:
http://dl.dropbox.com/u/16429247/logtest.html

with my select and "Copy as HTML" produced log from the buffer:

http://dl.dropbox.com/u/16429247/logtest2.html

(there's a little more in this log due to me selecting a bit higher up, but you can compare the corresponding parts).


If it's any help, this was on 4.77 (I also experience this on 4.79)



Amended on Mon 21 Nov 2011 08:19 PM by Rivius
Australia Forum Administrator #7
I am wondering if all those ColourTells are being followed by a Note or other line-terminating function.

Possibly with the line not "officially" terminated, the logging gets bypassed.
#8
Wow! Your hypothesis was correct. Adding a Note() to the function makes it appear in the log once again. That explains why sometimes it would show up and sometimes it wouldn't, since depending on whether you lost health or not, it would add an extra note at the bottom with additional info.