Hi, I'm trying to iterate through a table to create a series clickable links. But when I clink on a link, the correct value displays from the table but all the links refer to the last value in the table. Does echoLink not store the value assigned to it on creation?
cechoLink( "<cyan>view room "..viewRoom[vcount], [[centerview(viewRoom[vcount])]], "Center Map on room",true)
the links are displaying
view room 14159
view room 14248
view room 14129
but clicking any link shows 14129
thanks
echoLink iteration
echoLink iteration
Last edited by Silvine on Wed Dec 18, 2013 10:25 am, edited 1 time in total.
Re: echoLink help
"Does echoLink not store the value assigned to it on creation?" that's not what your syntax is telling it to do. It's telling it to, when the code is running, to then check the value of vcount and use it as the index.
Try instead:
Try instead:
That is assuming vcount is a number and not text.
Re: echoLink iteration
Ah yes!!! Schoolboy error
Many Thanks
Many Thanks
Re: echoLink iteration
Turns out I need some more schooling.
I have the following line
and it shows the last value for resultsDB[1].Entire
as a trigger fires, so I thought I needed the following
and it would pick up the value at the time the trigger fires, but I get the following error
My head is going to explode!!!
I have the following line
Code: Select all
cechoLink( "<pink> "..resultsWorn.."\n", [[echo("ItemBox", "\n----------------------------\n"..resultsDB[1].Entire)]],resultsDB[1].Entire,true)
as a trigger fires, so I thought I needed the following
Code: Select all
cechoLink( "<pink> "..resultsWorn.."\n", [[echo("ItemBox", "\n----------------------------\n"..]]..resultsDB[1].Entire..[[)]],resultsDB[1].Entire,true)
Code: Select all
Lua error:[string "echo("ItemBox", "\n----------------------------\n"....."]:2:
')' expected (to close '(' at line 1) near 'name'
Mapper of Bedlam
Re: echoLink iteration
From the look of your error, you are missing the end ) on line 2 of the script in which you echo to ItemBox.
But I can't tell you much more without seeing the entire script that raises the error.
But I can't tell you much more without seeing the entire script that raises the error.
Re: echoLink iteration
Whole script is
The first bit adds the link as shown
and then clicking on it should send it to another window
Code: Select all
itemSearch = matches[4]
resultsDB = {}
resultsDB = db:fetch(myitemDB.Item, db:like(myitemDB.Item.Name, "%"..itemSearch.."%"))
resultsWorn = resultsDB[1].Worn
resultsID = resultsDB[1].ID
resultsDB = db:fetch(myitemDB.Entire, db:eq(myitemDB.Entire.ID, resultsID))
if resultsWorn ~="" then
cechoLink( "<pink> "..resultsWorn.."\n", [[echo("ItemBox", "\n----------------------------\n"..]]..resultsDB[1].Entire..[[)]],resultsDB[1].Entire,true)
end --if
and then clicking on it should send it to another window
- Attachments
-
- eqp2.PNG (10.44 KiB) Viewed 5220 times
-
- eqp.PNG (29.21 KiB) Viewed 5220 times
Mapper of Bedlam
Re: echoLink iteration
It seems there is a problem with with echoing a multi line string. When I change resultsDB[1].Entire to resultsID it works ok. resultsID being a single word string and resultsDB[1].Entire being a multi line string. Any idea's?
Thanks
ps when using
to send the link to another window it doesn't send as <pink> but stays with the default format. If i remove the "ItemBox" and send to the main window it is <pink> Bug maybe?
Thanks
ps when using
Code: Select all
cechoLink("ItemBox", "<pink> "..resultsWorn.." "..itemSearch.."\n", [[echo(resultsID)]],resultsDB[1].Entire, true)
Mapper of Bedlam
Re: echoLink iteration
I had another play with it, testing if \n breaks it.
These both work, although echoing to another window is still default colours rather than <pink>
If I change the line
to
then I get the errors
and
from the two links
Also after using cehcolink to another window it doesn't refresh so I had to force it adding the line
The tip part works fine as shown in the screenshots, which is the info I want to ping of to another window when I click a link.
Do I just give up with it for the minute, or is there something can be done?
Thanks
Code: Select all
if resultsWorn ~="" then
resultsID = "hello there "
resultsID = resultsID.."its me again"
cechoLink("ItemBox", "<pink> "..resultsWorn.." "..itemSearch.."\n", [[echo("]]..resultsID..[[")]],resultsEntire, true)
cechoLink( "<pink> "..resultsWorn.."\n", [[echo("ItemBox", "]]..resultsID..[[")]],resultsEntire, true)
echo("ItemBox", "")
end --if
If I change the line
Code: Select all
resultsID = "hello there "
Code: Select all
resultsID = "hello there \n"
Code: Select all
Lua error:[string "echo("ItemBox", "hello there ..."]:1: unfinished string near '"hello there '
and
Code: Select all
Lua error:[string "echo("hello there ..."]:1: unfinished string near '"hello there '
Also after using cehcolink to another window it doesn't refresh so I had to force it adding the line
Code: Select all
echo("ItemBox", "")
Do I just give up with it for the minute, or is there something can be done?
Thanks
Mapper of Bedlam