Author Topic: Fetch result of a calc  (Read 1267 times)

0 Members and 1 Guest are viewing this topic.

Discredit

  • Youngling
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Discredit
Fetch result of a calc
« on: December 12, 2015, 07:04:52 AM »
Hey there Deepbot peoples!
I'm trying to set up a command chain that requires me to get a result from a calc command and save it to a .txt file. But i'm not sure how to do this, i've tried various ways about it but i just can't quite get it.

The latest version, that RepentGaming worked with me on, is this:
@calcpre@[+,@readfile@[custom logs/24hstream.txt],@target@] - So the calc fetches a number from the text file and adds that value with the @target@ value. Which works just fine. My issue is, that the sum of these two needs to be saved somewhere and i don't know how to do this.
Repent suggested that i try a savelog command like this: @savelog@[textfile.txt,@message@] as a chained command to the calc command. However this doesn't insert anything into the text file :(

Anyone out there who has a way of fetching the sum of this calc to store in a file?

MercurY3rd

  • Councilor
  • *****
  • Posts: 652
  • Karma: +26/-1
    • View Profile
  • Twitch Name: mercury3rd
Re: Fetch result of a calc
« Reply #1 on: December 12, 2015, 08:02:54 AM »
why not just:
@savefile@[result.txt,@calcpre@[+,@readfile@[24hstream.txt],@target@]]
« Last Edit: December 12, 2015, 08:33:11 AM by MercurY3rd »
Hier steht nichts Sinnvolles, dennoch freundliche Grüße. MercurY

Discredit

  • Youngling
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Discredit
Re: Fetch result of a calc
« Reply #2 on: December 12, 2015, 08:27:00 AM »
That seems to work! And in a way more simple way than the other stuff i was doing.

I had to make a few changes, one was that it kept posting the result in chat, like so: @savefile@[result.txt,100
It need another ] at the end of the command.

The other than that it seems to work very well! I changed the result.txt to 24hstream.txt to make the bot continue to add onto the original value. So it's a steadily growing 'pool'. It'll be used for 'funding' 24 hour streams based on points. When a certain amount is reached, say 10k points donated, a 24 hour stream will be planned.

I can probably do an if statement or some such to make a "Yay we hit our mark" post in chat once the goal is reached, i'll tinker some with that. Thank you so far! :)