Thread: Adding Image to A Map
-
December 25th, 2023, 06:03 #1
- Join Date
- Mar 2020
- Posts
- 34
Adding Image to A Map
Hello everyone, I've been looking into how to make extensions for the first time. It's my Christmas present to myself. I'm still at the beginning, looking at various tutorials, but most of them are outdated at this point, so I've also been relying on unpacking Core RPG and looking at API documents but there's a lot, so I may need some help.
First question, is it possible to add an image to another image programmatically through a Lua extension? Would I use the addLayer method for it that I see here, and add an image layer that points to an icon resource or something like that? Or would it require something like creating a windowclass with an icon image without a frame?
Example uses would be adding random decorations to a map, or making other sorts of indicators on the map besides the arrow, square, and circle.
-
December 25th, 2023, 22:32 #2
The current CoreRPG capability that I'm aware of that does this is around the blood splats/death indicators when an NPC is removed from the CT. So yes, its achievable There is a Death Indicators extension that you might find that does a similar thing, but the code you are looking for might be more apparent. Death Indicator Ex v4.5 extension for 5e Fantasy Grounds Unity
Be aware, make sure you are adding them as layers/images and not tokens. Tokens impact visibility calculations and performance (the extension originally had this problem, but I think SR has since resolved it.)
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
December 25th, 2023, 22:49 #3
- Join Date
- Mar 2020
- Posts
- 34
Yes, thanks! I was hoping someone would respond with some extensions that did something similar I can look at, but I realized I forgot to ask.
Appreciate the direction! And happy holidays!
-
December 31st, 2023, 07:08 #4
- Join Date
- Mar 2020
- Posts
- 34
Hope everyone had a good Christmas and is ready for New Year's!
I've been experimenting with some image adding using the direction of the death indicators functionality Lord Entrails pointed me towards, both the Core RPG version and the 5e extension above, but I have run into a few issues I hope someone can help me. Specifically, I can't really figure out what the "asset" parameter is for the addLayer parameters. I keep getting errors when throwing my own images in there from the same place I put other images (an icon entry in my extension.xml file in the base node pointing to an image in my graphics folder). I can't really figure out what is put in there or how. For CoreRPG, I found the general place its put it in in the manager_image_deathmarker.lua file in the getSetMap() where the sAsset variable here seems to be the key.
function getSetMap()
local tSetMap = { };
for _,nodeSet in ipairs(DB.getChildList("settings.imagedeathmarkers et")) do
local sName = DB.getValue(nodeSet, "name", "");
local tSetData = {};
for _,nodeAsset in ipairs(DB.getChildList(nodeSet, "assets")) do
local sAsset = DB.getValue(nodeAsset, "value", "");
if sAsset ~= "" then
table.insert(tSetData, sAsset);
end
end
local sTint = DB.getValue(nodeSet, "tint", "");
if (sTint ~= "") then
tSetData.tint = sTint;
end
tSetMap[sName] = tSetData;
end
return tSetMap;
end
local x,y = token.getPosition();
local nGridScale = TokenManager.getTokenSpace(token);
Debug.console("manager_image_deathmarker.lua sAsset", sAsset); --I added this line here
Image.addLayerPaintStamp(sPath, nLayerID, { asset=sAsset, w=nGridScale, h=nGridScale, x=x, y=y, color=sTint });
Thanks and have a Happy New Year!
-
December 31st, 2023, 10:05 #5
[QUOTE=SieferSeesSomething;704951]...nothing would pop up in the console log. Any suggestions on why the console log isn't popping up[.../QUOTE]
The console window only "pops up" (opens by itself) if there is an error. Just writing debug to the console won't automatically open it. You can open the console by using the /console chat command but you may find it easier to open the console.log file from the FG app data directory.
For your first question - sAsset is a FG filepath to a valid graphics file, it isn't an FG icon resource. For example, looking in the database of a test campaign:
Code:<imagedeathmarkerset> <id-00001> <assets> <id-00001> <value type="string">images/Death Markers/blood/blood_01.png@SmiteWorks Assets</value> </id-00001>
Hope this helps.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
January 1st, 2024, 02:33 #6
- Join Date
- Mar 2020
- Posts
- 34
Oh ya, sorry I phrased that wrong. I was able to make the console log pop up easily enough, it's just that the specific message wouldn't appear within it.
For the sAsset field example you gave, that was very helpful to understanding what's happening there, thanks! One more question: How would I use that with an extension I'm making instead of putting the graphic in a separate module? Putting images/testimage.png both in the extensions images folder and adding it as an asset to the test campaign I'm using both didn't work. When I put in "images/Death Markers/blood/blood_01.png@SmiteWorks Assets", it does work. Does it only work if i put a graphic in a separate module? Feels like it would make it difficult to ship it all together in a single extension zip, for example.
Thanks for the help! I feel like I'm getting close!Last edited by SieferSeesSomething; January 1st, 2024 at 04:22.
-
January 1st, 2024, 09:37 #7
I don't know the answer you are looking for but there are many extensions which also have accompanying modules. If your extension was on the forge then any files associated with the extension would also get downloaded for anyone subscribed to it. Extensions aren't limited to just the extension file.
If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
-
January 1st, 2024, 15:27 #8
The graphics files need to be accessible via the FG filesystem - so this is local files (global and campaign based), and in modules (.mod files). So you will need two files - a .ext extension and a .mod module. However, the module file doesn't have to be activated - FG can access the files directly as if it's a filesystem.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
January 3rd, 2024, 04:21 #9
- Join Date
- Mar 2020
- Posts
- 34
Thanks everyone! I made a module file and it seems to be working! Slowly, but surely I'm getting it lol.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks