Asset Image Src Changes

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
Tanthos
Giant
Posts: 176
Joined: Thu Mar 28, 2013 6:55 pm
Location: United States

Asset Image Src Changes

Post by Tanthos »

Under what conditions, if ever, does the src ID of an image asset change?

For the sake of speed, it would be better to have an OnCampaignLoad register the image assets of some images that are frequently used in HTML macros for easy retrieval without having to make frequent use of the tableImage() function.

But if src IDs change during gameplay and make storing them in a library token unsuitable, I would like to know that.

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

Re: Asset Image Src Changes

Post by wolph42 »

No clue. Never tested that. I know that tok id changes with copy paste and sometimes with cut and paste, but I would imagine that image id would always stay the same...

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Asset Image Src Changes

Post by aliasmask »

As far as I know they don't change because they're based on the file size and crc(?). The problem with storing just the asset id and not the token is the other clients will have nothing to download to see the same image. If you want a library of images I suggest either putting them on their own map or in a file repository and then store the ids. You can also put them in to a table. But like wolph42 I've never actually tested this to make sure it works and it difficult to do without a 2nd computer handy. But I'm pretty sure I'm at least 90% right.

User avatar
Tanthos
Giant
Posts: 176
Joined: Thu Mar 28, 2013 6:55 pm
Location: United States

Re: Asset Image Src Changes

Post by Tanthos »

Right now I do have them in a table, it's just a lot of images to grab, and I wasn't sure if tableImage is the fastest way to go.

If you have to grab a lot of images...let's say around 20 each time a certain macro is run (and is run very frequently)... what is the most efficient way to grab image assets?

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

Re: Asset Image Src Changes

Post by wolph42 »

my guess:

put them in a table, gather ALL image assets and store them in a strprop variable, where the the vars are the id name you want to use and the corresponding values are the image asset id. Store that strprop on a lib token.
Then when needed, grab that variable from the lib token and use Wiki: varsFromStrProp() its a VERY fast method. Then you have all the assets available as variables in your macro.

User avatar
Tanthos
Giant
Posts: 176
Joined: Thu Mar 28, 2013 6:55 pm
Location: United States

Re: Asset Image Src Changes

Post by Tanthos »

Would that work for the clients, also? They don't have different asset ids for the table images, right?

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

Re: Asset Image Src Changes

Post by wolph42 »

Tanthos wrote:Would that work for the clients, also? They don't have different asset ids for the table images, right?
although its easy to test, I would 'guess' not.

Craig
Great Wyrm
Posts: 2107
Joined: Sun Jun 22, 2008 7:53 pm
Location: Melbourne, Australia

Re: Asset Image Src Changes

Post by Craig »

Tanthos wrote:Would that work for the clients, also? They don't have different asset ids for the table images, right?
Asset ids are stable and you can store them how you like as they will never* change assets are immutable and need to have same id across clients. Just be aware any asset you store the id for must also be in the campaign file some where, in a table, on a map as a token etc... If you do not do this when a client attempts to fetch it then it wont be able to find it. You could possibly get away with just having it a shared repository or getting players to add it to their maptool directory but I am not sure this will always work.

One caveat, in a future version the way asset ids are calculated may change, but if they do there will be plenty of warning and details on how to convert campaigns if required.

Post Reply

Return to “Macros”