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

Roll macro without selecting token

Hey, im just wondering if there is any command which will trigger roll as character im typing as, instead of selected token. For now my macros are using selected tokens but i need them to trigger from character im typing as, because we are not using tokens so much.
1643521210
timmaugh
Forum Champion
API Scripter
There are selected references... @{selected|token_id} ...and character references... @{Bob the Hirsute|character_id} ...and there are references without either character or token reference; these only work on a character sheet in an ability... @{strength} Those might be the closest you can get without the API. If the API *is* available, Fetch offers a speaker reference... @(speaker.character_id) If you can use a script, I will post more details about using that construction.
1643570424

Edited 1643570435
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
timmaugh said: If the API *is* available, Fetch offers a speaker reference... @(speaker.character_id) Oh, I didn't know that one. That's handy!
timmaugh said: There are selected references... @{selected|token_id} ...and character references... @{Bob the Hirsute|character_id} ...and there are references without either character or token reference; these only work on a character sheet in an ability... @{strength} Those might be the closest you can get without the API. If the API *is* available, Fetch offers a speaker reference... @(speaker.character_id) If you can use a script, I will post more details about using that construction. Hey, thanks for the answer, how can i use "@{strength}" in macro? It looks like this is the one im searching for since i'm trying to upgrade my dice macro which every player in game may use. But like i said - sometimes there are no tokens on field so selected token ones cannot be used :c . When i just enter "@{strength}" in macro there is error TypeError: Cannot read properties of undefined (reading 'substring'). and IMO it should work in that form anyways but i know there are some... laws that are telling that something "will not work IF..." I had character sheet open and I've chosed to post message as sepcific character but error appeared. How can i make that work? Maybe you have any examples?
1643681980
timmaugh
Forum Champion
API Scripter
This is when I try to be really specific about my language. Sometimes we colloquially refer to anything that sends something to the chat which, when processed, results in something new appearing in the chat as a "macro". This can be a character ability, a macro from the macro collection, or even a character attribute. But to answer your question we have to be a whole lot more specific. In this context, a "macro" is only the thing that comes from the Collection tab (right next to the Settings icon at the top of the Chat interface). The @{strength} construction will not work there, because there is no character sheet context for it -- even if you are speaking as that character. Separately, there are character abilities (on the character sheet) which people sometimes refer to as macros, but are different in a couple of important ways. First, if you choose to show a character ability on the token action bar, it will only show up for tokens that represent that character (not all tokens, as would be the case for macros from the Collection tab). Also, and more important to answering your question, character abilities are the only place where you can use character-less @{...} calls. You can see that in action just by putting something simple in an ability versus in a macro. My strength is @{strength}. Run that from an ability on a character sheet (even if you assign it to the macro bar or token action bar), and you will get the appropriate response. Run it from a macro and you'll get the error you described.
1643682210
timmaugh
Forum Champion
API Scripter
One other important way abilities are different from macros is how (at least currently, and historically) HTML entities have been handled in macros. Opening a macro that contains HTML replacement entities will re-process those entities into their presentation equivalents (ie, { becomes a {, and | becomes | ). That kind of processing does not happen in a character ability.
WOW, you just solved my problem with this, thank you very much! I removed all "selected" from my code, entered it into skill section in character sheet and now it works how i wanted to ^^ I just didn't knew how abilities codes in character sheets work, thanks again!