line = getCurrentLine() doesn't update line variable globally - does wiki just mean line variable is locally updated?
Posted: Tue Jun 23, 2020 10:11 pm
In short: I want to replace text and have triggers that match after the first one match on the replaced text instead of the original. Wiki seems to indicate after running 'replace(text)' that doing 'line = getCurrentLine()' should update line for subsequent triggers to the replaced line text, but this does not seem to work for me in 4.91.
So, I'm looking at the getCurrentLine() documentation in the wiki, and it seems to indicate doing the following should update the "line" variable after running replace(), but it doesn't seem to be doing that for my triggers in 4 .9.1:
line = getCurrentLine()
Here's the Trigger:
Trigger Match (substring): "
Trigger Body:
local numOfMatches = #matches
for i=1,numOfMatches,1 do
selectString(tostring(matches),1)
replace([["]])
deselect()
end
line = getCurrentLine()
On the next trigger, the line variable is back to what it was before the replace() was run
From:
https://wiki.mudlet.org/w/Manual:UI_Functions
"When triggers change the content of the buffer, the variable line will not be adjusted and thus hold an outdated string. line = getCurrentLine() will update line to the real content of the current buffer. "
Does line get fed to each trigger, regardless of what a trigger does to the line variable? If so, it seems like parsing some URI/HTML codes on the first trigger, so that subsequent triggers match the same text as what's displayed on the console is not possible.
This is necessary because my MUD uses HTML formatting and URI encoding, so I'm trying to parse out all the HTML encoded characters (& etc), and not make people have to match those pre-parsed & and " and < and > in their triggers they define below this top-level replace().
So, I'm looking at the getCurrentLine() documentation in the wiki, and it seems to indicate doing the following should update the "line" variable after running replace(), but it doesn't seem to be doing that for my triggers in 4 .9.1:
line = getCurrentLine()
Here's the Trigger:
Trigger Match (substring): "
Trigger Body:
local numOfMatches = #matches
for i=1,numOfMatches,1 do
selectString(tostring(matches),1)
replace([["]])
deselect()
end
line = getCurrentLine()
On the next trigger, the line variable is back to what it was before the replace() was run
From:
https://wiki.mudlet.org/w/Manual:UI_Functions
"When triggers change the content of the buffer, the variable line will not be adjusted and thus hold an outdated string. line = getCurrentLine() will update line to the real content of the current buffer. "
Does line get fed to each trigger, regardless of what a trigger does to the line variable? If so, it seems like parsing some URI/HTML codes on the first trigger, so that subsequent triggers match the same text as what's displayed on the console is not possible.
This is necessary because my MUD uses HTML formatting and URI encoding, so I'm trying to parse out all the HTML encoded characters (& etc), and not make people have to match those pre-parsed & and " and < and > in their triggers they define below this top-level replace().