Author Topic: Can I use calculations with a counter?  (Read 2882 times)

0 Members and 1 Guest are viewing this topic.

MentalMedic

  • Youngling
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Can I use calculations with a counter?
« on: April 13, 2016, 04:34:16 AM »
Hello, I am trying to set up a death counter for my friend's stream and set up 2 commands; one adds a death to the counter and the other lists the current number of deaths as recorded by the counter. I want to know if there is any way to reduce the counter by one or any other number just in case I mess up.
I don't want to reset the counter at 50 deaths because I typed it one too many times and then have to add them one by one up to how many should be proper.

TheNumbLock

  • Advisor
  • Councilor
  • **
  • Posts: 4776
  • Karma: +137/-5
    • View Profile
  • Twitch Name: TheNumbLock
Re: Can I use calculations with a counter?
« Reply #1 on: April 13, 2016, 05:28:04 AM »
You could just have the command save a .txt file and have the viewer command grab the text file/read it. And the other command to save it. Basically with this setup in the pics, the mod would type !adddeath NumberHere. The viewer command would then read the .txt file and display it in chat. The streamer can even add the .txt file to their stream overlay at the same time.

Mod command:


Viewer Command: (Ignore the disabled part)
Old Name: RepentGamingTV
Twitch: Here

Need help ASAP?
Join Deepbot's Discord: Discord.Deepbot.tv
Deepbot's Twitter: @DeepSupport

MentalMedic

  • Youngling
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Can I use calculations with a counter?
« Reply #2 on: April 13, 2016, 06:23:55 AM »
Thanks, i'll give it a go next stream :D

SalableSix8

  • Youngling
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
  • Twitch Name: SalableSix8
Re: Can I use calculations with a counter?
« Reply #3 on: April 18, 2016, 01:47:36 AM »
I wonder the same thing. Saw in a stream they used !death + and !death - to add and remove a death from the counter. Any good suggestions on how to set that up? Not 100 % sure if it was deepbot or a different bot though

TheNumbLock

  • Advisor
  • Councilor
  • **
  • Posts: 4776
  • Karma: +137/-5
    • View Profile
  • Twitch Name: TheNumbLock
Re: Can I use calculations with a counter?
« Reply #4 on: April 18, 2016, 07:34:09 AM »
It is possible, just use @calc@ = Use operators to calculate mathematical equations. @calc@[op|num1|num2] , Available operations (+,-,*,/). E.g. @calc@[+|5|4].
Old Name: RepentGamingTV
Twitch: Here

Need help ASAP?
Join Deepbot's Discord: Discord.Deepbot.tv
Deepbot's Twitter: @DeepSupport

Psywarrior

  • Youngling
  • *
  • Posts: 7
  • Karma: +1/-0
    • View Profile
  • Twitch Name: djpsywarrior
Re: Can I use calculations with a counter?
« Reply #5 on: May 19, 2016, 09:31:17 AM »
It is possible, just use @calc@ = Use operators to calculate mathematical equations. @calc@[op|num1|num2] , Available operations (+,-,*,/). E.g. @calc@[+|5|4].

What would this actually look like in the command?

KennyGString

  • Youngling
  • *
  • Posts: 16
  • Karma: +1/-0
    • View Profile
  • Twitch Name: KennyGString
Re: Can I use calculations with a counter?
« Reply #6 on: May 23, 2016, 09:32:22 AM »
It is possible, just use @calc@ = Use operators to calculate mathematical equations. @calc@[op|num1|num2] , Available operations (+,-,*,/). E.g. @calc@[+|5|4].

What would this actually look like in the command?


Here you go guys. Had nothing better to do so I made the command for you. Need to make a custom log with the folder named Death, and inside that folder a txt file named deathcount. I've tested it and it works.

!death
Code: [Select]
@if@[@target@||+||!adddeath||@if@[@target@||-||!subdeath]]
!adddeath
Code: [Select]
@savefile@[Death\deathcount.txt,@calc@[+|@readfile@[Death\deathcount.txt]|1]]
!subdeath
Code: [Select]
@savefile@[Death\deathcount.txt,@calc@[-|@readfile@[Death\deathcount.txt]|1]]
!deathcount
Code: [Select]
You've died @readfile@[Death\deathcount.txt] times.