Tables and images

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Tables and images

Post by Ditto »

Hi, so I was trying to programmatically change the image in a table .. and a quick search turned up this thread:

http://forums.rptools.net/viewtopic.php ... TableEntry

but didn't find anything there.

However, I noticed this:

setTableEntry
http://lmwcs.com/rptools/wiki/setTableEntry

Allows you to change/update the String "value" in the table .. however, it doesn't allow you to change/update the image id ?
Any reason for that?

Best I can figure, in order to update the image, I need to create a new row, and delete the old ... so:

Code: Select all

[h: img = tableImage ( "Misc", 7 )]

[h: deleteTableEntry( "Place",10)]

[h: addTableEntry ( "Place", 10, 10, "Place 10 Alt", img ) ]
However, when I do that, the image in the table comes out as a big red "X" .. O.o
How do I change/add an entry in a table along with the image for it ?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Tables and images

Post by wolph42 »

you could have better replied in jagged's thread, that way he gets a notification, now he doens't and most likely will it take longer to respond. AFAIK he's the only one who can answer your questions.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Tables and images

Post by aliasmask »

If the table image shows a red X, can you display the image either on a token or in chat?

I know table images have to load in to memory to be seen properly and that doesn't happen until you try to output one. So, not seeing the table image in the new table entry may just be a memory buffer thing.

Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Re: Tables and images

Post by Ditto »

wolph42 wrote:you could have better replied in jagged's thread, that way he gets a notification, now he doens't and most likely will it take longer to respond. AFAIK he's the only one who can answer your questions.
Oh sorry, it was an old thread, and I'm used to necro-threading being frowned upon .. so I started a new thread :(

@alias:
Yes, the image displays fine everywhere else ...

it's just after I use the addTableEntry .. :(

hmm .. yeah, so the table itself doesn't show .. but if I just "trust it" and let her rip, seems to be fine ... very odd ..
[edit] sorry, I spoke too soon, it was still displaying the old image .. the new image won't show ... :( [/edit]

So, that's the Delete row + create row.

Is there any way to update an image on a row? rather than dropping and re-creating ?

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Tables and images

Post by aliasmask »

Hmm, maybe the image asset itself isn't saved with the addTableEntry, just the asset identifier. ie the name, but not the actual image (that would be a bug). The asset should be the same if you have it in one table and move to another. Caching should take care of the rest.

Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Re: Tables and images

Post by Ditto »

aliasmask wrote:Hmm, maybe the image asset itself isn't saved with the addTableEntry, just the asset identifier. ie the name, but not the actual image (that would be a bug). The asset should be the same if you have it in one table and move to another. Caching should take care of the rest.
Tried a stripped down test: (following the code sample on wiki: http://lmwcs.com/rptools/wiki/addTableEntry

v1.4.0.5

Create new table (manually).
named; "test"
create rows 1, 2, 3, 4.

Create a new token, named "elf".
Use default token image for an Elf.

Create lib:Utility token.
create macro "test"
(uncheck "Allow Players to Edit Macro"


add following logic to "test":

[r: switchToken ( "elf" )]
[r:addTableEntry("test",5,5,"alf", getTokenImage())]

Checked the table: Yep, big red "X".
:(

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Tables and images

Post by aliasmask »

alf the elf?

Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Re: Tables and images

Post by Ditto »

aliasmask wrote:alf the elf?
hey, it's from the wiki .. *shrug* .. who am I to argue? 8)

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Tables and images

Post by aliasmask »

Fyi, I figured out the problem. Seems to be a bug. It adds "asset://" to the beginning, but when getting an image id, it already has that on the beginning so it doubles it. This is my fix.

Code: Select all

[deleteTableEntry("players",1)]
[addTableEntry("players",1,1,"",substring(getImage("DM"),8))]
I also tried setTableImage(tableName,image) which has the same problem.

Code: Select all

[setTableImage("players",substring(getImage("image:Unknown"),8))]

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Tables and images

Post by Full Bleed »

aliasmask wrote:Fyi, I figured out the problem. Seems to be a bug.
Nice catch... you should bug report it. I updated the original table macros thread on the issue (pointing back to here) and PM'd Jagged to make him aware of the issue... but you've isolated the issue and it sounds like there is pathway to fix that wouldn't require the function's creator to address.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Re: Tables and images

Post by Ditto »

aliasmask wrote:Fyi, I figured out the problem. Seems to be a bug. It adds "asset://" to the beginning, but when getting an image id, it already has that on the beginning so it doubles it. This is my fix.

Code: Select all

[deleteTableEntry("players",1)]
[addTableEntry("players",1,1,"",substring(getImage("DM"),8))]
I also tried setTableImage(tableName,image) which has the same problem.

Code: Select all

[setTableImage("players",substring(getImage("image:Unknown"),8))]
Sweet! I'll try that ... thanks!

:)

Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Re: Tables and images

Post by Ditto »

aliasmask wrote: I also tried setTableImage(tableName,image) which has the same problem.

Code: Select all

[setTableImage("players",substring(getImage("image:Unknown"),8))]
hey ..wait .. what ?

setTableImage isn't on the wiki page!! :)
Cheater!! :P

What's the full syntax of that sucker ?

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Tables and images

Post by aliasmask »

I actually tried it not knowing it wasn't there. I use setTableImage(tableName,image).

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Tables and images

Post by JamzTheMan »

FYI: since i have the code open, looks like the current list of functions are:
table functions

Code: Select all

"tbl", "table", "tblImage", "tableImage", "getTableNames", "getTableRoll", "setTableRoll", "clearTable", "addTableEntry", "deleteTableEntry", "createTable", "deleteTable", "getTableVisible", "setTableVisible", "getTableAccess", "setTableAccess", "getTableImage", "setTableImage", "copyTable", "setTableEntry")
(sorry, list is "as is" from code, not alphabetic)

FWIW, Looks like we have the following in the wiki:
wiki list

Code: Select all

addTableEntry
clearTable
createTable
deleteTable
deleteTableEntry
getTableAccess
getTableNames
getTableRoll
getTableVisible
setTableAccess
setTableEntry
setTableRoll
setTableVisible
table
tableImage
tbl
tblImage
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

Ditto
Giant
Posts: 179
Joined: Thu Jul 28, 2011 1:06 pm

Re: Tables and images

Post by Ditto »

JamzTheMan wrote:FYI: since i have the code open, looks like the current list of functions are:
table functions

Code: Select all

"tbl", "table", "tblImage", "tableImage", "getTableNames", "getTableRoll", "setTableRoll", "clearTable", "addTableEntry", "deleteTableEntry", "createTable", "deleteTable", "getTableVisible", "setTableVisible", "getTableAccess", "setTableAccess", "getTableImage", "setTableImage", "copyTable", "setTableEntry")
(sorry, list is "as is" from code, not alphabetic)

FWIW, Looks like we have the following in the wiki:
wiki list

Code: Select all

addTableEntry
clearTable
createTable
deleteTable
deleteTableEntry
getTableAccess
getTableNames
getTableRoll
getTableVisible
setTableAccess
setTableEntry
setTableRoll
setTableVisible
table
tableImage
tbl
tblImage

Cool, so I'm not going crazy :) sweet.

however, seems that setTableImage doesn't touch images on the individual rows, it's just the 1 larger image for the full table ... :(

Post Reply

Return to “MapTool 1.4”