#๐Ÿ”’ I am having issues with my code!!!

68 messages ยท Page 1 of 1 (latest)

sacred wrenBOT
#

@little iris

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.

little iris
broken goblet
little iris
#

Its not working the auto clicker in a def named Auto on line 61 and 106

#

iT also says on the error"IMPORT GAME CODE!/Clicker.py"

#

@broken goblet

broken goblet
#

Show the full output

little iris
#

?

#

oh right

#

full output @broken goblet

broken goblet
#

Don't post a screenshot of output use copy/paste and a code block

little iris
#

Ok

#

Hello from the pygame community. https://www.pygame.org/contribute.html
The key E has been pressed!
Traceback (most recent call last):
File "c:\Users\User\Documents\IMPORT GAME CODE!\Clicker.py", line 106, in <module>
Auto(score)
TypeError: Auto() takes 0 positional arguments but 1 was given
PS C:\Users\User\Documents\Coding\Pygame\Car\Code\Images>

broken goblet
#

Remember code blocks

shadow ruin
#

btw code blocks are formatted with backticks

#

code goes here

#

like "`"

little iris
#

code blocks?

broken goblet
#

!code

sacred wrenBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

little iris
#

What would i need to do to fix it and where on what line?

broken goblet
#

It's on the first and last lines of your message

broken goblet
little iris
#

What would I need to put in the code to fix it though?

broken goblet
#

If looks like you already fixed the exception you're getting

#

From your pastebin

#

See where your traceback says line 106?

little iris
#

yes

broken goblet
#

Then look at your code on line 106 and compare what the traceback says is on that line

little iris
#

ok

broken goblet
#

What difference do you see?

little iris
#

Auto(score) and Auto()

broken goblet
#

Right

little iris
#

I fixed that

#
The key E has been pressed!
The key X has been pressed!
The key E has been pressed!
Traceback (most recent call last):
  File "c:\Users\User\Documents\IMPORT GAME CODE!\Clicker.py", line 106, in <module>
    Auto()
  File "c:\Users\User\Documents\IMPORT GAME CODE!\Clicker.py", line 64, in Auto
    score = score + 1
            ^^^^^
UnboundLocalError: cannot access local variable 'score' where it is not associated with a value
PS C:\Users\User\Documents\Coding\Pygame\Car\Code\Images>```
#

Im now getting this

broken goblet
#

Remember to use code blocks for tracebacks

#

Please edit your message to use a code block

#

!code

sacred wrenBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

little iris
#

That it?

broken goblet
#

No

little iris
#

I have no idea what you mean by code block and hwo I do it

broken goblet
#

It's three back ticks you only used one

broken goblet
little iris
#

ok

#

There?

little iris
bright sky
#

but you're passing one (score)

broken goblet
bright sky
#

oh

broken goblet
little iris
#

where would I use that?

broken goblet
little iris
#

Is it global above def or no def ?

little iris
#

What i am trying to do with it is make it so every second the score goes up by 1

broken goblet
#

A while loop isn't correct

little iris
#

oh right

glass topaz
#

You would need to use the time module and do time.sleep(1) in the while loop, freezing it for one second then adding a score

#

I have made a game in pygame as well

broken goblet
#

That would freeze the game to all other inputs it's not the correct way to handle time in games

sacred wrenBOT
#
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.