Having trouble with $(count)

I’m having trouble with Nightbot and it seems, at least to me, that something has changed with the way the $(count) variable is being controlled.

!commands add !wins XXX has won 0 games today!
!commands add !addwin -ul=moderator -a=!commands edit !wins XXX has won $(count) games today!
!commands add !resetwins -ul=moderator -a=!commands edit !wins \-c=0

The first 2 commands work perfectly fine, as they always have. The command to reset the counter "works’ in that Nightbot will action the command but it doesn’t work in that the counter is not reset to 0.

Adjusting the command to;
!commands add !resetwins -ul=moderator -a=!commands edit !wins \-c=-1
results in the same problem. The counter remains not reset.

Thoughts?

Seems like you’re using !resetwins to set the counter value in !wins to 0. The problem is !wins doesn’t truly have a stored counter value (the $(count) variable). It’s a simple text response that’s being edited by !addwin which DOES have a stored counter value. So you should change !resetwins like so:

!commands add !resetwins -ul=moderator -a=!commands edit !addwin \-c=-1

When you want to set the number in !wins to 0 you first type !resetwins then type !addwin

What this does is: !resetwins will set the counter value in !addwin to -1. !addwin will then increment its counter value (from -1 to 0) before editing !wins

Side note: Including -ul=moderator in a command that uses !commands edit isn’t really necessary because !commands add/edit/delete are mod-only by default.

Awesome. I shall test it out now.

Tested and working. Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.