NightDev Community Forums

Baby counter command

#1

I am super new with writing custom commands, and am I not entirely sure how to do it with variables. Trying to create a command to show chat the current number of babies we’ve had (Sim’s 100 baby challenge) Would appreciate any help

0 Likes

#2

Just copy and paste this line into your chat:

!addcom !baby So far, we had $(count) babies.

This will increase the counter everytime the command is called. If you want a command to show the amount and one to add one to it you can use these two commands instead:

!addcom !babies So far, we had 0 babies.
!addcom !addbaby -a=!editcom !babies So far, we had $(count) babies.

0 Likes

#3

Thank you domino!! Is there a way to start the count at a number other than 0, if we’re already at say, 50?

0 Likes

#4

Nevermind, I figured it out. Thanks again! :heart_eyes:

0 Likes

#5

Sorry, but actually the !addcom !addbaby -a=!editcom !babies So far, we had $(count) babies. doesn’t work. When I enter it, the !babies command no longer works. It’s like it keeps trying to edit to replace the first command, instead of editing the number?

0 Likes

#6

How does Nightbot responde to !babies and to !addbaby?

The way I setup these commands is that !addbaby will edit !babies. The expected responses for !babies would be “So far, we had 0 babies” (or whatever the count is right not) and for !addbaby it should be “Command !babies edited successfully”.

0 Likes

#7

I don’t remember the exact response, something like “the command !babies has been successfully edited” So I figure out I had to do a (count +1) edit to get it to work properly.

0 Likes

#8

@rheydnjaden what Domino suggested you 2 weeks ago should work, so I’d recommend to remove the commands you currently have and add them again.
!addcom !babies So far, we had 0 babies.
!addcom !addbaby -ul=moderator -a=!editcom !babies So far, we had $(count) babies.

If you want the command to start at let’s say 50 babies:
!addcom !setbaby -ul=moderator -a=!editcom !addbaby -c=$(eval $(1)-1)
Then call “!setbaby 50” and then call “!addbaby”, !babies should be updated to 50
Or you can call “!addbaby” once and then go in your Dashboard, find the !addbaby command edit the counter to 49 and call “!addbaby” once more in chat, !babies should be updated to 50

0 Likes