So I’m trying to make a sort of chat game where users can grab other users with a percent chance to fail. i also want nightbot to record the successes and failures using the quote_system api so that i can bring up a score board later. However, when ever the !grab command runs it seems to be running the api in both branches and adding to both success and failure regardless of result. Is there a way to have it only run the api in one branch?
The problem with you command is that the urlfetch are always called due the the way nightbot works.
I would suggest using the alias ability and passing information to a second command which then does the uslfetch. If you want an example of something similar you can look here [CustomAPI] BlackJack command (I suggest passing the token too so someone can’t just call the second command and put whatever they want in the qoute list.)
I’ll fiddle around with it some.
Would it be possible to construct the url as a string and then pass it to urlfetch?
if (a==1) b=url+grabS; else b=url+grabF; c=$(urlfetch b)
No because of the way nightbot treat variables. Basically the ones on the inside are done first so the urlfetch will always be done before the eval even starts.