PythoNinja

@PythoNinja (2)
I'm alive. Yay.
PythoNinja
PythoNinja
shared a Post
1 year ago
1
What problem do I have with my code?
Ask
Hi, every time I select load on my repl, it shows an error, saying, "Attribute Error: 'Player' object has no attribute to 'display.'"Ah, well, I have
Read full post
PattanAhmed
PattanAhmed Is this question solved? @PythoNinja1 year ago
Coder100
Coder100 In your player class, you need to define a display function smh class Player: def init(self, name): self.name = name self.gold = 0 def display (self): print("Name:",self.name,"\nMoney:",self.gold) `1 year ago
PythoNinja
PythoNinja
shared a Post
1 year ago
2
How to fix a "EOFError: Ran out of input" problem?
Ask
Hi! I know it has something to do with databases, but I can't seem to know how to fix it.
Coder100
Coder100 Ok I think i might have got it, on line 66-73, change your code to: def cocker(): if sl == "LOAD" or sl == "2": def load(): global PlayerIG pickle.load(open("Save_File","rb")) PlayerIG.display() load() if sl == "START" or sl == "1": start() `1 year ago
Coder100
Coder100 it says playerIG is not defined?1 year ago
DynamicSquid
DynamicSquid Could you link your repl?1 year ago
PythoNinja
PythoNinja
shared a Post
11 months ago
2
What problem do I have with my code?
Ask
Hi! I have a variable, "money". However, when I put money-= 15, it does the red squiggly lines, but I put it all in "game". I don't think it should ha
RYANTADIPARTHI
RYANTADIPARTHI seems like your operation failed, because of using many quotes. Try not to use them.11 months ago
Coder100
Coder100 The code works just fine for me. Explanation When you see a `red squiggly line' that does not mean there is an actual error. It just means the linter has detected something wrong. However, linters aren't always correct. Run the code first and check to see if the code runs.11 months ago
PythoNinja
PythoNinja
shared a Post
1 year ago
1
My If Statements don't work...
Ask
Hello! I am making a game, and I wrote two if statements, and when I hit the run button and type in an answer, it goes to only one if statement when i
PattanAhmed
PattanAhmed @PythoNinja Hi, It's kind of weird and fun game but I can't find any kind of errors in your game If you really find one, then please comment me below! Thanks and waiting for your reply. *Hope this helps Please mark my answer if this helps.*1 year ago
gibbsfreenergy
gibbsfreenergy Is this the repl? https://repl.it/@PythoNinja/WealthyMountainousConversions#main.py As far as I can see this is the best Python 3 game I've ever seen! If this helped then please choose this as the correct answer to your question! Happy coding and a great day1 year ago
PythoNinja
PythoNinja
shared a Post
6 months ago
1
How can I delay something in Java?
Ask
I want something to delay in Java, but I don't know how.... Thanks!
Coder100
Coder100 Use the thread.sleep method. https://www.tutorialspoint.com/java/lang/threadsleepmillis.htm import java.lang.Thread; public class Main { public static void main(String[] args) { System.out.println("Hi"); Thread.sleep(1000); System.out.println("hi after 1 second"); } } `6 months ago
cuber1515
cuber1515 I believe you do Thread.sleep() and in the parenthesis put the milliseconds, so if you wanted to do it for 1 second, then: Thread.sleep(1000).6 months ago
PythoNinja
PythoNinja
shared a Post
6 months ago
1
the greatest game ever....
Share
it's a great game everyone should play it
Short Game (1)
Java
Bunnytoes
Bunnytoes @PythoNinja System.out.println("Game made by @PythoNinja") -_- forgot ;6 months ago
PythoNinja
PythoNinja if you like that game you can try this: https://replit.com/@PythoNinja/Short-Game-2#Main.java 6 months ago
ch1ck3n
ch1ck3n ironic how your username is python ninja and this repl is java6 months ago
PythoNinja
PythoNinja
shared a Post
1 year ago
1
What problem do I have with my code?
Ask
Hi! I recently tried to make a save/load system. When I try to save, it keeps showing me this line : "Name Error: name 'PlayerIG ' is not defined." I
PythoNinja
PythoNinja @Coder100 and @Spacecraft, thanks for you help, you both were really helpful! Sadly, I can only select one as an answer.1 year ago
Coder100
Coder100 Make sure nameInputAsk is called before askSave, or, you can just make a global variable called PlayerIG as a dummy class. Both work, one will have better results. Also, you might want to remove line 7: import self `1 year ago
Spacecraft
Spacecraft Hi @PythoNinja, It seems like you're trying to run your save function before you ask the user for their username. If you modify your code to call nameInputAsk() inside your askSave() function, I think it will work. I added it to the code below: def askSave(): ask = input("Do you want to save?\n--> ").upper() if ask == "Y" or ask == "YES": nameInputAsk() Save = Player(PlayerIG.name) pickle.dump(Save, open("Save File", "wb")) return curtis elif ask 1 year ago
PythoNinja
PythoNinja
shared a Post
1 year ago
How do you move the main.py to a folder?
Ask
Hi! I have a game where I have to sort files, because I have a lot of them. I can't seem to move the main.py, and I'm not even sure I can move it. If
AstOwOlfo
AstOwOlfo mv main.py new_location will move the file without losing the contents make sure to edit your .replit file accordingly1 year ago
Coder100
Coder100 Hi! The main.py file is pinned by repl.it and cannot be moved. You still can delete it using a hacky method (thus unpinning it). Hit ctrl+shift+s: rm main.py Your IDE may crash but just reload.1 year ago
PythoNinja
PythoNinja
shared a Post
6 months ago
1
How to clear the console in Java?
Ask
I'm having trouble about how to clear the console in Java... please help. Thanks!
Aivoybia
Aivoybia System.out.print("\033[H\033[2J"); System.out.flush();6 months ago
InvisibleOne
InvisibleOne console.clear() but I might be wrong6 months ago
PythoNinja
PythoNinja
shared a Post
1 year ago
1
What problem do I have with my code?
Ask
When ever I try to load, it says that PlayerIG is not defined, yet I can't solve the problem.
Game2(DoDL)
Python
Coder100
Coder100 Problem PlayerIG isn't defined yet. Make sure that the statement: PlayerIG = Player(option) is executed before you do anything with it (not in terms of line numbers, but when it was executed.)1 year ago
RYANTADIPARTHI
RYANTADIPARTHI Playerig is not defined You are naming playerig at the beginning. But at the beginning. Something called playerig is not defined. only maybe somewhere at the end. That's not possible. Maybe make that variable at the end, and call the global once defined. playerig = "something" def something(): global playerig print('something') print(something) like that.1 year ago
SamKunefeh
SamKunefeh Hello, first of all, I really like your game idea! Second of all, the problem is that you are setting the PlayerIG in the function nameInputAsk, which is only called in the function start. So when you run the code, you are calling the cocker function which tries to access the PlayerIG varaible, eventhough it is not set yet. Thus in conclusion if you want your code to work, you should either set this variable in the cocker function, or set it outside the nameInputAsk, because the variables in a f1 year ago
PythoNinja
PythoNinja
shared a Post
1 year ago
1
What problem do I have with my code?
Ask
Hi! I recently tried to make a battle system, but when the enemy is attacking, it will attack three times. I looked over my code, though I can't find
PattanAhmed
PattanAhmed @PythoNinja Hi, Silly mistake... On line 70 of your code, it's like this:- if choice1 == "DEFEND" or "2": Which is wrong. Instead, change that line like this:- if choice1 == "DEFEND" or choice1 == "2": It should be like this. That's it Thanks! Hope this helps1 year ago
Coder100
Coder100 arrggh image This is the reason why. So, what happens in python's small brain is: if (choice1 == "DEFEND") or ("2"): Obviously it will always be True ("2" == True). What you are looking for instead is: if choice1 in ("DEFEND", "2"): or: if choice1 == "DEFEND" or choice1 == "2": `1 year ago
PythoNinja
PythoNinja
shared a Post
3 months ago
1
how....
Ask
how do you get rid of this.... image
MrVoo
MrVoo Copy paste the code into a new repl3 months ago
PythoNinja
PythoNinja
shared a Post
3 months ago
1
What da hek happened here?
Ask
hello people i have given up on grammar. i need help on this. why does it say weapon not defined? i put de global weapon and global she, but they wont
MrVoo
MrVoo The only error I see is on line 57, which is an easy fix3 months ago
PythoNinja
PythoNinja
shared a Post
6 months ago
1
What does this mean????
Ask
Im having trouble on this game im making it keeps saying this: image
QuickV
QuickV On line 241 it says: global slot1, but it is already assigned at the beginning of the code on line nine: global slot1... Hopefully this helps :)6 months ago