Author Topic: Deebot doesn't recognize negative numbers  (Read 1308 times)

0 Members and 3 Guests are viewing this topic.

Niphrentil

  • Youngling
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
  • Twitch Name: greekngeek
Deebot doesn't recognize negative numbers
« on: August 09, 2016, 08:23:37 PM »
Bug: Commands don't recognize negative numbers

Info: Trying to setup a countdown and Deepbot doesn't recognise -1 to be lower than 0.

How you produced this bug or came across it:

I'm trying to setup a simple cooldown timer for the stream with a loop @calc@ and an @if@ statement. The issue I come across is this.
A user uses a command and the command sets the timer to X seconds with a @savefile@ variable to a counter.txt
Then a looping command takes the counter.txt info and performs the following string: @savefile@[counter.txt,@calc@[-|@readfile@[counter.txt]|1]] which runs every second, making the text appear as X, X-1, X-2,X-3 etc etc. The issue appears when the counter reaches 0 where it goes to -1 then back to 0 and back to -1 on an endless loop. This happens because the bot subtracts -1 from -1 which becomes (-1)-(-1)=-1+1=0. This shouldn't be an issue, though, cause I setup another looping command with an @if@ statement that says that "@if@[<||@readfile@[counter.txt]||1||!cooldownon||!cooldownoff]". Now, this command checks every second if the value of counter.txt is higher or lower than 1 so it turns off the cooldown timer on the stream. It works when the timer reaches 0 but it doesn't recognize "-1" as "lower than 1" and the cooldown timer keeps blinking on and off. I tried to change the @calc@ command to @calc@[+|@readfile@[counter.txt]|-1]] so I can avoid the -1/0 loop but then the command doesn't even work, I assume it doesn't recognize "-1" as a valid number...

Image:
https://i.makeagif.com/media/8-09-2016/Y-NFnY.gif

Niphrentil

  • Youngling
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
  • Twitch Name: greekngeek
Re: Deebot doesn't recognize negative numbers
« Reply #1 on: August 09, 2016, 09:26:52 PM »
A fix to this is to make the @if@ statement like this:

@if@[>||@readfile@[counter.txt]||1||!cooldownoff||!cooldownon]

but that doesn't mean that the negative numbers bug goes away...! :)