Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Check vision and bars

Is there a way to check a token's settings? Like @{selected|emits_low_light} and if so, what are the attributes you would use to call up these token traits?
1632086399

Edited 1632086836
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron generally uses untranslated attribute names in token mod. You can pick those up from the help document. Also, you can find the full gamut on the API page for graphic objects (scroll down in the section I linked, they are all gathered in a subtable) Also, the Reporter script has built in lighting checking commands. You can custom build your own, but here is what you get when you run  !report --vision ---vision Or for light: !report --light ---lightplus You can use the buttons to actually change the values (requires installing token-mod).
1632096081
timmaugh
Pro
API Scripter
Talk about a tailor-made usage for Reporter. =D
Unfortunately Reporter crashes my API every time I run it. 
1632168095
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Peacekeeper B said: Unfortunately Reporter crashes my API every time I run it.  What sheet are you using? I've only tested against Roll20 5e and PF2 sheets.
My custom Castles & Crusades sheet.  keithcurtis said: Peacekeeper B said: Unfortunately Reporter crashes my API every time I run it.  What sheet are you using? I've only tested against Roll20 5e and PF2 sheets.
1632178096
The Aaron
Roll20 Production Team
API Scripter
I you post the crash error, we might be able to tighten it up so it doesn't do that anymore.
I'll reinstall reporter today and run it to get the screen capture.  But back to the original post, is there another way to call up token traits? Like I know @{selected|bar1} will reveal the value of bar1 in chat. But what about vision on/off?
1632224616

Edited 1632224722
David M.
Pro
API Scripter
FYI I ran into a conflict with Reporter last night as well. Not trying to hijack the thread, just posting here in case it aids troubleshooting. Was just testing out how to use Tim's libInline script for processing inline rolls. I use the 5e OGL sheet, but don't think we're getting that far as it is a compile error. Here the code snippet. I know revealing module is overkill for this, but it's just the template I had handy :) The code compiles and works fine unless I have Reporter installed (1-click version). const LibInlineTest = (() => { const version = '0.1.0'; const checkInstall = () => { log('-=> NAME v'+version+' <=-'); }; const handleInput_libInlineTest = (msg) => { if (msg.type !== "api" && msg.content.indexOf("!libtest") === 0 ) { return; } let parsedInlines = libInline.getRollData(msg); log(parsedInlines); parsedInlines.forEach((inline) => { log(inline.getDice('all')); log(inline.getRollTip()); log(inline.getTableValues()); }); }; const registerEventHandlers = () => { on('chat:message', handleInput_libInlineTest); }; on('ready', () => { checkInstall(); registerEventHandlers(); // Make sure libInline exists, and has the functions that are expected if('undefined' === typeof libInline || (['getRollData','getDice','getValue', 'getParsed', 'getRollTip', 'getTables'].find(k=> !libInline.hasOwnProperty(k) || 'function' !== typeof libInline[k] )) ) { // notify of the missing library sendChat('',`/w gm <div style="color:red;font-weight:bold;border:2px solid red;background-color:black;border-radius:1em;padding:1em;">Missing dependency: libInline</div>`); } }); })(); Here's the crash error
1632228317
timmaugh
Pro
API Scripter
Peacekeeper B said: I'll reinstall reporter today and run it to get the screen capture.  But back to the original post, is there another way to call up token traits? Like I know @{selected|bar1} will reveal the value of bar1 in chat. But what about vision on/off? If you just need to see a particular trait of a particular token, you can use Fetch to retrieve that data. For instance, if you want to know if the token emits low light, you can check that using: @(selected.emits_low_light) If you just need to report that to the chat, you'll want ZeroFrame, too, so that you can make use of the {&simple} output: !@(selected.emits_low_light){&simple} The Fetch thread has a list of the properties you can return... but, like I said, this would just be for one-off applications. Keith's Reporter looks to be the better solution for pan-ludus info gathering.
1632233786
David M.
Pro
API Scripter
Looks like Peacekeeper & I have similar error logs - something being interpreted as an undefined array. Peacekeeper, is your error when you try to spin up the sandbox, or does it load fine but crash when you try to use another script? It might help folks to know what other scripts you have installed also, as mine seemed to be a conflict with Reporter and not a Reporter-only error.
It crashes when I try to use Reporter. Doesn't seem to impact other APOI/Scripts until I run reporter. David M. said: Looks like Peacekeeper & I have similar error logs - something being interpreted as an undefined array. Peacekeeper, is your error when you try to spin up the sandbox, or does it load fine but crash when you try to use another script? It might help folks to know what other scripts you have installed also, as mine seemed to be a conflict with Reporter and not a Reporter-only error.
1632233913

Edited 1632234009
Zeroframe always causes my API to crash, so I won't be using that. But just as an FYI, it does work, until I try to use my other API/macros which then crash. So I would rather keep the rest of my API/Macros than use Zeroframe just so I can look at vision settings. timmaugh said: Peacekeeper B said: I'll reinstall reporter today and run it to get the screen capture.  But back to the original post, is there another way to call up token traits? Like I know @{selected|bar1} will reveal the value of bar1 in chat. But what about vision on/off? If you just need to see a particular trait of a particular token, you can use Fetch to retrieve that data. For instance, if you want to know if the token emits low light, you can check that using: @(selected.emits_low_light) If you just need to report that to the chat, you'll want ZeroFrame, too, so that you can make use of the {&simple} output: !@(selected.emits_low_light){&simple} The Fetch thread has a list of the properties you can return... but, like I said, this would just be for one-off applications. Keith's Reporter looks to be the better solution for pan-ludus info gathering.
1632239961
timmaugh
Pro
API Scripter
The Aaron said: I you post the crash error, we might be able to tighten it up so it doesn't do that anymore. Goes for ZeroFrame, too.
1632244488
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Peacekeeper B said: It crashes when I try to use Reporter. Doesn't seem to impact other APOI/Scripts until I run reporter. David M. said: Looks like Peacekeeper & I have similar error logs - something being interpreted as an undefined array. Peacekeeper, is your error when you try to spin up the sandbox, or does it load fine but crash when you try to use another script? It might help folks to know what other scripts you have installed also, as mine seemed to be a conflict with Reporter and not a Reporter-only error. Can you post the sheet you are using, and the macro that causes the crash? If it's a macro and not spin up, it might be due to poor error-catching on my part. Timmaugh is helping me look into this, which basically means he's doing a lot of Smart Guy stuff, and I am standing back, nodding sagely and occasionally expostulating, "Good Lord, Holmes!".
1632279893
timmaugh
Pro
API Scripter
Peacekeeper B said: OK, that looks like a sheetworker is breaking. If it is your custom sheet, can you post your sheetworker code?
1632286720
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks for the game invite, Peacekeeper. I discovered what the issue was. This is why I had asked what sheet you are using. Your custom Castles and Crusades sheet is not fully compatible with Reporter, at least out of the box. The issue turned out to be a current shortcoming of Reporter, due to some ways that character sheets are implemented on Roll20. Roll20 character sheets lack an identifier attribute. There is nothing on them that says "this is the D&D 5th Edition by Roll20 Sheet" or "this is the Call of Cthulhu sheet". In order for Reporter to perform some of its functions, it has to poll for a known attribute on a sheet. If it finds the attribute, it assumes that it is the PF2 sheet. Otherwise it assumes the 5e sheet. There are a couple of features that tie into this, notably swapping PC and NPC attributes on the fly. Both of those sheets have a different AC and NPC AC attribute for instance, and Reporter knows how to ask for the proper one based on a PC/NPC test. Your Castles and Crusades sheet doesn't feature that PC/NPC distinction, at least as far as I could tell from a quick overview. So much of the sheet is not exposed on the Attributes and Abilities tab that I can't even find hooks to poll for. So I manually cut out a few subroutines. It will assume all sheets are PCs. I also tweaked a few of the built-in macros to work better with the C&C sheet. It appears to be working normally now, but you may have problems with some of the built-in macros still. Hopefully those will cause silent failure and not crashes, or puzzling "no tokens match those criteria" messages. But by and large, I think it will work. You may need to come up with other criteria for filtering. I imported the code manually and made the changes to the local copy of your script. Let me know if you run into any more oddities.
1632287038

Edited 1632287234
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I also swapped the default value on the npcsubstitutions keyword so that your copy defaults to false. You can ignore that keyword.
Which one? timmaugh said: Peacekeeper B said: OK, that looks like a sheetworker is breaking. If it is your custom sheet, can you post your sheetworker code?
Thanks Keith. I'll test it later today at "work". keithcurtis said: Thanks for the game invite, Peacekeeper. I discovered what the issue was. This is why I had asked what sheet you are using. Your custom Castles and Crusades sheet is not fully compatible with Reporter, at least out of the box. The issue turned out to be a current shortcoming of Reporter, due to some ways that character sheets are implemented on Roll20. Roll20 character sheets lack an identifier attribute. There is nothing on them that says "this is the D&D 5th Edition by Roll20 Sheet" or "this is the Call of Cthulhu sheet". In order for Reporter to perform some of its functions, it has to poll for a known attribute on a sheet. If it finds the attribute, it assumes that it is the PF2 sheet. Otherwise it assumes the 5e sheet. There are a couple of features that tie into this, notably swapping PC and NPC attributes on the fly. Both of those sheets have a different AC and NPC AC attribute for instance, and Reporter knows how to ask for the proper one based on a PC/NPC test. Your Castles and Crusades sheet doesn't feature that PC/NPC distinction, at least as far as I could tell from a quick overview. So much of the sheet is not exposed on the Attributes and Abilities tab that I can't even find hooks to poll for. So I manually cut out a few subroutines. It will assume all sheets are PCs. I also tweaked a few of the built-in macros to work better with the C&C sheet. It appears to be working normally now, but you may have problems with some of the built-in macros still. Hopefully those will cause silent failure and not crashes, or puzzling "no tokens match those criteria" messages. But by and large, I think it will work. You may need to come up with other criteria for filtering. I imported the code manually and made the changes to the local copy of your script. Let me know if you run into any more oddities.
Keith, It works. I wonder if I added a simple check box "Is this a PC" to the character sheet if this can be simplified to only show the Players? My concern is just to do a quick check to ensure all the players can see, not really if a monster has vision activated as it really won't impede them. Also, I do have a passive perception in my sheet. Can I just change the code to pull that attribute?
1632319364
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If you are comfortable changing the code, sure. The switch statement that handles all of the built-in macros starts around line 339 on your copy. Or you can just design your own special case macros and put them into a  Chat Menu . Since you are designing your own sheet, if you add an attribute called "npc" with a npc (default) value of 0 and a pc value of 1, following the pattern of the D&D 5th Edition by Roll20 Sheet, it should run right out of the One-click, for the most part. The built in macros might still have a few oddities, though. Example the default pc detail macro for the 5e sheet assumes an attribute called "gp". It shouldn't break, just fail to report a value and cause a slight display oddness.
1632321992
timmaugh
Pro
API Scripter
Peacekeeper B said: Which one? timmaugh said: OK, that looks like a sheetworker is breaking. If it is your custom sheet, can you post your sheetworker code? Yes. >D Let's start with all of them, or any that are message-driven. Your sandbox is breaking in a message handler portion, it looks like, which makes sense if it is interacting with ZeroFrame. If you post any that respond to or handle a message, I might be able to see where the interaction is getting janky. Very technical term, there. Janky.