Closed cockerelhub closed 2 years ago
I want to add the number of laps to my racing bot. Despite all my attempts, I was unsuccessful. Please help me.
@cockerelhub Hello dude, I have seen your issue and made a simple F1 time trial bot for you. You can find it out on the following link: https://github.com/thenorthstar/HaxBall-Simple-F1-Racing-Bot/blob/main/js/Simple_F1_Bot.js
Here's a sample time trial: https://thehax.pl/forum/powtorki.php?nagranie=6120a5d55c5b6b97f5dfe94203427c8a
Thank you so much dude <3
I want to add the number of laps to my racing bot. Despite all my attempts, I was unsuccessful. Please help me.
@cockerelhub Hello dude, I have seen your issue and made a simple F1 time trial bot for you. You can find it out on the following link: https://github.com/thenorthstar/HaxBall-Simple-F1-Racing-Bot/blob/main/Simple_F1_Bot.js
Here's a sample time trial: https://thehax.pl/forum/powtorki.php?nagranie=6120a5d55c5b6b97f5dfe94203427c8a
Thank you so much dude <3
I want to add the number of laps to my racing bot. Despite all my attempts, I was unsuccessful. Please help me.
@cockerelhub Hello dude, I have seen your issue and made a simple F1 time trial bot for you. You can find it out on the following link: https://github.com/thenorthstar/HaxBall-Simple-F1-Racing-Bot/blob/main/Simple_F1_Bot.js Here's a sample time trial: https://thehax.pl/forum/powtorki.php?nagranie=6120a5d55c5b6b97f5dfe94203427c8a
@cockerelhub You're welcome.
Hello! I was looking at the bot and I would like to know what setTimeout() is for, which are inside the checkPlayerLaps() function.
Hello! I was looking at the bot and I would like to know what setTimeout() is for, which are inside the checkPlayerLaps() function.
@panthundra It's for preventing the bot to spam when a player is crossing the start/finish line. Because the function is working on room.onGameTick and has a potential to spam if used incorrectly.
@panthundra It's for preventing the bot to spam when a player is crossing the start/finish line. Because the function is working on room.onGameTick and has a potential to spam if used incorrectly.
Yes, think so, but above you define: if(!ifInLapChangeZone(p) && playerList[p.name].lapChanged == true){ playerList[p.name].lapChanged = false; } What I see it does is that it restricts it to being executed only once when the finish line is crossed. I don't know if there's something I'm missing, or removing the setTimeout would cause more problems. I have tested it alone and it has not spammed at any time
@panthundra It's for preventing the bot to spam when a player is crossing the start/finish line. Because the function is working on room.onGameTick and has a potential to spam if used incorrectly.
Yes, think so, but above you define: if(!ifInLapChangeZone(p) && playerList[p.name].lapChanged == true){ playerList[p.name].lapChanged = false; } What I see it does is that it restricts it to being executed only once when the finish line is crossed. I don't know if there's something I'm missing, or removing the setTimeout would cause more problems. I have tested it alone and it has not spammed at any time
@panthundra So did you check how did your maps change then? Was they increasing one by one or more than once in one? I had thought also on this situation but (it's my fault) I forgot to say this.
@panthundra So did you check how did your maps change then? Was they increasing one by one or more than once in one? I had thought also on this situation but (it's my fault) I forgot to say this.
Do you mean when the race ends and the map changes? When that happens there is a spam of the message that changed the map
@panthundra So did you check how did your maps change then? Was they increasing one by one or more than once in one? I had thought also on this situation but (it's my fault) I forgot to say this.
Do you mean when the race ends and the map changes? When that happens there is a spam of the message that changed the map
@panthundra I mean the increment in your maps per every cross on the finish line. Hence, also mean the map change after the last lap completed ofc.
@panthundra I mean the increment in your maps per every cross on the finish line. Hence, also mean the map change after the last lap completed ofc.
ah, it does not perform increments more than once
@panthundra I mean the increment in your maps per every cross on the finish line. Hence, also mean the map change after the last lap completed ofc.
ah, it does not perform increments more than once
@panthundra I might find a solution to keep it silent. Just set the width (or height) of the rectangular area (according to the direction of the straight of start/finish) equal to the player speed. For example, if the straight of start/finish is horizontal, then set the width of rectangle as equal to the X component player speed.
After doing this, it has just send the message once and no more but I'm not sure if it would work in the same way after I fit that code into my F1 bot.
@panthundra I might find a solution to keep it silent. Just set the width (or height) of the rectangular area (according to the direction of the straight of start/finish) equal to the player speed. For example, if the straight of start/finish is horizontal, then set the width of rectangle as equal to the X component player speed.
After doing this, it has just send the message once and no more but I'm not sure if it would work in the same way after I fit that code into my F1 bot.
Sorry I thought I was following the conversation well but I think I missed what we're talking about. I guess it's because I have to translate this in google translate. I'm just saying that the setTimeOut doesn't seem necessary since it doesn't spam even without it.
@panthundra I might find a solution to keep it silent. Just set the width (or height) of the rectangular area (according to the direction of the straight of start/finish) equal to the player speed. For example, if the straight of start/finish is horizontal, then set the width of rectangle as equal to the X component player speed. After doing this, it has just send the message once and no more but I'm not sure if it would work in the same way after I fit that code into my F1 bot.
Sorry I thought I was following the conversation well but I think I missed what we're talking about. I guess it's because I have to translate this in google translate. I'm just saying that the setTimeOut doesn't seem necessary since it doesn't spam even without it.
@panthundra Don't worry, we're not going away the topic of the conversation. Before doing that I was think of it's necessary but after I have noticed that I would be able to adjust it without setting a timeout.
I want to add the number of laps to my racing bot. Despite all my attempts, I was unsuccessful. Please help me.