DeleteLines() side-effects

Posted by Worstje on Thu 29 Jan 2009 02:01 AM — 5 posts, 12,343 views.

Netherlands #0
MUSHclient version 4.36
Problem: When using DeleteLines(), every once in a while (like 1 out of 1000 times fired or perhaps even less) the entire output area goes blank. It will become plain black, the MORE indicator remains off, and usually the display will return several seconds later (probably because the same trigger fires again and it forces a redraw but I cannot test that - the bug happening catches me by surprise each time and it tends to only last 1-2s).

I never used DeleteLines() before, so I am pretty sure this function somehow causes it. I cannot faithfully reproduce the issue - I reckon there is something timing-particular about it.

There isn't much to show on a screenshot. All output disappears. Miniwindows probably stay, but this is one of few worlds of mine that are quite vanilla and lack the spruced up scripts, so maybe those disappear too. I'll put a dummy in a corner somewhere and check next time the bug happens. :)
Australia Forum Administrator #1
Can you try doing:


DoCommand "End"


.. after doing the DeleteLines?
Netherlands #2
I'll try putting it in, but I take it that would kill any form of reading back while I'm in the middle of combat. :D
Australia Forum Administrator #3
I am trying to get a handle on what is causing it. I gather from your description the lines haven't actually disappeared, and it seems from the code that the window is indeed scheduled for a redraw.

Thus, when the redraw occurs it would seem it has something wrong. There is about a 1 in 100 chance that it has to remove an entry from its internal lookup table which matches line numbers to actual lines, and that is possibly the problem.

Another possibility is that the current position (ie. the place to start drawing from) is incorrect after the delete. Maybe if you scrolled back slightly, and then those lines disappear, that is the reason.
Netherlands #4
I don't really have time to test this extensively at present, although I should be able to find some time in the next few days. In the meanwile, let me give you the trigger I am using that is causing it. (And a dozen varieties like it.)

<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   name="SuperiorForm"
   omit_from_output="y"
   regexp="y"
   sequence="100"
   script="SuperiorForm"
   match="^You work (.+?) which (?:wins over .+ and )?(?:heavily )?(?:slashes|pierces) (.+)( who cannot defend in time)?\.$"
  >
  </trigger>
</triggers>


with the following script:

prompt = "^<%d+hp %d+m %d+mv"

function RemovePrecedingPrompt()
	local previous_line = GetLineInfo(GetLinesInBufferCount()-1, 1)
	
	if (previous_line:match(prompt)) then
		DeleteLines(1)
	end
end

function SuperiorForm(name, line, wildcs)
	RemovePrecedingPrompt()
end


The basic idea is that when I gag a line of combat, I also the prompt prior to it, if there is one. Simply gagging the prompt won't do in combat - I still want my most recent prompt in sight at all time.

Hopefully you will be able to see something unusual I am doing and figure out what the issue is. I imagine the combination with omit_from_output="y" might cause funny responses when reading your story about the lookup table.