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

[Help] Getting all of a player's macros

A few questions pertaining to macros in the API Is there any way to get a list of all of a player's macros? Through _macrobar you can only get the macros that currently in that player's macro bar. Furthermore a macro does not seem to have a toggle-able attribute to set if it is in the macro bar or not. Meaning that if the answer to the first question is no, then do you have no way of retrieving a macro that's created through code?
1422981125
The Aaron
Pro
API Scripter
Given a variable named ThePlayer containing a player's ID, this will get an array of all their macros: var ThePlayersMacros = findObjs({ type: "macro", playerid: ThePlayer }); More info: <a href="https://wiki.roll20.net/API:Objects#Finding.2FFilt" rel="nofollow">https://wiki.roll20.net/API:Objects#Finding.2FFilt</a>...
Ah, cool thanks!
Very cool, I worry when players make macros, just from an accuracy/level playing field point of view. If I thought they were cheating I would bounce them in a heartbeat. It took me a long time to learn all of the nuances of macros and I spend a lot of time tweaking them for output and appearance.
1422992089
The Aaron
Pro
API Scripter
That gives me an idea for a script... =D
And am I right in the assumption that you can't add or remove a macro from the macro-bar (through the api)?
1422997450
The Aaron
Pro
API Scripter
Correct. <a href="https://wiki.roll20.net/API:Objects#Player" rel="nofollow">https://wiki.roll20.net/API:Objects#Player</a> _macrobar is where they are stored. All the properties with a leading _ are read only. BTW, you should omit the _ when requesting the field. player.get('macrobar'); The only place you must have the _ is when watching changes to them: on('change:player: _ macrobar', ...)
Thanks again. Did not know I could request them without the underscore, cool.