PDA

View Full Version : Creating Tokens



Ken L
December 9th, 2017, 16:32
So there's

ImageControl.addToken(tokenPrototype,X,Y)

Where the prototype as defined in the XML database is simply a local path reference to an image. The function documentation notes that it should come from a token instance and thus should not be created. However the XML simply stores this as a string with the path. All my returns are coming up as 'nil' as expected by the documentation, but given I've found some undocumented behavior before, I was hoping to game the API a bit.

What is the reason for disallowing the creation of tokens through this way?

Moon Wizard
December 9th, 2017, 19:52
No images can be added to the system through the API at runtime. The architecture is not built to support that scenario. The closest thing is that the token and campaign images folders are re-parsed when receiving application focus to allow adding token/images during play.

Regards,
JPG

Ken L
December 9th, 2017, 21:40
So even if the images are in the tokens folder locally, and accessible and loaded by FG during launch, you can't create prototypes from them?

EDIT: This means I can only get prototypes from tokens that exist in a tokenfield already if I'm hearing this correctly, irrespective of the token themselves having been loaded by FG?

Bidmaron
December 9th, 2017, 22:52
Surely this will be fixed in FGU. I have had a request in ideainformer forever to get this fixed but programming requests never get any votes.

Moon Wizard
December 10th, 2017, 05:09
No, any valid images in the tokens folder will automatically given a token asset, but only when the application focus is removed from FG and returned to FG. The re-acquisition of the overall application focus is what triggers FG to rebuild the token folder assets and campaign image folder assets.

For tokens, you would then be able to access the token assets.
For images, you can only access the image assets through the image records created automatically.

Regards,
JPG

Ken L
December 11th, 2017, 02:47
No, any valid images in the tokens folder will automatically given a token asset

That's odd, I've tried through several different means by specifying the relative path through the token folder ( tokens/<path>)and didn't come up with anything. I'll revisit this later on.

Ken L
December 14th, 2017, 03:57
It works, turns out my reference array had spaces rather than underscores which is the proper name, way to shoot my foot over naming.