I tried to solve this in my way but i couldnt , so im open to any suggestions.
There is a command where i get a response from the mud a list of items in this format.
item_no item_name item_desc
Im using cecholink to reformat this and adding a link to it like (examine item_no)
command and coloring works also hint works , but when i try to click it it always examines the last item( it uses always the last item_no)
Is there a way to solve this?
Thank you.
Question regarding cecholink.
Re: Question regarding cecholink.
To resolve your issue, it would be helpful to see what you are doing when you call cecholink.
Re: Question regarding cecholink.
This is a few lines from the the bid command output.
### | Current Bid | Time | Level | Min Bid
---------------------------------------------------------------------
606 | 2,000,000 | 182 | 124 | 1,000,000
> the jeweled crown of Aziz-Ra
628 | 0 | 1759 | 50 | 5,000
> an undead squid eye
629 | 0 | 1759 | 52 | 5,000
> an undead squid eye
my Trigger Lines.
^(.+)\| (.+) \| (.+) \| (.+) \| (.+) (| .*) perl regex
^\s+?> (.+) perl regex
it is multiline trigger with line delta 1
This is the lua script
This is the output of the trigger
606 124 the jeweled crown of Aziz-Ra 2,000,000 1,000,000 176
628 50 an undead squid eye 0 5,000 1753
629 52 an undead squid eye 0 5,000 1753
when i hower over first line it shows Check Bid 606
second like Check Bid 628
However, when i click any of the lines it always runs the last line Check Bid 629
### | Current Bid | Time | Level | Min Bid
---------------------------------------------------------------------
606 | 2,000,000 | 182 | 124 | 1,000,000
> the jeweled crown of Aziz-Ra
628 | 0 | 1759 | 50 | 5,000
> an undead squid eye
629 | 0 | 1759 | 52 | 5,000
> an undead squid eye
my Trigger Lines.
^(.+)\| (.+) \| (.+) \| (.+) \| (.+) (| .*) perl regex
^\s+?> (.+) perl regex
it is multiline trigger with line delta 1
This is the lua script
Code: Select all
deleteLine() -- delete the current line
moveCursor(0,getLineNumber()-1) -- move the cursor back one line
deleteLine() -- delete the previous line now
-- formatting the bid input
args = string.split(multimatches[1][1], " | ")
bidname = string.format("%-42s", multimatches[2][2])
bidno = string.format("%-3s", args[1])
bidcur = string.format("%-12s", args[2])
bidtime = string.format("%-4s", args[3])
bidlvl = string.format("%-3s" , args[4])
bidmin = string.format("%-12s", args[5])
echo("\n")
local Al = "Check Bid" .. bidno
cechoLink("<azure>" .. bidno .." " .. bidlvl .." " .. bidname .." ".. bidcur .." ".. bidmin .. " " .. bidtime
, [[send("\n");send("bid " .. bidno)]], Al , true)
if (args[6]) then
local match = string.findPattern(args[6], "are the highest")
if match then
cecho("<yellow> <-Bidding")
else
cecho("<yellow> <-Selling")
end
end
echo("\n")
echo("\n")
606 124 the jeweled crown of Aziz-Ra 2,000,000 1,000,000 176
628 50 an undead squid eye 0 5,000 1753
629 52 an undead squid eye 0 5,000 1753
when i hower over first line it shows Check Bid 606
second like Check Bid 628
However, when i click any of the lines it always runs the last line Check Bid 629
Re: Question regarding cecholink.
Yeah, that is a pretty common problem that people run into, actually. The issue here is that the command being sent when you click the link is assembled when you click, rather than when you create the link, because the reference to the bidno variable is inside the literal string (i.e. inside the double square brackets). To fix that, you just need to change the command you are using from this: [[send("\n");send("bid " .. bidno)]]
To this: [[send("\n");send("bid ]] .. bidno .. [[")]]
That way, cecho link is given the VALUE of the variable, rather than a reference to the variable, so that when the value of the variable changes, you won't be changing what is actually getting sent.
To this: [[send("\n");send("bid ]] .. bidno .. [[")]]
That way, cecho link is given the VALUE of the variable, rather than a reference to the variable, so that when the value of the variable changes, you won't be changing what is actually getting sent.
Re: Question regarding cecholink.
We should add functions support to cechoLink - that would also fix things and make it simpler to capture.
Re: Question regarding cecholink.
Thank you, this solved my problem and i learned something new today.
Re: Question regarding cecholink.
Would you mind adding an example of this to the wiki? Someone else is bound to run into this too.