
I want to be able to detect when a character sheet is opened if certain attributes do not exist yet. I initially tried something like:
if (className == undefined){
Unfortunately, this didn't work as I planned because the class name always returned as undefined when the sheet was opened, regardless of if it was changed in the past. And I would like to be able to detect the lack of attributes because despite setting their values in my HTML, certain attribute values are not properly detected and when I try to use them in calculations, the script returns a NaN error. This may have to do with the fact that they are set in spans as opposed to inputs, but I'm not sure. So if there is a better way to resolve this error, I would be grateful. I'm also willing to share any if my code if it might help?
if (className == undefined){
setAttrs({
//set stats
})
}Unfortunately, this didn't work as I planned because the class name always returned as undefined when the sheet was opened, regardless of if it was changed in the past. And I would like to be able to detect the lack of attributes because despite setting their values in my HTML, certain attribute values are not properly detected and when I try to use them in calculations, the script returns a NaN error. This may have to do with the fact that they are set in spans as opposed to inputs, but I'm not sure. So if there is a better way to resolve this error, I would be grateful. I'm also willing to share any if my code if it might help?