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

Supernotes API Query

May 03 (2 months ago)
FFR
Pro

Hi,

Currently use the command !gmnote --image --notitle to produce a monster image to the chat window to display an image to my players combined with !gmnote --bio --notitle to give a brief description of the monster

I was wondering if there is an alternative command that will allow my players to target a token and whisper the image and bio to themselves.

Cheers in advance

May 03 (2 months ago)

Edited May 03 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Hi FFR!


I'm not in a position to test, but this should do it:

!selfnote --bio --notitle --id?{target|token_id}


Here are the relevant parts from the documentation:

!selfnote whispers to the sender of the command

--bio Pulls notes from the bio field of the character assigned to a token.

--notitle This option suppresses the title in the chat output. It is useful for times when the GM might wish to show an image or note to the player without clueing them in wha the note is about. For instance, they may wish to reveal an image of a monster without revealing its name. This parameter can be added to any command. It is the only paramater for which this is true. Example !pcnote --image --notitle will pull the first of any images from the token's associate character sheet and send it to the chat without a title. --notitle may be added to the command in any order.

--id supply this with a token id, and the script will attempt to read the notes associated with a specific token, or the character associate with that token. There is no space between --id and the token id. Only one token id may be passed.

?{target|token_id} will prompt the user to target a token when the macro is run, and pull the assiciated token ID 

If the image is in the bio, it should be passed along.



May 03 (2 months ago)
FFR
Pro

Keith,

Thanks so much for looking at this. Unfortunately that command didn't work as it creates a macro query box rather than the target token cross hair


May 03 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Ah, there were a couple of problems with my macro.

The first was that I malformed the query, it should have been @{target|token_id} , not ?{target|token_id} 

The second issue stems from the order of arguments, which is entirely due to my own amateur level coding skills. the --id needs to come before the other arguments, apparently.

This time I have been able to test, and this should work:

!selfnote --id@{target|token_id} --bio --notitle
May 03 (2 months ago)
FFR
Pro

H Keith,

Thanks again. Having trouble with this as it crashes the sandbox each time I use it and it displays the message below.

I select a token, run the macro as a token action and target the monster token then the crash occurs.

I also have the token mod Players can ID set to On


Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again. More info... If this script was installed from the Mod Library, you might find help in the Community API Forum.

For reference, the error message generated was: TypeError: Cannot read properties of undefined (reading 'get') TypeError: Cannot read properties of undefined (reading 'get') at apiscript.js:12911:40 at file:///home/node/d20-api-server/src/pubsub2.js:42:46 at Map.forEach (<anonymous>) at PubSub.publish (file:///home/node/d20-api-server/src/pubsub2.js:42:35) at Timeout.processChatQueue [as _onTimeout] (file:///home/node/d20-api-server/api.js:1350:14) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7)

May 03 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Hm. Let me try with it in a token action. I was testing directly in chat. I'll also log on as a player, just in case.

May 03 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I'm not generating an error. I am testing in a Jumpgate game. Not sure if that makes any difference, though JG has had problems using the targeting syntax on older pages (I.e. pages created on a game before being converted to JG). Do you generate the error on a brand new page with fresh tokens?

BTW, Token-mod's setting won't have any bearing on Supernotes.

One more thing, check your macro for any extra spaces. Again, this shouldn't make a difference, but I want to be sure we are using the exact same macro. More info about your game might help me run more accurate tests, as well: Jumpgate or Classic, which sheet(s) are installed, default or experimental Mod sandbox.

May 04 (2 months ago)
FFR
Pro

Keith,

Apologies as should have tested in a few games.

Just tried it out in a recently set up jump gate game and it works perfectly so thank you so much for your help.

Was tested in an old game transferred over to jump gate which does have the @target issue.

May 04 (2 months ago)

Edited May 04 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

No worries! Glad it got resolved. It would be even better if the underlying issue could be fixed by Roll20, but I suspect that it will crop up less and less over time.

May 15 (2 months ago)

Edited May 15 (2 months ago)

Keith; I'm having some trouble with it. I can't get the console to open or anything else.

I wanted to use this so that my players could click on a token on the map and get data. Maybe I'm just being dense.


That's all I'm getting when I input "!gmnote --config"


PS: Is "Map Pins" still working? Maybe that'll work.

May 15 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Hi Ralts!

If you PM me an invite to your campaign, and then promote me to GM, I'd be happy to take a look and see what's going on.

June 23 (1 month ago)

Edited June 23 (1 month ago)

Keith,

I am getting exactly the same as Ralts above.  I installed it a few days ago and it was working perfectly then all of a sudden nothing.


The one from supernotes is me trying to open the config.  Tried Firefox and Chrome.  All extensions disabled and disable some extra api's just in case.  Did you sort out Ralts at all, maybe its the same with me.


This was working both as typed in chat and as a Macro.

EDIT:  Tried experimental sandbox too, same results.
Edit 2:  Sorry, yes using Jumpgate, latest Chrome Version 137.0.7151.120 (Official Build) (arm64), MacOS Sequoia 15.5

June 23 (1 month ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Hi DM Donkey!

I don't think I ever heard back from Ralts, but I'll extend the same offer—If you PM me an invite to your campaign, and then promote me to GM, I'd be happy to take a look and see what's going on.

What sheet are you using? Jumpgate or Classic?

June 24 (1 month ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

For anyone with the same experience, it seems the configuration was somehow corrupted or mis-set. If you want to re-set Supernotes and it is unresponsive, it's likely that the default is looking for a sheet that does not exist in the campaign. Running:

!gmnote --config|default

...should re-set it to factory standards. :) Then you can use config like normal to set it to your sheet.