Trying to Create a count command

It is possible to modify a count while showing user-friendly messages, but you won’t be able to use Nightbot’s $(count) variable.

These commands use this quote system to store and modify a count. Because these commands contain private tokens, you should add them through the Nightbot web interface: https://beta.nightbot.tv/commands/custom.

Go to https://twitch.center/customapi/quote/generate. You will see three lines. Your first token is after token= and before &data= on the first line. Your second token is after token= and before &data= on the second and third lines. Replace FIRSTTOKEN and SECONDTOKEN with these before you add the following commands.

!noflyzone
$(eval quotes=decodeURIComponent("$(querystring $(urlfetch json http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1))");/^(?:1+|There are no quotes added)$/.test(quotes)?`Gravity has downed ${quotes=="There are no quotes added"?0:quotes.length} aircraft this stream.`:`Failed to reach quote system: ${quotes}`.substr(0,400))

!aa
$(eval addResponse=decodeURIComponent("$(querystring $(urlfetch json http://twitch.center/customapi/addquote?token=SECONDTOKEN&data=1))");(match=addResponse.match(/^Successfully added entry #(\d+)$/))?`Gravity has now downed ${match[1]} aircraft this stream.`:`Failed to reach quote system: ${addResponse}`.substr(0,400))

!aareset
$(eval (clearResponse=decodeURIComponent("$(querystring $(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1))"))=="All entries have been deleted"?"The downed aircraft counter has been reset.":`Failed to reach quote system: ${clearResponse}`.substr(0,400))