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

Kinda overwhelmed :/

1479173473

Edited 1479175523
I am attempting to use Command Shell to allow my players to use certain commands from other API scripts, I have installed all the API scripts and am confused how I am supposed to get Command Shell to work in conjunction with those others? As I am reading Command Shell, it is suggestion i also use isGM Auth Module . And those two are just confusing me to bits... Edit 1: I have been toying and messing around with them to no avail :/
Okay, I am noticing in Extended Expressions's API script there is this section registerExExp: function(){ if ((typeof(Shell) != "undefined") && (Shell) && (Shell.registerCommand)){ Shell.registerCommand("!exroll", "!exroll command", "/roll command with extended expression syntax", ExExp.handleExExpMessage); Shell.permissionCommand(["!shell-permission", "add", "!exroll"], {'who': "gm"}); Shell.registerCommand("!extend", "!extend command", "Chat command with extended inline expression syntax", ExExp.handleExExpMessage); Shell.permissionCommand(["!shell-permission", "add", "!extend"], {'who': "gm"}); if (Shell.write){ ExExp.write = Shell.write; } if (Shell.sendChat){ ExExp.sendChat = Shell.sendChat; } } else{ on("chat:message", ExExp.handleChatMessage); } } Does this mean i have to add this to each api script i want added to Command Shell? And also i noticed {'who': "gm"}); does that mean if i get rid of that line it allows everyone to use the command? If anyone would be kind enough to maybe throw me a bone that'd be awesome. Cause i've installed all the other scripts fine and tinkered them to my liking this one just seems a little beyond my sights.
1479177475

Edited 1479177488
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I don't have any experience with command shell, but what functionality are you trying to get for your players that they can't already do in a script?
I am wanting the players ability to use the API scripts Extended Expressions and The Aaron's new ApplyChange. This will allow my players to make whatever macro they want while using Extended Expression's functionality. But ApplyChange is so that i can work it into their attack macro to deal damage and auto subtract from the token's hp bar 1
1479178727
The Aaron
Pro
API Scripter
The wiki is pretty outdated with regards to what scripts are out there.  IsGM is completely unnecessary anymore (it's still out there as a vestigial front to the playerIsGM() function, but I've been working to update any scripts I come across that still reference it.). I'm willing to bet that most of what you want out of Extended Expressions already exists elsewhere.  When Extended Expressions was written, we didn't have nested inline rolls yet, for example. Probably, if you give us the problem you're trying to solve, we can come up with ways to solve it in more recent scripts. =D
1479179460

Edited 1479179950
What I am hoping to do is similar to If Attack is greater than @target AC then TokenBar1 minus Damage else Miss I am currently under the impression that Extended Expressions would allow me the basic ability to do an if then else statement like that because it is similar to the output of one of the sample macros they give !extend Attack: `(1d20+7)[tohit]`, `(${tohit}>=15 ? "hit for [[1d6]]" : "miss")` The "end goal" is to integrate this if then else functionality into the pre-existing attack macro with the character sheet. So that you can just use the sheet macro select the target, see if you hit or miss if you hit it auto deducts the damage from the token's HP bar else it just designates in chat you missed.
1479181489
The Aaron
Pro
API Scripter
That would get you the output text, but I don't think there's a way to get it to call another script.  Output is something I should add to ApplyChange. 
Is it possible to use Extended Expressions with a roll template?
1479182014
The Aaron
Pro
API Scripter
I doubt it. It looks like it hasn't been updated in 18 months and I don't think we've had them that long. 
Nevermind i actually got the sample macro used above to work with a &{template:pf_attack} template
1479182124
The Aaron
Pro
API Scripter
Cool!  :)
1479182829

Edited 1479183165
Oh geez, i think i broke something... just got this error TypeError: BINARY_FUNCTIONS[t.operator] is not a function TypeError: BINARY_FUNCTIONS[t.operator] is not a function at lazyEval (apiscript.js:3339:45) at Object.ExExp.sendCommand (apiscript.js:3494:16) at Object.ExExp.sendCommand (apiscript.js:3556:19) at Object.ExExp.handleExExpMessage [as callback] (apiscript.js:3653:8) at Object.Shell.handleApiMessage (apiscript.js:787:28) at Shell.handleChatMessage (apiscript.js:793:8) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:144:34), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:144:34), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1394:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 uhhh... any ideas? Also !extend Attack: `(1d20+7)[tohit]`, `(${tohit}>=15 ? "hit for [[1d6]]" : "miss")` That works great except I would like to hover over the 1d20+7 and see what the results of the roll was rather than seeing just say 22 as "the roll" any thoughts on this? Would this have to be a mess with the API script scenario?
Not really sure what the point of Command Shell is... but anyone can use any api command if the script is installed.
Welp, if thats the case I don't need it then :D
1479194734
Silvyre
Forum Champion
B14d3r11 said: I would like to hover over the 1d20+7 and see what the results of the roll was rather than seeing just say 22 as "the roll" any thoughts on this? ExtendedExpressions resolves its rolls using JavaScript instead of the Roll20 dice engine, so this isn't inherently possible. My recommendation is to use PowerCards for this, instead: !power {{ --name|Attack --Roll|[[ [$Atk] 1d20 + 7 ]] --?? $Atk >= 15 ?? Hit| for [[ 1d6 ]] --?? $Atk < 15 ?? Miss| }}
PowerCards doesn't automate application of damage to target tokens however. Just keep that in mind.
1479196103

Edited 1479199165
For the most part I have Extended Expressions working 100% the only problem I am facing is an API Script problem (I think), the script doesn't show the process of the inline roll when it has a label applied to it. For example !extend &{template:pf_attack} {{character_name=@{selected|token_name}}} {{Dice Roll= `(${tohit}-7)`}} {{Hitting AC= `(1d20+7)[tohit]`}} {{Result=`(${tohit}>=15 ? "hits for [[1d6]]" : "miss")` }} is my workaround to show me what the actual dice roll was. But to break down where it goes bad is right here. `(1d20+7)[tohit]` This function here allows the 1d20+7 to be rolled and stored, it then allows me to recall it at any time throughout the macro (SUPER AMAZING) but when you hover over the inline result of it, it just shows "17 = 17" instead of "1d20(10)+7 = 10+7" I think this has something to do with the fact that because it is now converting the total result of 17 into a re-callable variable it no longer allows it to be 1d20+7 cause that would just roll the 1d20+7 again. For the most part my work around works. It allows you to see the result of the die roll before additional bonuses, (which is kinda what i want) and I am sure i can "sneak" it in there during the inline process. Silvyre said: B14d3r11 said: I would like to hover over the 1d20+7 and see what the results of the roll was rather than seeing just say 22 as "the roll" any thoughts on this? ExtendedExpressions resolves its rolls using JavaScript instead of the Roll20 dice engine, so this isn't inherently possible. My recommendation is to use PowerCards for this, instead: !power {{ --name|Attack --Roll|[[ [$Atk] 1d20 + 7 ]] --?? $Atk >= 15 ?? Hit| for [[ 1d6 ]] --?? $Atk < 15 ?? Miss| }} PowerCards could work for like most of what I was trying to accomplish with this. It would produce a "better" visual result but it wouldn't have the added functionality that comes with Extended Expressions, at least from what I can see. If it can produce the same level of functionality then I'd give it a try (although I didn't want a "new" template basically). The major features i liked about Extended Expressions was the capability to use Variables, If then else, and, or. For creating macros, from the surface i can see that PowerCards does Variables and If then else statements.
Post an example of what you're trying to accomplish and I can see what can be done.
1479198399

Edited 1479199086
Current example is "somewhat" working (I personally think i have the order wrong) but !extend &{template:pf_attack} {{character_name=@{selected|token_name}}} {{D20 Roll= `(${tohit}-7)[dieroll]`}} {{Hitting AC= `(1d20+7)[tohit]`}} {{Result=`(${dieroll}>=18 & ${tohit}>=15 ? "hits for [[1d6]] & crits for [[1d6]]" : ${tohit}>=15 ? "hits for [[1d6]]" : "miss")` }} What this does is, when it rolls 1d20+7 it takes the result and minuses 7 to it and displays that as the "D20 Roll" which i then defined as the variable "dieroll" from there it checks to see if "dieroll" is greater than or equal to 18 (crit) and it will also check if it is a hit. If both are true (it will if the crit is) it will do the normal damage plus the critical damage else it will do normal damage. Now mind you this script isn't 100% complete i still have to add a @{target|AC} in there where it is calling ${tohit}>=15. And I also have to add in the functionality with taking the damage away from the token's bar 1 if it does hit.
1479199728

Edited 1479199740
Silvyre
Forum Champion
Roll Templates can be coded to include Helper Functions (e.g. rollWasCrit() ), which allow for information to be conditonally displayed in certain circumstances. The &{template:pf_attack} Roll Template already implements rollWasCrit(). You can take advantage of it by writing Roll Templates using its reserved {{properties}}. e.g. @{PC-whisper} &{template:pf_attack} @{toggle_attack_accessible} @{toggle_rounded_flag}{{color=@{rolltemplate_color}}} {{character_name=@{character_name}}} {{character_id=@{character_id}}} {{subtitle}} {{name=@{name}}} {{ attack =[[ 1d20cs>[[ @{crit-target} ]] + @{attack_macro} ]]}} {{damage=[[@{damage-dice-num}d@{damage-die} + @{damage_macro}]]}} {{ crit_confirm =[[ 1d20 + @{attack_macro} + [[ @{crit_conf_mod} ]] ]]}} {{ crit_damage =[[ [[ @{damage-dice-num} * (@{crit-multiplier} - 1) ]]d@{damage-die} + ((@{damage_macro}) * [[@{crit-multiplier} - 1]]) ]]}} {{precision_dmg1=@{precision_dmg_macro}}} {{precision_dmg1_type=@{precision_dmg_type}}} {{precision_dmg2=@{global_precision_dmg_macro}}} {{precision_dmg2_type=@{global_precision_dmg_type}}} {{ critical_dmg1 =@{critical_dmg_macro}}} {{ critical_dmg1_type =@{critical_dmg_type}}} {{ critical_dmg2 =@{global_critical_dmg_macro}}} {{ critical_dmg2_type =@{global_critical_dmg_type}}} {{type=@{type}}} {{weapon_notes=@{notes}}} @{iterative_attacks} @{macro_options} {{vs=@{vs}}} {{vs@{vs}=@{vs}}} The above is the "newPCAttackMacro" from the sheet's HTML ; I bolded the properties that are involved with various applications of rollWasCrit().
1479200281

Edited 1479200643
Silvyre said: Roll Templates can be coded to include Helper Functions (e.g. rollWasCrit() ), which allow for information to be conditonally displayed in certain circumstances. The &{template:pf_attack} Roll Template already implements rollWasCrit(). You can take advantage of it by writing Roll Templates using its reserved {{properties}}. e.g. @{PC-whisper} &{template:pf_attack} @{toggle_attack_accessible} @{toggle_rounded_flag}{{color=@{rolltemplate_color}}} {{character_name=@{character_name}}} {{character_id=@{character_id}}} {{subtitle}} {{name=@{name}}} {{ attack =[[ 1d20cs>[[ @{crit-target} ]] + @{attack_macro} ]]}} {{damage=[[@{damage-dice-num}d@{damage-die} + @{damage_macro}]]}} {{ crit_confirm =[[ 1d20 + @{attack_macro} + [[ @{crit_conf_mod} ]] ]]}} {{ crit_damage =[[ [[ @{damage-dice-num} * (@{crit-multiplier} - 1) ]]d@{damage-die} + ((@{damage_macro}) * [[@{crit-multiplier} - 1]]) ]]}} {{precision_dmg1=@{precision_dmg_macro}}} {{precision_dmg1_type=@{precision_dmg_type}}} {{precision_dmg2=@{global_precision_dmg_macro}}} {{precision_dmg2_type=@{global_precision_dmg_type}}} {{ critical_dmg1 =@{critical_dmg_macro}}} {{ critical_dmg1_type =@{critical_dmg_type}}} {{ critical_dmg2 =@{global_critical_dmg_macro}}} {{ critical_dmg2_type =@{global_critical_dmg_type}}} {{type=@{type}}} {{weapon_notes=@{notes}}} @{iterative_attacks} @{macro_options} {{vs=@{vs}}} {{vs@{vs}=@{vs}}} The above is the "newPCAttackMacro" from the sheet's HTML; I bolded the properties that are involved with various applications of rollWasCrit(). I am going to incorporate a good portion of the newPCAttackMacro into my macro with added support from the api script. I am just debunking how to get everything working 100% before tackling that huge pile :P But I've been tinkering with the macro i previously posted and got one 100% working when it comes to crits. Yeah I will probably be making it nicer and cleaner, but for the moment I used the current macro to debug and make sure everything was working correctly. !extend &{template:pf_attack} {{character_name=@{selected|token_name}}} {{Dice Roll= `(${tohit}-7)[dieroll]`}} {{Hitting AC= `(1d20+7)[tohit]`}} {{Result=`(${tohit}>=18 ? "hits" : "misses")` }} {{Variable dieroll=`(${dieroll})`}} {{Damage=`(${tohit}>=19 ? "hits for [[1d6]] and crits for [[1d6]]" : "hits for [[1d6]]")` }} The main thing I am attempting to do which the original macro cannot, is automate the attack so that it targets the token's ac, determines if it hits then auto deducts the damage dealt to the token via its health bar. It will also make it a more minimalistic macro in comparison to the one you used for the sheet. Also, what this will allow me do is define what a crit is better than before because a lot of my friends/players like to use the x2 multiplier for the weapon and double the damage dealt originally. Instead of rolling two sets of say d6 for the weapon and adding modifiers again.
With the base API script, i managed somehow... to make it so i can use a If Then Elseif Else statement... crazy
1479245550
Silvyre
Forum Champion
B14d3r11 said: The main thing I am attempting to do which the original macro cannot, is automate the attack so that it targets the token's ac, determines if it hits then auto deducts the damage dealt to the token via its health bar. I think your best bet is to add an  API Command Button containing a !token-mod command that subtracts ${damage} from bar1.
1479252351

Edited 1479253271
I have it set up so it targets the ac, determines hit miss or crit and rolls to confirm if it is a crit. The problem I am having now is that although it outputs damage, it isn't letting me subtract the damage from bar1 while trying to utilize TokenMod or ApplyChange by the Aaron For example !apply-change --bar|1 --damage|6 --ignore-selected --ids @{target|foe1|token_id} would subtract 6 damage from the target token but my variable is called via `(${finaldmg})` but !apply-change--bar|1 --damage|`(${finaldmg})` --ignore-selected --ids @{target|foe1|token_id} isn't working
1479256078
Silvyre
Forum Champion
B14d3r11 said: !apply-change--bar|1 --damage|`(${finaldmg})` --ignore-selected --ids @{target|foe1|token_id} This won't work because `(${finaldmg})` is not recognized by the ApplyChange script as meaningful syntax. Here's an example of what I meant: !extend Click on the pink API Command Button to apply `(1d8)[dmg]` `"[damage.](!token-mod --set bar1_value|-" + ${dmg} + ")"`
I now understand what you mean, but the damage is already pre-determined in my macro. The problem is... pulling the damage from the pre-determined variable to get it into TokenMod or ApplyChange. What you suggest is a workaround, I am trying to make a macro that does everything you need. Rolls vs Target's AC and then deducts the damage from the Target's Bar 1. If there is a button involved it isn't very streamlined :/