Closed bext1a closed 1 year ago
Same question for me.
This page https://foundryvtt.com/packages/torch states: "Adds a HUD button to toggle light with specific properties based on equipment and spells in inventory. Out of the box, multiple light sources are available on multiple systems. The selection of light sources is extensible through a JSON file, as detailed in the README"
But I don't understand how to add new light sources. I'm playing PF2e. Is it possible with this module to add a light spell to the list and a player to use this light spell while another uses a torch?
I was looking for documentation on this as well. I am also confused on how does the Flickering Light
animation type translates within the actual JSON value. It does not match neither Flicker
nor Flickering
Would it be perhaps be possible to include a json file with additional light sources as example in the readme?
@lupestro could you please take a look at this when you have some time?
The documentation you are looking for is on the v10 branch of the repository because I haven't yet switched v9 to a branch and v10 to main (well, its called master at the moment, but that needs to change, too.).
So you'll find the updated README.md in https://github.com/League-of-Foundry-Developers/torch/tree/v10 A right click on the button pops up a context menu that lets you change what light source you use when you left click. You can also find the sources.json in that directory, the source list used by the module by default, which you can use as a template for any light sources you want to add or replace.
I am not a programmer, but I have spent two days messing with the sources file trying to get a new system to work on this topic (custom light sources), and I just cannot do it with the information and skills I have on hand at the moment.
I do not understand the topology file, or what I need to do to add a new system. I have tried just adding to the default sources as well, and that didn't work.
I am using the Dungeon Crawl Classics system, in order to add this system to topology, if I am understanding this correctly, I would have to go into the module files themselves and edit topology.json directly. Is this correct?
Could I just rename DnD5e as Dungeon Crawl Classics and have it work under that system with equipment of the same name, or is there something more complicated to this?
Additionally, once that is completed, I would have to then edit the source file to chance the system from dnd5e to Dungeon Crawl Classics correct?
If you want to use DCC without tracking quantities, a custom set of sources something like the following should work - just set it up in Additional Light Sources:
{
"dcc": {
"system": "dcc",
"topology": "standard",
"quantity" : "quantity",
"sources": {
"Candle": {
"name": "Candle",
"type": "equipment",
"consumable": false,
"states": 2,
"light": [
{ "bright": 5, "dim": 10, "angle": 360 }
]
}
}
}
}
Now I just checked and, with DCC, you're in luck, because it really does quantify consumables in a standard topology. If I do game.actors.getName('Fred').items.getName('Candle')
, I can see that the system.quantity
property of the item holds the quantity. This, in turn, means, you should just be able to use the above with "consumable:true", and then add whatever other light sources you wish.
Why a candle? Well, I am told "it is better to light one candle than to curse the darkness." ;) Hopefully this shed some light. If not, I'm glad to go into this deeper with you here.
The topology file only really needs updating for radically different systems, like GURPS, that don't use items for equipment and don't make them a system property of the item but bury them in the actor data or some other screwy place. Then we need to have the methods tunnel into the system's "special place" for that information. For GURPS, we actually needed to use system-supplied methods to walk the nested equipment structures to find the light sources. For most systems, though, the most customization that is needed is a change to the name of the property on the item that holds the quantity. (Earthdawn, for example, used "amount" rather than "quantity" for the property name.) We customize it by setting the "quantity" property of the system in the JSON.
We supply a set of sources out of the box for systems that supply compendia with initial equipment that includes light sources. DCC, sadly, is not one of the systems that is in a position to offer that luxury, so neither do we.
Yep - I just tested the above locally with a hastily constructed DCC world and it works.
Yep - I just tested the above locally with a hastily constructed DCC world and it works.
Thank you! I'm actually using DCC for MCC, so I have alot of "high-tech" light sources I need. Your example helped me immensely. As a side note, to get it to work, I had to delete the "default" code from my additional source file. It now looks like this:
{ "dcc": { "system": "dcc", "topology": "standard", "quantity": "quantity", "sources": { "Candle": { "name": "Candle", "type": "equipment", "consumable": false, "states": 2, "light": [{ "bright": 0, "dim": 10, "angle": 360 }] }, "Glow Cube": { "name": "Glow Cube", "type": "equipment", "consumable": false, "states": 2, "light": [{ "bright": 3, "dim": 16, "angle": 360, "color": "#c0ecf2", "animation": [{ "type": "Star Light", "speed": 2, "intensity": 2, "reverse": false}] }] } } } }
I am having a problem however where the "animation" isn't working. what am I doing wrong?
Edit: Changed the JSON a slight bit, everything works except the animation. Also, I have no idea how to put my code in a block like you have and I am so sorry, because it hurts my own eyes to look at and I can only imagine the pain this is causing you.
Usually for those kind of questions, I first set up a prototype token for an actor with the desired settings, get it all just right, then export the actor and look at how the data shows up in the JSON data. Very often the text for an animation isn't identical to its display text. In this case, having just done this experiment, it is "starlight", rather than "star light". The space matters.
That was it, thank you. It works! The export tip will see me through, thank you so much for your patience here!
np - I'm glad that people are finding the enhancements I did this summer useful in new and interesting places.
np - I'm glad that people are finding the enhancements I did this summer useful in new and interesting places.
Hi Lupestro! I am trying to figure out, why my additional light sources won't work with the system "Tales from the Loop". I don't need the tracking features, just the light sources. So I tried to alter your code above for my needs, but if I use "default" and try do right click on the "One Button" on the Token, there is only one light source called "self" there. Seems to ignore the provided JSON File in the Config. If I replace the "default" to "tftloop" the One Button will disappear in the Token Menu. Now I got stuck with it. Do you have some advice for me?
Edit: I am using Foundry VTT v10 - Build 290
My JSON looks like:
{
"tftloop": {
"system": "tftloop",
"topology": "none",
"quantity" : "quantity",
"sources": {
"Flashlight": {
"name": "Taschenlampe",
"type": "none",
"consumable": false,
"states": 2,
"light": [
{
"bright": 8,
"dim": 20,
"angle": 360
}
]
},
"MagLite": {
"name": "MagLite Taschenlampe",
"type": "none",
"consumable": false,
"states": 2,
"light": [
{
"bright": 15,
"dim": 30,
"angle": 360
}
]
},
"Zippo": {
"name": "Zippo Feuerzeug",
"type": "none",
"consumable": false,
"states": 2,
"light": [
{
"alpha": 0.2,
"angle": 360,
"bright": 5,
"color": "#cd9d18",
"coloration": 1,
"dim": 8,
"attenuation": 0.5,
"luminosity": 0.5,
"saturation": 0,
"contrast": 0,
"shadows": 0,
"animation": {
"type": "torch",
"speed": 5,
"intensity": 5,
"reverse": false
},
"darkness": {
"min": 0,
"max": 1
}
}
]
}
}
}
}
Tarubain, I just went through this myself, you might want to change your topology to "standard" instead of "none" here and see if that fixes it since you are replacing the default. I had to delete the "default" option altogether and follow the other examples to get mine to work.
Tarubain, I just went through this myself, you might want to change your topology to "standard" instead of "none" here and see if that fixes it since you are replacing the default. I had to delete the "default" option altogether and follow the other examples to get mine to work.
Thx for your message. I changed the topoly to "standard". Nothing changed, the One Button isn't there. Where did you delete the "default" option? In the sources.json?
Thx for your message. I changed the topoly to "standard". Nothing changed, the One Button isn't there. Where did you delete the "default" option? In the sources.json?
I copied the sources.json initially, and deleted the default setting after adding my custom sources. I was having the same issue you were.
You might want to try deleting the zippo option and see if that brings the button back. My biggest issue was the source with the animation option.
Thx for your message. I changed the topoly to "standard". Nothing changed, the One Button isn't there. Where did you delete the "default" option? In the sources.json?
I copied the sources.json initially, and deleted the default setting after adding my custom sources. I was having the same issue you were.
You might want to try deleting the zippo option and see if that brings the button back. My biggest issue was the source with the animation option.
I checked all JSON with the checker and tried nearly every possible combination, kept only 1 Source and so on. The Button always will disappear :( I copied Lupestros Code and replaced "dcc" with "tftloop" and the Button is gone either.
Kardiss, is it possible to provide me your custom.json and sources.json please? So I can better figure out what you have done to make this working. I really appreciate your help so far. Thanks! :)
` "dcc": { "system": "dcc", "topology": "standard", "quantity": "quantity", "sources": { "Candle": { "name": "Candle", "type": "equipment", "consumable": false, "states": 2, "light": [{ "bright": 1, "dim": 10, "angle": 360, "animation": { "type": "flame", "speed": 3, "intensity": 3, "reverse": false} }] }, "Glow Cube": { "name": "Glow Cube", "type": "equipment", "consumable": false, "states": 2, "light": [{ "bright": 5, "dim": 20, "angle": 360, "color": "#c0ecf2", "alpha": 0.5, "animation": { "type": "starlight", "speed": 2, "intensity": 2, "reverse": false} }] }, "Torch, each": { "name": "Torch, each", "type": "equipment", "consumable": false, "states": 2, "light": [{ "bright": 3, "dim": 17, "angle": 360, "color": "#f9d17b", "alpha": 0.5, "animation": { "type": "flame", "speed": 5, "intensity": 5, "reverse": false} }] }, "Lantern": { "name": "Lantern", "type": "equipment", "consumable": false, "states": 2, "light": [{ "bright": 6, "dim": 27, "angle": 360, "color": "#f9d17b", "alpha": 0.5, "animation": { "type": "flame", "speed": 5, "intensity": 5, "reverse": false} }] } } } }
The above is my "alternate sources" json. This is the only file I had to do anything with. I had originally copied the "sources" json and worked off it (this is what I meant by deleting the default)`
And apologies for this not looking as good as yours, I still don't know how to do that.
Thx Kardiss! I reinstalled torch and all files are original again, copied all your lines in your alternate sources over my custom json, changed only both "dcc" to "tftloop" and the Button is still missing. Crap, seems Torch won't run with my system... :(
@Tarubain well, we shall see. First, you shouldn't replace the sources.json inside the package, but use the setting in the configuration to supply an additional JSON file of the same format as source.json with your new light sources. That way, your Torch setup is never damaged by changes you make to the point it needs to be reinstalled.
Second, I'll install Tales from the Loop locally and look at how the system arranges its data, and specifically how its equipment is handled.
After my investigations, I'll show you the series of things I looked for to find out how the system stores stuff. Then we'll see where to go from here.
@Tarubain I created a tftloop world and added a character named Theo, an item named Candle, and gave a Candle to Theo. Then I went to the console and typed:
game.system.id
game.actors.getName('Theo').items.getName('Candle')
This told me the system id was 'tftloop' and that the data for the item has three system properties
system:
bonus: 1
description: "item"
notes: ""
Since there's nothing about quantity there, we now know this style of system doesn't keep track of paperclips ;)
If I've done it right, you should still be able to use specific light sources with system "tftloop" as long as you use "consumable": false
for each of them.
I played with it some more. Without adding anything to the system, a character actually does get a single light source called "self", whose bright and dim radii are set in Torch module configuration.
Hopefully all of this will help.
@Tarubain Also, your original data is very close to something that should have worked. As mentioned elsewhere, the topology should be "standard". Supported types for named light sources are "cantrip" or "equipment". The only other place where I can see it went wrong at the moment is in the following:
"sources": {
"Flashlight": {
"name": "Taschenlampe",
The key for the source and the name value need to be the same. Having the value both as a key and as a value in the record means I can look it up using the key, but once I have it, it has the same name internally and I can use it elsewhere without dragging the parent structure around with me. However, to use it that way, they need to be consistent.
However, I have grabbed your structure into my test data and made the adjustments noted above. I gave Theo a Taschenlampe and it is working as you spec'd it.
@lupestro Thanks for all your effort and your tipps.
I reinstalled Torch to have clean files, changed all the values for consumable to false, changed the Key and the Name values to be consistent and also to be exact to the item name. And guess what, now it is working. I am so happy! Thanks a lot for your help. Can I buy you a coffee or something? :)
This issue has collected several facets over time and can only get more difficult to close if this continues. When the following have been delivered - things I have learned from this discussion:
then I will close this ticket. Fresh questions can occur in fresh issues
Once this ticket is close, I will do the work to add the alias capability I described above.
After I got the branching straightened out, I did a bunch of progress today to simplify the work for supplying per-game light sources, by providing sensible defaults with less boilerplate and ceremony. Basic alias support also made the cut. It's all in the PR linked above now, coming very soon.
If someone wants to look at the updated README.md
in the PR and give feedback, I'd appreciate it.
Here's a taste of what a typical customSources.json can reduce to:
{
"dnd5e": {
"sources": {
"Phantom Torch": {
"consumable": true,
"light": [
{ "bright": 5, "dim": 20, "angle": 360, "color": "#ff9329", "alpha": 0.6 }
]
},
"Candle": {
"consumable": true,
"light": {
"bright": 10, "dim": 15, "angle": 360, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 5, "intensity": 5, "reverse": false }
}
}
}
},
"test": {
"topology": "gurps",
"sources": {
"Flashlight": {
"light": { "bright": 10, "dim": 0, "angle": 3, "color": "#ffd6aa", "alpha": 1.0 }
}
}
}
}
@lupestro Great work! Much more streamlined and clearer now with less error-prone. Fantastic!
If this will be updated, do I and the other users need to adapt their customLights.json to this streamlined code?
Hello, I am trying to use this module for Alien RPG, but to no avail. I'm sure there's something i'm missing, but i can't find what it is. I'm using V9, and have made a file named "customsources.json" in the torch directory
Here's the content:
{
"alienrpg": {
"topology": "standard",
"sources": {
"Hi-beam Flashlight": {
"consumable": false,
"light": [
{ "bright": 10, "dim": 15, "angle": 90, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 2, "intensity": 5, "reverse": false }
]
},
"TNR High Beam Shoulder Lamp": {
"consumable": false,
"light": [
{ "bright": 10, "dim": 15, "angle": 90, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 2, "intensity": 5, "reverse": false }
]
},
"Land Vehicle Lights": {
"consumable": false,
"light": [
{ "bright": 15, "dim": 20, "angle": 90, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 2, "intensity": 5, "reverse": false }
]
}
}
}
}
Thanks in advance
@ICronyI Hi! Nice to meet another D6 Free League System player. 😊
A quick check of your json with jsonchecker.com says you have errors in your array structure somewhere. Try to use an app like Visual Code (Free) to bust down the errors. I am on the smartphone currently and can’t check.
@Tarubain Hey! yeah it's always nice to meet Free league players, i also do play Tales from the loop myself and it's great :) Thank you for this, i checked with visual code and corrected the code, it is now like this:
{
"alienrpg": {
"topology": "standard",
"sources": {
"Hi-beam Flashlight": {
"consumable": false,
"light": [
{ "bright": 10, "dim": 15, "angle": 90, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 2, "intensity": 5, "reverse": false }
}]
},
"TNR High Beam Shoulder Lamp": {
"consumable": false,
"light": [
{ "bright": 10, "dim": 15, "angle": 90, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 2, "intensity": 5, "reverse": false }
}]
},
"Land Vehicle Lights": {
"consumable": false,
"light": [
{ "bright": 15, "dim": 20, "angle": 90, "color": "#ff9329", "alpha": 0.5,
"animation": { "type": "torch", "speed": 2, "intensity": 5, "reverse": false }
}]
}
}
}
}
It doesn't show any errors anymore in visual code, however it still doesn't work sadly :/
@ICronyI Hmm, do you have created items with the exact title like „Hi-beam Flashlight“ and equipped this for your character?
@Tarubain Yes i have, but when i click on the torch HUD button, all it does is use the standard setting you can set in the module settings. I tried right clicking the button as well but it does nothing either
@Tarubain The full data currently supported will still work because the omitted fields in the relaxed data are just taking defaults that would otherwise have had to appear explicitly in the full data. The core sources.json populates all the fields and uses the same parsing as the user-supplied data.
@ICronyl I will take a look at what happens with alienrpg as soon as I get a chance. Until I get the update published later this week, you will need to supply all the fields - the defaults aren't in place yet. Try that first.
@lupestro Thanks for the information. 👌🏻😊
@ICronyI If you need my customLights.json as a template, I will post it here.
@bext1a @patmmz25 Hopefully bringing v10 to the main (default) branch will ensure you can see the v10 documentation. @Tarubain @Kardiss I've updated the documentation to be a lot clearer. Hopefully it resolves any of the things that made your first custom sources JSON a rougher ride than it might have been.
@ICronyI I'm not forgetting you. I will try your sheet out and see what might be the issue. Can you repost to a separate issue in which we can continue the discussion?
This issue will go on forever as long as more people keep replying to it with more requests. I'm hoping the v2.2.0 update will contain enough simplification and its README contain enough detail that fewer people will have this specific issue, so I'm going to close it and start fresh.
Any example for this?