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 .
×

some problem with the API

1426184597

Edited 1426185303
Hi everyone, I have some problem with my script, whatever i try i always have 0 as a result. I wanted to use the fact that all my player will using ptahfinder character sheet for providing a generalist comp check based on the pathfinder character sheet Here is the script : on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!compCheck") !== -1) { var msgContent = msg.content; var options = msgContent.replace("!compCheck ", "").split(" "); log(options); if(options.length != 2){ sendChat(msg.who, "not enough parameter! ex : !compCheck competence persoName"); }else{ var charName = options[1]; var comp = options[0]; if(comp != 'diplomatie'){ sendChat(msg.who, "compCheck pour" + comp + " pas encore implmenté"); }else{ log(" /r 1d20 + @{"+charName+"|Diplomacy}"); sendChat(msg.who, "/r 1d20 + @{"+charName+"|Diplomacy}"); } } }; }); how i use the command in the chat : !compCheck diplomatie Jakhael and the result : rolling 1d20 + (1 + ((((3 * 1) + 3) - abs((3 * 1) - 3)) / 2) + + 0 + 0 + 0 + 2) (15)+(1+((((3*1)+3)-abs((3*1)-3))/2)++0+0+0+2) = 0 the log i have when i launch th command : ["diplomatie","Jakhael"] " /r 1d20 + @{Jakhael|Diplomacy}" and when i try to use /r 1d20 + @{Jakhael|Diplomacy} directly in th chat it work
What happens when you just put "@{Jakhael|Diplomacy}" into the chat. Does it have the missing term at the start of the constants ("+ + 0 + 0 + 0 + 2")? If I had to guess, I'd say there's probably a term there that isn't compatible with the sendChat function.
i have : (1 + ((((3 1) + 3) - abs((3 1) - 3)) / 2) + ((floor((15 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2))) + 0 + 0 + 0 + 2) when i put @{Jakhael|Diplomacy} into the chat
So that whole "((floor((15 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2)))" term is falling out in your script. How is that generated in the Diplomacy attribute? Is it computed from other attributes? Does it reference @{selected} or @{target}? I'd try sending pieces of the attribute through sendChat, building up towards the full content of the Diplomacy attribute, until you find something that breaks it.
I will try that to search the culpirt. thanks for your response