PDA

View Full Version : Tokens as Shortcuts



pr6i6e6st
November 21st, 2019, 07:43
[Programming question]
Hey guys! Thanks again for all the help in my journey. New question.

What must I do to make a token on a new record type (in this instance, planet, star system, colony, or vehicle) and have it so if I placed that token on a map, I could double click the token to get its record, much like if it was an entity on the combat tracker?

The idea is to take a star chart, place graphics of planets and systems around, and have those graphics linked to a record.

Trenloe
November 21st, 2019, 13:37
This functionality is already there in CoreRPG based rulesets - but it is coded to open the linked combat tracker record. So, anything you'd add would need to be incorporated into this current structure - and maintained if the CoreRPG code changes in future versions.

Look at the CoreRPG file: scripts\manager_token.lua - onDoubleClick function - this opens the linked record when the token is double-clicked.

Have a look at scripts\manager_combat.lua - the replaceCombatantToken function. Within this, the Token.addToken API is called to add a link to the token as it is placed on the map. Note - this appears to be an undocumented API.

Then, to see how this CombatManager.replaceCombatantToken function is called when a token is added to the map, look in ct\scripts\ct_token.lua - the onDragEnd function.

You'll have to look at this whole process and how to integrate what you want to do into this without breaking the current double-click on token linked to the combat tracker functionality.

Dtoad
November 21st, 2019, 20:23
Hmm, something like the ability to assign a token as a pin image? That would be pretty cool, you could leave little clues for players to find on their own.

Zacchaeus
November 21st, 2019, 21:51
Hmm, something like the ability to assign a token as a pin image? That would be pretty cool, you could leave little clues for players to find on their own.

You can do that now. Create a story entry pin it to the map and then share the pin and the related story.

Dtoad
November 21st, 2019, 22:28
You can do that now. Create a story entry pin it to the map and then share the pin and the related story.

I think the idea would be to reskin the pin to look like something else...maybe a scroll...and then have it open when a player finds (clicks) it. Or, it could look like a floor tile and be a secret tunnel. Or several token could be elements of a map. I'm just spitballing here. It's an interesting idea.