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

API in Modules

1612478685
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
I have question about API in marketplace modules. I know that any module should be self contained (so not rely on external API to work by default), but is there a way to make a "package" of modules an functionalities with all the dependency taken care for? The main example would be, let say I have a game that uses Bumper, the TokenMod and superscript API to enhance the gameplay, would be possible for me to automatically include these API for anyone who has a paid subscription (and correlated macro buttons)?
1612489438

Edited 1612489548
Gold
Forum Champion
Unofficial answer. As far as I know, the answer is No, it cannot be included in the Module installing (as far as: It would not install API's). Perhaps, maybe, I supposed, you could include Handouts, either with a custom API code to copy-paste; or links to the desired Community-Created API like TokenMod, or just instructions telling the user to install them. MACROS yes you can include with a Module installation, either in the forum of Token Actions, or Abilities on the A&A tab of a Character that's included, OR more likely in your case I think you would put your Macros under COLLECTIONS tab.  Yes, it is possible to populate the Collections tab with macros as part of your Module.  For example Rime Of The Frostmaiden installs a ton of macros for the GM to use. As you would understand, IF the macros you include call upon an !api-command then that macro will NOT work correctly until the User/Buyer follows your instructions sheet to install the recommended/required API scripts. Maybe -- and I think this is up to you -- maybe you could include a full suite of the Macros without the API needed, and an enhanced suite of the Macros with the API !command included, perhaps by labeling the macro names alphabetically: Requires-API-Macro-Armor Requires-API-Macro-Sword Requires-API-Macro-d20 Basic-Free-Macro-Armor Basic-Free-Macro-Sword Basic-Free-Macro-d20 The nearest comparison I can recall is some Marketplace Art-Packs, called something like Dungeon Builder (?) maybe ones created by Stephen (?), it's a marketplace Map Tiles art pack that RECOMMENDS an API script to be installed, and gives instructions for why that API would make the map-tiles more powerful to work with.
1612490338
The Aaron
Roll20 Production Team
API Scripter
I have some ideas about this, depending on what you want to do.
1612491185
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
The Aaron said: I have some ideas about this, depending on what you want to do. Obviously using this power for evil u_u I have a couple of games that make large use of rollable backgrounds and token so something like your script to change them would be useful (or the scriptcard one for the rituals). A player can still use the  module without them but it would be great to have those installed, also because I could provide complex macro button or write simple functions for the GM to use. If I tell the GM what script to install to use the functions, it's ok, but it's a bit annoying... it would be nice to have a "package script" that automatically load all the necessary scripts would be better than either tell them what to do or copy and paste all the code in a single script (that besides being ethically questionable, has the problem of conflict and unmantained code)
1612491342
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Gold said: Unofficial answer. As far as I know, the answer is No, it cannot be included in the Module installing (as far as: It would not install API's). Perhaps, maybe, I supposed, you could include Handouts, either with a custom API code to copy-paste; or links to the desired Community-Created API like TokenMod, or just instructions telling the user to install them. MACROS yes you can include with a Module installation, either in the forum of Token Actions, or Abilities on the A&A tab of a Character that's included, OR more likely in your case I think you would put your Macros under COLLECTIONS tab.  Yes, it is possible to populate the Collections tab with macros as part of your Module.  For example Rime Of The Frostmaiden installs a ton of macros for the GM to use. As you would understand, IF the macros you include call upon an !api-command then that macro will NOT work correctly until the User/Buyer follows your instructions sheet to install the recommended/required API scripts. Maybe -- and I think this is up to you -- maybe you could include a full suite of the Macros without the API needed, and an enhanced suite of the Macros with the API !command included, perhaps by labeling the macro names alphabetically: Requires-API-Macro-Armor Requires-API-Macro-Sword Requires-API-Macro-d20 Basic-Free-Macro-Armor Basic-Free-Macro-Sword Basic-Free-Macro-d20 The nearest comparison I can recall is some Marketplace Art-Packs, called something like Dungeon Builder (?) maybe ones created by Stephen (?), it's a marketplace Map Tiles art pack that RECOMMENDS an API script to be installed, and gives instructions for why that API would make the map-tiles more powerful to work with. Uuuh that's interesting, is there a way that you know to make the macro work as basic (if the api is not installed) while having a different behavior if installed? I made something like that for the unofficial DG sheet and the bond, but in that I was allowed to use javascript :)
1612529255
Gold
Forum Champion
The Aaron is miles ahead of me on understanding this, definitely follow-up with him & use his advice! I'm not entirely certain of that answer, I think that the macro will just throw an Orange Error message into their chat, POSSIBLY along with executing the remainder of the macro normally. Example macro: !tokenmod --DoStuff /r 5d20 On a non-Pro user, I think the !command will cause an orange error message in the chat (but not crashing the game or anything, just sort-of unsightly), and then it might still roll the 5d20 anyway.
1612543888
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
For a non-pro user, !command is just ignored. Actually, it's ignored for a pro user too, if there is nothing in the API to catch it and do something with it.
1612551434
Gold
Forum Champion
Well then! Ignore my posts above, Marco. Thank you for catching that Keith. New analysis: Seems like you can just readily include API commands in your Module's Collection Macros, and the API part will just silently fail for anyone who hasn't installed that API yet. So now I think you'd include a handout with the module and advertise it on the details, "PRO USERS: For best use of this module, be sure to install API's A, B, and C. After you install them the macros of this module will automatically support them!" keithcurtis said: For a non-pro user, !command is just ignored. Actually, it's ignored for a pro user too, if there is nothing in the API to catch it and do something with it.
1612553136
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I might still be wary, particularly for APIs not created by Roll20 (i.e. nearly all of them). Your Marketplace product would be dependent upon code that is out of your control. The majority of them are pretty stable, but I would be sure to advertise API enhancements with a great big ol' disclaimer. :)
1612559680
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
keithcurtis said: I might still be wary, particularly for APIs not created by Roll20 (i.e. nearly all of them). Your Marketplace product would be dependent upon code that is out of your control. The majority of them are pretty stable, but I would be sure to advertise API enhancements with a great big ol' disclaimer. :) Ohh for sure, but I would mostly use stuff like Power/ScriptCard or Tokenmod that are codes... that passed the test of time ;) A last question then... if, let say I have a single macro that is either a nice rolled and formatted thing if rolled with ScriptCard, and something more basic when done with a normal macro... How do I suppress the macro part when the API is present? Is there a way !scriptAPI{...} <-- will be ignored if API is not present #bigsimplemacro <-- this always appears I think I could write a second script that "mute" the output, I'm just not sure how !scriptAPI{...} <-- will be ignored if API is not present !scritpMUTEafterthis{} <-- how? #bigsimplemacro <-- this always appears