Author Topic: @savelog@ causes error in @readfile@[line#,file\path.txt]  (Read 1038 times)

0 Members and 1 Guest are viewing this topic.

BlooRooster1

  • Youngling
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
  • Twitch Name: BlooRooster1
@savelog@ causes error in @readfile@[line#,file\path.txt]
« on: July 29, 2016, 05:34:27 PM »
Bug: @savelog@ causes error in @readfile@[line#,file\path.txt]

Info: When using @savelog@, it appears to added an extra blank line (as if the bot typed the previous line and hit 'enter') to text file.  For some reason, Deepbot has an issue @readfile@ with a line number when this happens on loop when this happens.  I delete the extra line break, and the @readfile@ runs with no issue.

How did you come across this bug?:
Creating a betting system that works as follows: Everytime a user enters a bet, there name is @savelog@'d to a text file (betters.txt), while simultaneously, the number saved in a seperate text file (betnum.txt) is incremented by 1.  When the bets are payed out, a loop is run that first checks if betnum.txt == 0.  If true, it reads a line from betters.txt equal to the number on betnum.txt and pays out the name on that line.  It then decrements 1 from betnum.txt, and repeats until betnum.txt == 0.  It does not payout the last person to bet, and instead returns "Error reading file"
I created a text file myself with a similiar "read-decrement-repeat" loop, and as long as their was an extra line break at the bottom of the text file, the bottom number (first number to be read in the loop) would return an error rather than read.

Pic: