PDA

View Full Version : Images on Maps



Tielc
January 30th, 2019, 14:48
I am wondering what's the best way to add additional images to maps. I was using tokens in the Host folder to do this for my campaign. For example, I stripped all of the location names off from a map, then added them as images to the Host token folder. Then I dragged them onto the map and set them to hidden. However, I noticed logging onto another computer, that if I share the map where those tokens are used, the players could ultimately see all of the content within those folders within the token menu.

Is there another way I should be adding things like labels to a map that I don't want the players to see, but may want to reveal later?

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=26169&stc=1&d=1548860094

Nylanfs
January 30th, 2019, 14:57
Use pins.

Trenloe
January 30th, 2019, 16:01
Use letter tokens, perhaps the first letter of the name. Then type the full name in the chat bar and drag the text to the token. This will add a tooltip to the token. Not ideal, but it’s an option.

Tielc
January 30th, 2019, 16:13
Okay, so basically what I'm getting is, there's no way to add graphics to a map without having them populate the character's token folders?

Trenloe
January 30th, 2019, 16:21
All tokens on a map/images, even tokens that are hidden, are downloaded to the player client and are visible in the player's token window. This is a requirement with the way shared images and tokens operate.

You could add the tokens to the map when you want to actually show them to the players.

Tielc
January 30th, 2019, 16:32
In theory, could I write a mod that just removes the token folder from the player interface? Their character tokens are created and applied. I don't see a reason in this game for them to even see the folder.

Trenloe
January 30th, 2019, 16:37
In theory, could I write a mod that just removes the token folder from the player interface? Their character tokens are created and applied. I don't see a reason in this game for them to even see the folder.
In theory you could. I don't know what effect that will actually have on the underlying token architecture, probably no effect. Give it a go and see what happens!

Nylanfs
January 30th, 2019, 17:29
The worst thing that you could do is it breaks the rules of the simulation we're in and it goes back to a previous save. :)

Tielc
January 30th, 2019, 19:43
Does anyone happen to know the name of the button? I've searched, but I'm getting the feeling it isn't named.

I can only find reference to it here, where the object is given a class named tokenbag, but no object name. I've tried changing the class using a script to setVisible(false); with no luck.

aCoreDesktopDock =
{
["local"] =
{
{
icon="button_library",
icon_down="button_library_down",
tooltipres="sidebar_tooltip_library",
class="library",
subdock = true,
},
},
["live"] =
{
{
icon="button_tokencase",
icon_down="button_tokencase_down",
tooltipres="sidebar_tooltip_token",
class="tokenbag",
subdock = true,
},
{
icon="button_library",
icon_down="button_library_down",
tooltipres="sidebar_tooltip_library",
class="library",
subdock = true,
},
},
};

Trenloe
January 30th, 2019, 19:49
Remove the whole section relevant to the token button/class. That is, remove this:


{
icon="button_tokencase",
icon_down="button_tokencase_down",
tooltipres="sidebar_tooltip_token",
class="tokenbag",
subdock = true,
},

Best to make a copy of the whole "live" entry and rename it "live-player" and remove the above section just from this.

Then you'll need to modify the buildDesktop() function towards the top of that file (data_desktop,lua) to check for GM or player and use DesktopManager.registerDockShortcuts for either "live" or "player-live". There's a User.isHost() section in that function, so you can modify as needed.

Tielc
January 30th, 2019, 19:52
But that would also remove it from the Host and Client correct? I am just trying to hide this from players.

Trenloe
January 30th, 2019, 19:54
But that would also remove it from the Host and Client correct? I am just trying to hide this from players.
See my edit.

Tielc
January 30th, 2019, 20:12
Remove the whole section relevant to the token button/class. That is, remove this:


{
icon="button_tokencase",
icon_down="button_tokencase_down",
tooltipres="sidebar_tooltip_token",
class="tokenbag",
subdock = true,
},

Best to make a copy of the whole "live" entry and rename it "live-player" and remove the above section just from this.

Then you'll need to modify the buildDesktop() function towards the top of that file (data_desktop,lua) to check for GM or player and use DesktopManager.registerDockShortcuts for either "live" or "player-live". There's a User.isHost() section in that function, so you can modify as needed.

Okay, sorry to hassle you with this. Is there a way with lua files to do a merge or join like there is with the xml files? I would rather just make a minor modification instead of mass-changing this part of the load process either with a modified onInit().

Trenloe
January 30th, 2019, 20:19
data_desktop.lua is a global script package defined in base.xml with the script name of Desktop Therefore, you can access functions and variables in that package with Desktop.XXXXX - where XXXXX is a function or variable. You can use the same approach to override functions and variables.

You could try something like this in an extension:


function onInit()

if not User.isHost() then
Desktop.aCoreDesktopDock = my_aCoreDesktopDock;
end

end

my_aCoreDesktopDock =
{
["local"] =
{
{
icon="button_library",
icon_down="button_library_down",
tooltipres="sidebar_tooltip_library",
class="library",
subdock = true,
},
},
["live"] =
{
{
icon="button_library",
icon_down="button_library_down",
tooltipres="sidebar_tooltip_library",
class="library",
subdock = true,
},
},
};

Tielc
January 30th, 2019, 20:55
Thank you so much for the help! I ran into an issue trying to put the the script into a lua file, not sure what was going on there, kept getting empty file. Either way, I was able to add it to the script of the xml file. I've attached it for reference should anyone come across this later wanting to accomplish the same thing.

I have the lua file included and commented out the includefile in the xml. Not sure what I was doing wrong there.

And for reference, the tokens still appear on maps for the players, but the button is gone as desired.

Trenloe
January 30th, 2019, 22:50
LUA files need to be in a <script> entry in the extension.xml file.

See here: https://www.fantasygrounds.com/refdoc/script.xcp and also a lot of extensions for examples.