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 creating a Roll As Selected macro if it's even possible.

I'm looking to create a macro that will change the creature I am rolling as  automatically, like shown below Which I'm not even sure is possible. If it is, how would I accomplish that? /emas is a close substitute, but not exactly what I'm looking for.
1515240785

Edited 1515240904
you might be able to use some form of @selected|token?{Message} with a non mook to speak as that token sheet but i am no macro ninja so that is the best i can do.  just need some form of API to perform the task. 
1515242228
[Deleted]
Sheet Author
API Scripter
The Character Sheet I work on does this. It is a combination of HTML and Javascript (on an API Script). The files for the Sheet/API are @&nbsp; <a href="https://github.com/KnowlegeRhino/GenesysRPG" rel="nofollow">https://github.com/KnowlegeRhino/GenesysRPG</a> . Include the lines of code below, but they have a bunch of logic for the game and i am not useful enough at javascript to just strip out what you need. On the HTML (Line 7535); &lt;option value="!eed npcinit rollPlayer(character:@{NPCName1}|skill:presence,rankCool) label(skill:NPC-Initiative Cool|NPC Type:@{groupmission-NPCtype1}) @{NPCInitModifiers1} @{dicePool} (gmdice)"&gt;Cool&lt;/option&gt; On the API Script (Lines 1948-2015);&nbsp; eote.process.rollPlayer = function (cmd, diceObj) { &nbsp; &nbsp; //Build cmd string &nbsp; &nbsp; //get characterID &nbsp; &nbsp; //get skills &nbsp; &nbsp; //get encum &nbsp; &nbsp; //remove rollPlayer(xxxx) from string &nbsp; &nbsp; var match = { &nbsp; &nbsp; &nbsp; &nbsp; skill: /skill:(.*?)[\|\)]/, &nbsp; &nbsp; &nbsp; &nbsp; encum: /encum/, &nbsp; &nbsp; &nbsp; &nbsp; character: /character:(.*?)[\|\)]/ &nbsp; &nbsp; }; &nbsp; &nbsp; var characterMatch = cmd[1].match(match.character); &nbsp; &nbsp; var companion = null; &nbsp; &nbsp; var character = null; &nbsp; &nbsp; if (characterMatch) { &nbsp; &nbsp; &nbsp; &nbsp; var charObj = findObjs({ _type: "character", name: characterMatch[1] }); &nbsp; &nbsp; &nbsp; &nbsp; if (charObj.length &gt; 0) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; diceObj.vars.characterName = charObj[0].get('name'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; diceObj.vars.characterID = charObj[0].id; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat("Alert", "Can't find character. Please update character, or npc, name field to match sheet character name and try again."); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } &nbsp; &nbsp; else { &nbsp; &nbsp; &nbsp; &nbsp; sendChat("Alert", "Please update character, or npc, name field."); &nbsp; &nbsp; &nbsp; &nbsp; return false; &nbsp; &nbsp; } &nbsp; &nbsp; var encumMatch = cmd[1].match(match.encum); &nbsp; &nbsp; var attr_1 = null; &nbsp; &nbsp; var attr_2 = null; &nbsp; &nbsp; if (encumMatch) { &nbsp; &nbsp; &nbsp; &nbsp; //encumbrance &nbsp; &nbsp; &nbsp; &nbsp; attr_1 = getAttrByName(diceObj.vars.characterID, 'encumbrance', 'max'); &nbsp; &nbsp; &nbsp; &nbsp; attr_2 = getAttrByName(diceObj.vars.characterID, 'encumbrance'); &nbsp; &nbsp; &nbsp; &nbsp; var cmdEncum = ['encum(' + attr_1 + '|' + attr_2 + ')']; //["encum(3|5)"] &nbsp; &nbsp; &nbsp; &nbsp; diceObj = eote.process.encum(cmdEncum, diceObj); &nbsp; &nbsp; } &nbsp; &nbsp; var skillMatch = cmd[1].match(match.skill); &nbsp; &nbsp; if (eote.defaults.globalVars.debugScript) sendChat("Alert", "skillmatch=" + skillMatch.toString()); &nbsp; &nbsp; if (skillMatch) { &nbsp; &nbsp; &nbsp; &nbsp; var attrArray = skillMatch[1].split(','); &nbsp; &nbsp; &nbsp; &nbsp; attr_1 = getAttrByName(diceObj.vars.characterID, attrArray[0]); &nbsp; &nbsp; &nbsp; &nbsp; attr_2 = getAttrByName(diceObj.vars.characterID, attrArray[1]); &nbsp; &nbsp; &nbsp; &nbsp; if (eote.defaults.globalVars.debugScript) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat("Alert", "attr_1 = " + attr_1); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat("Alert", "attr_2 = " + attr_2); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; var cmdSkill; &nbsp; &nbsp; &nbsp; &nbsp; if (!isNaN((parseFloat(attr_1)) && isFinite(attr_1))) { // is numeric &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmdSkill = ['skill(' + attr_1 + '|' + attr_2 + ')']; //['skill(0|2)'] &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var attr_3 = getAttrByName(diceObj.vars.characterID, attr_1.substr(2, attr_1.length - 3)); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmdSkill = ['skill(' + attr_3 + '|' + attr_2 + ')']; //['skill(0|2)'] &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; diceObj = eote.process.skill(cmdSkill, diceObj); &nbsp; &nbsp; } &nbsp; &nbsp; return diceObj; };
1515248996

Edited 1515249509
Spren
Sheet Author
I don't know of a way to change the as but you can make a macro using a template and give it the name of the selected token as long as it has a character sheet. Note: This may not be what you're looking for either, but it's an option. For instance if I have a zombie and the name is an attribute on the character sheet called character_name then I could access that name by using @{selected|character_name}. Then if you used a basic roll template and a generic macro you could get something like: And the name in the header would change depending on the character you have selected. Here is the roll I used to make that template: &{template:default} {{name=@{selected|character_name}}} {{roll=[[1d20]]}} {{note= This is some note content}}