Okay Long winded post here, going to give my example of what it is that I am doing.... I don't mind hard coding in some of this if it makes it possible just don't want to get hung up on some OTHER thing that might stop this from working. Side note I am using the Contributed Community Character sheet for 5e. So I have 3 specific Token Macros: MonkAbilities, ConfirmMonkAbilities, UpdateKi I also have many macros that make attacking with weapons easier so you don't have to go into the character sheet and press roll everytime: "MA:UnarmedStrikes" (essentially all the template attack Hoopla plus maybe extra stuff to give the player more information) refer to these as minor token macro's (as their entire content could theoretically be copy and pasted? Maybe? Below is my Big API function that handles dishing out stuff via sendChat commands: // Syntax for this API is ToddUseFirstResourcee <Selected|token_id> <Selected|character_id> <Amount of resource spent> <String for ability used>
on("ready",function(){
on("chat:message",function(msg){
if(msg.type=="api" && msg.content.indexOf("!ToddUseFirstResource")==0 ){
var selected = msg.selected;
if (selected===undefined){
sendChat("API","Please select a character.");
return;
}
var args = msg.content.split(" ");
var command = args.shift().substring(1);
if (command == 'ToddUseFirstResource'){
if (args.length < 4) {
sendChat('SYSTEM', 'You must provide a selected token id, character id, the Number of Resources Used and abilities used');
return;
}
}
// 1st Parameter should be the Token's Id
var Selected_Tok_Id = args[0];
var Selected_Char_Id = args[1];
var Selected_ResourceNumberSpent = args[2];
var Selected_Name_of_Monk_Ki_Ability = args[3];
Selected_ResourceNumberSpent = parseInt(Selected_ResourceNumberSpent,10);
var Selected_Token = getObj('graphic', Selected_Tok_Id);
var Selected_Character = getObj('character',Selected_Char_Id);
if (!Selected_Tok_Id) {
sendChat('SYSTEM', 'Selected token id not provided.');
return;
}
if (!Selected_Char_Id) {
sendChat('SYSTEM', 'Selected character id not provided.');
return;
}
if (Selected_ResourceNumberSpent < 0) {
if(typeof Selected_ResourceNumberSpent != 'number'){
sendChat('SYSTEM','Please provide a number for amount of resource spent!');
return;
}
sendChat('SYSTEM', 'Resource Number Spent not provided.');
return;
}
if(!Selected_Name_of_Monk_Ki_Ability){
sendChat('SYSTEM', "You did not specify a Monk Ki Ability that I was using!")
}
//Preparing to get speakingas for sendChat
var SpeakingAs = getObj('character', Selected_Token.get('represents'));
var CharacterName = Selected_Character.get('name');
if(!SpeakingAs){
SpeakingAs = Selected_Token.get('name');
}
else {
SpeakingAs = 'character|' + SpeakingAs.id;
}
var CurrentSum = getAttrByName(Selected_Char_Id, "repeating_classresources_$0_ClassResourceTotal", "current");
var MaxSum = getAttrByName(Selected_Char_Id, "repeating_classresources_$0_ClassResourceTotal", "max");
var AttributeName = getAttrByName(Selected_Char_Id,"repeating_classresources_$0_ClassResourceName");
// Make sure attr are integers
CurrentSum = parseInt(CurrentSum,10);
MaxSum = parseInt(MaxSum,10);
// Use Resource
CurrentSum = CurrentSum - Selected_ResourceNumberSpent;
//confirm Resource Is available to use.
if (CurrentSum < 0){
CurrentSum = CurrentSum + Selected_ResourceNumberSpent;
sendChat(SpeakingAs,"It appears that I have tried to use "+AttributeName+" Resources that was not available to me!");
return;
}
else {
switch(parseInt(args[2],10)){
case 0:
switch(args[3]){
case "MartialArts":
sendChat(SpeakingAs,"After attacking with my Action, I quickly make an Unarmed Strike!");
sendChat(SpeakingAs,"%{"+CharacterName+"|MA:UnarmedStrikes}");
break;
case "MinorIllusion":
sendChat(SpeakingAs,"%{"+CharacterName+"|repeating_spellbookCANTRIP_$0_spellcast}");
break;
case "DeflectMissilesCatch":
sendChat(SpeakingAs,"Subtract [[1d10+[[@{"+CharacterName+"|monk_level}]]+[[@{"+CharacterName+"|dexterity_mod}]]]] from a ranged attack that hit me!" )
default:
sendChat(SpeakingAs,"I did not specify a proper 0 Ki cost ability");
return;;
}
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-0 ]] ");
break;
case 1:
switch(args[3]){
case "FlurryOfBlows":
sendChat(SpeakingAs,"After attacking with my Action, I channel my Ki and make two Unarmed Strikes!");
sendChat(SpeakingAs,"%{"+CharacterName+"|MA:UnarmedStrikes}");
sendChat(SpeakingAs,"%{"+CharacterName+"|MA:UnarmedStrikes}");
break;
case "PatientDefense":
sendChat(SpeakingAs, "Attackers have Disadvantage on attack rolls against me until the beginning of my next turn!");
break;
case "StepOfTheWindDisengage":
sendChat(SpeakingAs, "I do not provoke Attack of Opportunity from those I am currently within my enemies threat range!");
break;
case "StepOfTheWindDash":
sendChat(SpeakingAs,"My Movement Speed is increased by [[@{"+CharacterName+"|speed}]] until the beginning of my next turn!");
break;
case "DistantEye":
sendChat(SpeakingAs,"My Range Attacks Do not suffer from Disadvantage for LongRange");
sendChat(SpeakingAs,"%{"+CharacterName+"|RA:Javelin}");
break;
case "DeflectMissilesAttack":
sendChat(SpeakingAs,"%{"+CharacterName+"|RA:DeflectMissiles}");
break;
case "StunningStrike":
sendChat(SpeakingAs,"%{"+CharacterName+"|StunningStrike}");
break;
default:
sendChat(SpeakingAs,"I did not specify a proper 1 Ki cost ability!");
return;
}
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-1 ]] ");
break;
case 2:
switch(args[3]){
case "Darkness":
sendChat(SpeakingAs,"%{"+CharacterName+"|repeating_spellbookLEVEL2_$0_spellcast}");
break;
case "Darkvision":
sendChat(SpeakingAs,"%{"+CharacterName+"|repeating_spellbookLEVEL2_$1_spellcast}");
break;
case "Silence":
sendChat(SpeakingAs,"%{"+CharacterName+"|repeating_spellbookLEVEL2_$2_spellcast}");
break;
case "PassWithoutATrace":
sendChat(SpeakingAs,"%{"+CharacterName+"|repeating_spellbookLEVEL2_$3_spellcast}");
break;
case "QuickenedHealing":
sendChat(SpeakingAs,CharacterName+" heals self for [[1d6]] hit points using Quicken Healing!");
break;
default:
sendChat(SpeakingAs,"I did not specify a proper 2 Ki cost ability");
return;
}
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-2 ]] ");
break;
case 3:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-3 ]] ");
break;
case 4:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-4 ]] ");
break;
case 5:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-5 ]] ");
break;
case 6:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-6 ]] ");
break;
case 7:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-7 ]] ");
break;
case 8:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-8 ]] ");
break;
case 9:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-9 ]] ");
break;
case 10:
sendChat(SpeakingAs,"!setattr --silent --charid "+args[1]+" --repeating_classresources_$0_ClassResourceTotal|[[@{"+CharacterName+"|repeating_classresources_$0_ClassResourceTotal}-10 ]] ");
break;
default:
sendChat(SpeakingAs,"Number of Resources Spent is either less than 0 or more than 10, please provide a number between [0 and 10]");
break;
} // end of Switch Case
} // end of If/Else about CurrentSum
// If command == UseFirstResource
} // If statement from the !UseFirstResource and Api is msg.type
});
}); Below is my 3 Helper token macros for the player characters: MonkAbilities: (Sung Fe is the character name that these macro comes from, I require players to have their character selected to get them used to doing that, as many things require that anyway), I pass this information along to and sendChat's that require it !ToddUseFirstResource @{selected|token_id} @{selected|character_id} %{Sung Fe|UpdateKi} %{Sung Fe|ConfirmMonkAbilities} ConfirmMonkAbilities: Used to create parameter for the "!ToddUseFirstResource" API's 4th argument (args[3]) ?{Confirm which Monk Abiilty you are Using|Martial Arts - Bonus Action and 0 Ki,MartialsArts|Flurry of Blows - Bonus Action and 1 Ki,FlurryOfBlows|Patient Defense - 1 Bonus Action and 1 Ki,PatientDefense| Step of the Wind-Disengage - Bonus Action and 1 Ki,StepOfTheWindDisengage| Step of the Wind-Dash - Bonus Action and 1 Ki,StepOfTheWindDash|Distant Eye - Free action as part of a ranged attack and 1 Ki,DistantEye|Quickened Healing - Action and 2 Ki points,QuickenedHealing|Deflect Missile- Catch - Reaction and no Ki,DeflectMissilesCatch| Deflect Missile- Attack- Same Reaction and 1 Ki,DeflectMissilesAttack|Stunning Strike - Free action as part of a melee weapon attack and 1 Ki,StunningStrike|Darkness- Action and 2 Ki,Darkness|Darkvision- Action and 2 Ki,Darkvision|Pass without a Trace - Action and 2 Ki,PassWithoutATrace|Silence - Action and 2 Ki,Silence| Minor Illusion - Action and 0 Ki,MinorIllusion} UpdateKi: ( I know it's not relevant to update Ki 0 stuff, but wanted to keep consistent with players mindset that these abilities do exist and are available to them. Monk got lots of stuff going on and I find my player being overwhelmed with choices, this give them list and context for what they are able to achieve in a given round of combat. Used to create parameter for "!ToddUseFirstResource" API's 3rd argument (args[2]) ?{View All Monk Options you have available|Martial Arts - Bonus Action and 0 Ki,0|Flurry of Blows - Bonus Action and 1 Ki,1|Patient Defense - 1 Bonus Action and 1 Ki,1| Step of the Wind-Disengage - Bonus Action and 1 Ki,1| Step of the Wind-Dash - Bonus Action and 1 Ki,1|Distant Eye - Free action as part of a ranged attack and 1 Ki,1|Quickened Healing - Action and 2 Ki points,2|Deflect Missile- Catch - Reaction and no Ki,0| Deflect Missile- Attack- Same Reaction and 1 Ki,1|Stunning Strike - Free action as part of a melee weapon attack and 1 Ki,1|Darkness- Action and 2 Ki,2|Darkvision- Action and 2 Ki,2|Pass without a Trace - Action and 2 Ki,2|Silence - Action and 2 Ki,2| Minor Illusion - Action and 0 Ki,0} Kind of wouldn't even know where to begin allowing the player (a prompt) to be passed in at first. Most of this is behind the scenes, the player character only see the UpdateKi and ConfirmMonkAbilities content (other than hopefully the attack rolls or spells casts with this. If you have any suggestion I am all ears. Again this is why I wanted to know what limitation to sendChat(SpeakingAs,Message); I read the information on the function but as someone who isn't fluent in javascript or HTML (I understand logic and basic coding guidelines however, my computer literacy is mostly for reading, and not as much for writing specific codes, EC engineer). I can get so hung up on a comp language syntax :( I get the sneaky suspicion that its not actually sending it to the game (at least not without some type of Parsing first) So If I need to have a whole bunch of &#44 &#124 or whatever all those htmls codes are to get it to work I might be willing to do so because it being uglier for me to make it cleaning for them is worth it to me. I was told that an API can call another API, so maybe just copying everything from macro's into API's would work, but still comes down to how I can get the character to press a button, bring up a drop down, brings up another almost identical drop down. and then some type of actions/rolls happen related to that choice is what I'm ultimately trying to achieve. Thank you for your time :)