Page 1 of 1

Using deleteLine() at the tail of other trigger processing

Posted: Wed Jan 20, 2016 4:55 am
by Slayd
I'm trying to capture certain information on particular lines, then deleteLine().

It seems that the deleteLine() trumps all...the line is deleted but the previous actions on the trigger are ignored. Is that the way it's supposed to work?

Re: Using deleteLine() at the tail of other trigger processi

Posted: Fri Jan 22, 2016 1:02 am
by Drevarr
I would suggest checking your logic without the deleteLine() to make sure you have things working appropriately.

I use deleteLine() a lot to remove text from the main window that I have routed to miniconsoles.

example:
Code: [show] | [select all] lua
if not string.starts(line, "Zone:") then
	if not string.starts(line, "Room:") then
		selectCurrentLine()
		copy()
		local lineLength = string.len(line)
		local repLength = (22-lineLength)/2
		local myString = string.rep(" ", repLength)
		echo("GUI.MapMini", myString)
		appendBuffer("GUI.MapMini")
		deleteLine()
	end
end

Re: Using deleteLine() at the tail of other trigger processi

Posted: Fri Jan 22, 2016 3:54 am
by Slayd
I did remove deleteLine() as part of my debugging to see what was wrong. Everything worked without the deleteLine(). deleteLine() is the last command in my trigger script. I'm using captures, matches[2] and matches[3] off a perl regex pattern whereas you are using the mudlet system variable line. Could that be the difference?

Re: Using deleteLine() at the tail of other trigger processi

Posted: Sat Jan 23, 2016 12:08 am
by Drevarr
Any chance you trigger is multi-line? or otherwise allowing the cursor to get beyond the line your wanting to delete?


Regarding you follow up, this works for me which uses matches[3]:
Pattern: (Head|Front|Back)\)\s(.*)$
Code: [show] | [select all] lua
local xName = string.trim(matches[3])
groupMate = xName
GroupCount = GroupCount +1
deleteLine()

Re: Using deleteLine() at the tail of other trigger processi

Posted: Sat Jan 23, 2016 12:13 am
by Slayd
It's a single-line trigger