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

Asynchronous sendChat and multiple rolls from the API

1457785127

Edited 1457788250
How would one achieve something like "roll 1d6>5 until you get 10 successes" from the API? Edit: This was way simpler than expected, it can simply be implemented recursive. For example this code rolls until the pool is reduced to 0 then it logs ("no pool anymore"). var pool = 10; var target = 20; var successes = 0; var rollnumber = 0; var process = function(x) { var RollValue = x[0].inlinerolls[0]; var s = parseInt(RollValue["results"]["total"]); log("Roll "+rollnumber+" Pool:"+pool); rollnumber += 1; successes += s; log("Successes:"+successes); if(successes<target){ pool-=1; if(pool>0){ sendChat(character.get('name'), "/roll [["+pool+"d6sacs5cs6>5]]", process); }else{ log("No pool anymore:"+successes); } } }; sendChat(character.get('name'), "/roll [["+pool+"d6>5]]", process);
1457794663
The Aaron
Pro
API Scripter
Great!