Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared button cooldowns don't always work #30

Closed
Chronostrider opened this issue Jan 25, 2017 · 25 comments
Closed

Shared button cooldowns don't always work #30

Chronostrider opened this issue Jan 25, 2017 · 25 comments
Assignees
Labels
Bug A defect in the app
Milestone

Comments

@Chronostrider
Copy link

I have two buttons set up to share a cooldown, Button 1 triggers the cooldown on both buttons consistently, but Button 0 only triggers its own cooldown most of the time. I also occasionally get a disconnect and error message stating "Error setting up robot events in setupRobotEvents." but I don't know if this is related.

@Firebottle Firebottle added the Bug A defect in the app label Jan 25, 2017
@Firebottle
Copy link
Collaborator

It could definitely be related. If a button tries to send a cooldown for a button that does not exist on your dev board it could cause issues. Double check that the cooldowns for both are correct and comma separated numbers.

If that looks fine, could you attach your controls file to github for me? You can find this by going to your firebot folder, then user settings, and then controls. Inside there you'll find files named after your boards. These don't have any personal info and can be shared. Attach the one you're running here and I'll check it out.

@ThePerry-2015
Copy link
Collaborator

ThePerry-2015 commented Jan 25, 2017

Buttons ID > than the other ID it triggers cooldown for works. But button with ID < other ID to trigger cooldown does not trigger cooldown for ID < itself.
So with ID 4, 5 and 6 triggering 4,5,6 will work for:
Button ID 6 cools down 4, 5 and 6
Button ID 5 cools down 4, but not 6
Button ID 4 does not cool down 5 and 6.

I do see the same error if I'm adjusting the buttons while interactive mode is connected.
"Error setting up robot events in setupRobotEvents"

@Chronostrider
Copy link
Author

This makes sense. Button 0 has actually triggered the global cooldown once or twice, but I think it does that only the first time after the app has been run. After that it reverts to the behavior Perry described.

I can attach my controls file when I get home from work tonight, if you still need it by then.

@Firebottle
Copy link
Collaborator

Ah, gotcha. Okay thanks for the info! I'll take a look at it.

@Firebottle Firebottle added this to the 1.1.0 Release milestone Jan 25, 2017
@Firebottle Firebottle self-assigned this Jan 25, 2017
@Firebottle
Copy link
Collaborator

Just to follow up, I think I know what was causing the problem. As it was parsing the report from Beam it was overwriting the status of the button. So in some cases I was sending Button 0 = cooldown and Button 0 = dont cooldown. So, beam would go with whatever was the last thing in the report.

Hoping I can get a fix out soon.

@Firebottle
Copy link
Collaborator

Okay, I completely rewrote the cooldown logic today. Can you guys give it a shot?

https://github.com/Firebottle/Firebot/releases/tag/v1.1.0-beta.2

@ThePerry-2015
Copy link
Collaborator

Hmm, not sure if this works at all. On my end the application now crashes when I use any of the buttons. I remade my whole board config as well just to be sure that it wasn't something in the old board that messed it up. You got any luck @Chronostrider ?

@Chronostrider
Copy link
Author

I'm using the same board on Beam's end that I was previously, but I replaced the entire app folder with the new version and set up the buttons almost exactly the same as before, only with a shorter cooldown to facilitate testing. So far it's working and actually seems more stable than the previous version on my end. Both buttons triggering their cooldowns appropriately and no soft crashes on the bot's side dropping the connection to Beam.

@Firebottle
Copy link
Collaborator

Awesome! Thanks for the help in testing @Chronostrider. I'll wait to see if @ThePerry-2015 can get his running without crashes before closing.

@ThePerry-2015
Copy link
Collaborator

I've redownloaded the last updated beta and did it all from scratch, but I can't get it to stay alive more than the first and/or second click on the buttons. Sometimes it dies after the first others the second time.
I've attached my board: test.json and my app: beam.json. Renamed to .txt just so I could attach them.

test.json.txt
beam.json.txt

@ThePerry-2015
Copy link
Collaborator

Just an update, I downloaded the last changes of the development branch and rebuilt my own local copy and it still crashes when pushing any of the buttons. Sometimes they work one or two buttons other times it crashes on the first button. It's totally random on which button it happens. The last attempt was done on a fresh Lab game and a freshly installed windows 10 laptop which I just downloaded the beta release and then after seeing that it crashed as well I thought I should give the source code a try, installed node.js and everything else needed to run FireBot, gave that a shot and it fails just as the beta-2 build. Just wanted to make sure my desktop wasn't the reason for the crashing.

@Firebottle
Copy link
Collaborator

@ThePerry-2015 In the beam dev lab can you try toggling on either "holding" or "frequency" for each button, but not both? (Probably don't put holding on a sound button either. Not sure what will happen there.)

@ThePerry-2015
Copy link
Collaborator

I made a new board with only 4 buttons(ID: 1-4) in dev lab, set them to frequency only and setup a new board in Firebot with 1-4 as sound buttons with 5 seconds cooldown on them self, not triggering others. Goes ok for 2 buttons, triggers sound for button 3 but crashes the app before it triggers the cooldown. If I only trigger button ID 1 and 2 I can continue for a long time (at least 5 minutes) without the app crashing. As soon as I go for button ID 3 or 4 it crashes. And just to be sure I've used the same soundfile for all four buttons. I thought maybe it could have been the soundfiles for the two last ones since I always had the same two files on the last two buttons, but I changed around and it still worked with 1 and 2 for a while. As soon as I trigger button 3 or 4 it crashes.

@ThePerry-2015
Copy link
Collaborator

This was weird. Now I added ALL the four buttons into the cooldownButtons field.
1: 1,2,3,4
2: 2,1,3,4
3: 3,4,1,2
4: 4,1,2,3
And then they all work, triggering eachother. But as soon as they only trigger them self and not the others things start crashing.

@Firebottle
Copy link
Collaborator

Firebottle commented Jan 26, 2017

Ooooh for the buttons that cool down themselves, are you putting anything into the cooldown buttons fields or are you leaving it blank? Try putting the button id in there. (sorry I would test all of this but i'm at work) @ThePerry-2015

@ThePerry-2015
Copy link
Collaborator

ThePerry-2015 commented Jan 26, 2017

I'm putting their own ID in the fields for each button.
1: 1
2: 2
3: 3
4: 4

@Firebottle
Copy link
Collaborator

Fixed in 1.1.0

@ThePerry-2015
Copy link
Collaborator

ThePerry-2015 commented Jan 29, 2017

So, I managed to get it to break again. It worked just fine when testing with just 4 buttons and one triggering the other and vice versa. But adding more buttons into the loop I ended up with the same issue, it brings firebot to a halt. I'm attaching beam.json.txt(the dev lab board), test1.json.txt(board setup in Firebot) and output.log.txt(output of what happens when the app freezes.. Sometimes I can click buttons for 1-2 minutes without issues other times it crashes on the first push. It seems like it goes into and infinite button trigger loop of sorts.

This is the last actuall button that is pressed on the board before all breaks and just loops through a lot of Not pressed but in list and so on.
Robotjs: a up
Robotjs: d down
4 'Pressed Button'

beam.json.txt
output.log.txt
Test1.json.txt

@Firebottle
Copy link
Collaborator

okay, well I did some of my own testing and it turns out to be what I feared. The app cant process all of the data for the buttons plus all of their individual cooldown button lists. This is why it happens for buttons with 3+ cooldown buttons in the list. A second report comes in before the first one is done processing.

I have some ideas on how to fix it. But, they all revolve around revamping a good deal of the app. It's going to take awhile.

@Chronostrider
Copy link
Author

Okay, that makes sense as to why I didn't have any issues after the last fix; my setup only requires two buttons, so I wasn't running into the same overflow problem.

@Firebottle
Copy link
Collaborator

@ThePerry-2015 completely rewrote the cooldown system in latest commit to go with my new prebuilt cooldown idea I explained. I tested it today with 63 buttons and it worked flawlessly.

@ThePerry-2015
Copy link
Collaborator

Sounds good @Firebottle, I'll give it a go and report back how it works out.

@ThePerry-2015
Copy link
Collaborator

ThePerry-2015 commented Feb 2, 2017

Just wondering about the "Individual Cooldowns" group; Have you programmed it to default the buttons in that group to 15000 ms by any chance? What ever I enter in that field reverts back to 15000 ms as soon as I click the save button. If I change the code of the ${board}.json file it will keep that setting until I do a change via FireBot, then it reverts it back to 15000 ms even if I wrote 3 sec in the cooldown field. This is not a button in a "custom" cooldown group. This is a individual cooldown. It shows as solo in the json so the board seems to recognize that the right way, but messing with the cooldown time. Other than that it seems like the groups solved the issue, have tried a 4 button group and a 8 button group without any hick ups except for the ones with the individual buttons like described in the top. And the strange behaviour of the buttons jumping back into the "Individual cooldowns" group, but that seems to only be a visual bug so far, when you edit that button.

Disregard the one about changing the cooldown back to 15 sec, I see that you have added a check for API Buttons, if cooldown < 15000 set the cooldown to 15000. So I guess there should be a notification about minimum cooldown for API Buttons is set to 15s in the GUI somewhere. Or give the user a feedback that the cooldown has been forced to 15 seconds.
The strange behaviour with this is that if the button is put in a cooldown group it will work with that groups cooldown if less than 15 seconds.

@Firebottle
Copy link
Collaborator

Yeah, there are a few kinks I have to figure out. I added that sort of last minute. I have to figure out a way to protect these people's API from being hammered by someone who tries to set it at 0 cooldown. But... that's a different issue haha.

@Firebottle
Copy link
Collaborator

Should be good in the v2.0.0-beta1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A defect in the app
Projects
None yet
Development

No branches or pull requests

3 participants