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

Power Cards and !GURPS Roll Parser

1534770129
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
I need a tad bit of help. What I am trying to do is incorporate this roll parser into power cards for my GURPS game. I thought I had it working then it only works one time at a time then I must refresh the Roll20 game. Any help would be greatly appreciated. on("chat:message", function(msg) {     if(msg.type === "api" && msg.content.indexOf("!gurps ") !== -1) {         var level = Number(msg.content.split(" ")[1]);         var roll = randomInteger(6) + randomInteger(6) + randomInteger(6);         var margin = level - roll;         var result;         if(roll <= level) {             result = "Success";                     } else {             result = "Failure";                     }         if(roll === 3 || roll === 4) {             result = "Critical Success";         }         if(roll === 5 && level >= 15) {             result = "Critical Success";         }         if(roll === 6 && level >= 16) {             result = "Critical Success";         }         if(roll === 18) {             result = "Critical Failure";         }         if(roll === 17 && level <= 15) {             result = "Critical Failure";         }         if(margin <= -10) {             result = "Critical Failure";         }         sendChat(msg.who, "!power {{--name|Roll vs. Effective Skill Level" + level.toString() +                 " --leftsub|Roll=" + roll.toString() + " --rightsub|Margin=" + margin + " --Result:|" + result + "}}");     } }); 
1534770870

Edited 1534771014
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
I tried a different macro to make this work and now have functioning more than once at a time. The next question. Is there a way to work conditionals for Power Cards into this for rollable tables and such or should I build them into the roll parser API? !power {{  --api_gurps| ?{SL?|11} }}
1534797422
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Still need some expertise.... Power Cards is not formatting the output of the !GURPS api. What can I do to make that happen? Here is my testing macro  !power {{  --format|bigbad  --name|Test Name  --api_gurps| ?{Effective Skill Level:|11} }} Here is the result and below is the API script...I've messed with the output and had mostly the success in the above pic. on("chat:message", function(msg) {     if(msg.type === "api" && msg.content.indexOf("!gurps ") !== -1) {         var level = Number(msg.content.split(" ")[1]);         var roll = randomInteger(6) + randomInteger(6) + randomInteger(6);         var margin = level - roll;         var result;         if(roll <= level) {             result = "Success";                     } else {             result = "Failure";                     }         if(roll === 3 || roll === 4) {             result = "Critical Success";         }         if(roll === 5 && level >= 15) {             result = "Critical Success";         }         if(roll === 6 && level >= 16) {             result = "Critical Success";         }         if(roll === 18) {             result = "Critical Failure";         }         if(roll === 17 && level <= 15) {             result = "Critical Failure";         }         if(margin <= -10) {             result = "Critical Failure";         }         sendChat(msg.who, "!power {{ --Roll vs. Effective Skill Level:| " + level.toString() +                 " --leftsub|Roll: " + roll.toString() + " --rightsub|Margin: " + margin + " --Result:| " + result + "}}");     } });