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

Macro and API to deliver variable amounts of Experience points to a separate character sheet

I have created a macro that will allow me to select a PC token and  post a chat message that the player has received "Y experience points". With Y being a variable selected in the macro.  I would like to add two things to this. Most importantly, I would like to have a DM "Character" sheet with an attribute for each characters experience points, adn have those points add to that players experience point total. I would prefer to keep this on a sheet that can't be modified by the players, instead of on an attribute on the PCs character sheet.


If at all possible, I would love a sound to play when I trigger the Macro, but I couldn't get  audio master to play the file I loaded.


Here is what I have so far. for the Macro. I have not done anything to create the !AddXp api.   I am completely new to the api, (Zero coding experience) and many of the examples I have seen have left me lost.  Any help is sincerely appreciated!



/em @{selected|token_name} Has gained  ?{Modifier|0} experience

!roll20AM --audio,play|MetalGong

!AddXP



May 05 (6 years ago)
GiGs
Pro
Sheet Author
API Scripter

I cant help with the sound effects, I have never used those.

For adding the experience, look into the ChatSetAttr script (in the one-click library). The problem is you would likely need to use a query to choose which character (you cant do something like @{GMCharacter|@{selected|token_name}} ), so you'd likely need to use a query with a pre-set list of characters, and would likely need to click the query twice (once for the report in chat, the second time for adding to the character sheet).

An alternative would be a custom made script. I think LazyExperience is in the dropdown, and IIRC it allows you to keep track of experience gathered, without adding it to PCs. You can add it to XP when you are ready, and just keep a running total before then.

Thanks, I am working on getting Lazy Experience working now. Will probably have more questions.  ;p


Finally figured it out using CharSetAtr and a character sheet with attributes for each players exp!  :)   

May 06 (6 years ago)
GiGs
Pro
Sheet Author
API Scripter

great :)