#πŸ”’ this code is skipping lines of code, idk what to do

44 messages Β· Page 1 of 1 (latest)

charred stump
#

https://pastebin.com/5fmzNH13 this code is for whatever reason skipping the game categories if and elifs of the else, it runs the function up to the print shloop, and then stops, the break is there because when its not, the shloop gets run in an infinite loop,(hence shloop), no idea why cause to me it looks like it should work with or without the break

safe trellisBOT
#

@charred stump

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

charred stump
#

keeping it open

vapid mist
#

can you give me a line number? i did look at the code last night and there was too much going on for me to find the lines in my half asleep state

charred stump
#

first, yea nobody replied at all, and yea sorry for replying late i was looking at some other stuff, the last lines that activate properly are 213-221 then it just stops, and ive tested it without the break, where it instead does something very weird, it still skips the game category ifs but then also just goes straight into the start voting function again, no idea why, and while it does that, the first lines are stuck in an infinite loop, where it just keeps pressing enter over and over again

vapid mist
#

do you ever change the restarted variable?

#

where in the code does that get changed while its in this loop?

charred stump
#

the restarted variable is for a command to restart the game, its only activated if needed and sets itself to false right after being activated

#

i didnt make most of this code but ive learned more or less what each thing does by trying to fix it up, the while restarted is everywhere so i didnt think it mattered but should i change it to an if

vapid mist
#

so youre running the loop while its false, and if its being set to false, what changes it to true while its in the loop?

#

i would say it probably needs to be an if, but im only looking at this small section of the code so i cant say for certain

charred stump
#

the command for restarted is towards the bottom let me see what line

#

335

#

its only for when something in the game goes wrong

#

but i dont understand why that one is an infinite loop while the other while restarted == false are all fine, theres a lot before it that run perfectly

#

oh maybe there isnt i think i read the code wrong lemme try changing it to an if

#

but will the restart command still work the same?

vapid mist
#

🀷 only 1 way to see

charred stump
#

fair enough, i havnt really tested the restart command much tho since the basics of the app dont work yet so it might not even work at all

#

uhmmm it did run the other lines, but out of order? it ran all the lines, restarted the vote and then opened the game... like i said im just learning code by working on this thing i commissioned so im very confused

#

why did it open the game last??? its much higher within the code, and i think i can fix the voting being restarted instantly by only keeping the last section as a while restarted == false

#

im just guessing but maybe the code runs too fast, i think its possible the game takes too long to open so im just gonna add a time sleep

#

hmmm it still started voting immediately after... why

#

what if i put the whole thing in a while restarted == false instead of just the individual lines, would that maybe do something

#

wait i think i mightve figured something out lemme test

#

nope it still restarts the voting function immediately WHYYY

#

a def isnt a line that gets run in order right?

#

even if it does this still doesnt make sense to me

charred stump
# vapid mist 🀷 only 1 way to see

sorry to make more work, but heres what i have now https://pastebin.com/nNZBq9tQ , changing it to an if did solve it not running the game categories thing, but now the issue is that it goes straight back to start voting, i dont understand why because its an if statement thats looking for a loc and it definitely does not see that loc yet

vapid mist
#

ill look in a second helping my wife for a few minutes

charred stump
#

πŸ‘ take your time i appreciate the help

vapid mist
#

can you give me the line thats getting run when you dont want it to? i dont know this code and dont feel like trying to unravel it

charred stump
#

thats the thing i dont know what line it is, i just know that its going fine up until line 255 and then it does something its not supposed to, which is running the start voting function, no idea why, im not even sure if it runs the few lines after that because i the timing has been off but ill keep adjusting the wait time until it syncs up perfectly and lyk

#

hmmm im so confused, after restarting the start voting function, after around 1 minute it then automatically votes for hypnotorious in jackbox 10, no idea why cause nobody votes for it, and the voting function is supposed to have a minimum of 3 votes before it picks and plays a game

charred stump
vapid mist
#

im seeing them dont worry, i dont get pings

#

im on do not disturb bc music

#

and sleeping baby

charred stump
#

Ah, got it

safe trellisBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.