Make a Game. Win a Bitcoin.

00
Days
00
Hours
00
Mins
00
Secs

Until Jam Ends on Apr 18

Ask coding questions

Posts
Pinned
45
Guide to Asking Coding Questions
# **Guide to Asking Coding Questions** ## **Why?** Good questions help your question be solved faster, and people will want to answer your question Bad questions waste time, you will often not get answers that you asked for, and people will often ignore your questions ## **Quick Questions Guide** ### Do This - Always ask your questions in English - Explain what you want the code to do - Explain what the code does - Include error messages - Share the repl with the line numbers - When you figure out the answer, update your post - Put the repl link, instead of pasting code ### Don't Do This - Don't post homework questions - Don't use caps in the title - Don't use words like 'HELP' or 'PLEASE' in the title - Don't post questions that already have an answer (Search Box) - Don't post feedback or bugs on Talk, use [repl.it/feedback](https://repl.it/feedback) for feedback, or [repl.it/bugs](https://repl.it/bugs) for bugs ## **Steps For Better Questions** 1. Understand the code - Read your code and figure out what each line does - If a concept is unfamiliar, Google it - You can also use a debugger to help you 2. Describe the problem - Explain what you want the code to do - Explain what the code does (error messages) 3. Provide the code - Share a repl that has your code - Share the line number(s) of your code issue - Make sure that the code you shared has the issue 4. Format code constantly - Make sure you code is easy to read 5. Check for typos - Make sure the code does not have any typos that would cause the problem 6. Explain what you did to troubleshoot the problem - Make a list of what you think the problem is and try to fix your problem by going through the list 7. Make a guess on what you think the problem might be - Use the list from the previous step 8. Proofread the question - Make sure you provided everything - Clear all confusions that you think there might be 9. Update people on the question - If you figured out the answer, edit the post to tell people - When you get an answer, fully understand it - Be nice to people who answer your question - Remember that the people wanted to answer your question, but didn't have to 10. Thing to NOT do - Don't post homework questions - Only post questions in English - Do not use caps in the title - Do not use "HELP" or "PLEASE" in the title - Don't post questions that have already been answered (Use search box) - Don't post feedback or bugs on Talk, use [repl.it/feedback](https://repl.it/feedback) for feedback, or [repl.it/bugs](https://repl.it/bugs) for bugs ## **Example:** ### **Question** We have some Python code with an error: [repl](https://repl.it/@Mosrod/Question-Tutorial) ```python rannumexe = int(input()) if rannumexe = 1: print('hi' + rannumexe) ``` ### Step 1 We show what each line does using comments. ```python rannumexe = int(input()) # Asks the user to input a rannumexe if rannumexe = 1: # If the rannumexe equals 1 print('hi' + rannumexe) # Print hi and the rannumexe ``` ### Step 2 We want the code to input a number, and if the number is one, print "hi" and the number. Our problem is that we have an invalid syntax error on line 2 in the main.py file. ``` File "main.py", line 2 if rannumexe = 1: ^ SyntaxError: invalid syntax ``` ### Step 3 Our repl with the issue is located [here](https://repl.it/@Mosrod/Question-Tutorial). We have an issue on line 2 ### Step 4 We can change "rannumexe" to "number" to clear confusion ```python number = int(input()) # Asks the user to input a number if number = 1: # If the number equals 1 print('hi' + number) # Print hi and the number ``` ### Step 5 We don't have any typos ### Step 6 Our problem could be that we improperly used the if statement ### Step 7 The problem could be about using the if statement incorrectly ### Step 8 Our final question: Title: Invalid syntax error about equal signs Content: I have an invalid syntax error on line 2 in the main.py file of this [repl](https://repl.it/@Mosrod/Question-Tutorial). The program should take a number as an input, check if the number is equal to one, and if so, print "hi" and the number. The error point to the equal signs and I think this issue is with the incorrect syntax of the if statement. Help is appreciated :). ```python number = int(input()) # Asks the user to input a number if number = 1: # If the number equals 1 print('hi' + number) # Print hi and the number ``` ``` File "main.py", line 2 if rannumexe = 1: ^ SyntaxError: invalid syntax ``` Steps based on Gordon Zhu's [post](https://medium.com/@gordon_zhu/how-to-be-great-at-asking-questions-e37be04d0603). If you have any suggestions or feedback, post it in the comments below.
19
posted by Mosrod (189) 6 months ago
3
HTML, CSS Results Not Showing Issue
Results are not showing when I hit the run button. On the console section it keeps saying, "Please run your project before using the console." Is there anyway to solve this issue?
6
posted by wthi001 (2) 10 hours ago
6
Bitcoin Farming
Has anyone made/making a bitcoin farming game?
11
posted by coderash (41) 2 days ago
3
My game isn't executed properly # [SOLVED]
# Hello guys. ### I am a real noob in JS, so don't be angry at me just try to help! I am making a game in which the character (the red square) is supposed to go in the doors, and go out afterwards. But I encountered a problem. When I go in the door (using up arrow when by the door) and then go out (using down arrow while by the door) then the whole thing just *breaks and starts lagging and just goes crazy!* The link is [here](https://repl.it/@MarkelL/Gamem). When you get there, you have to open another window, as I made it to not be able to scroll. And, if you could give me an explanation of what happened instead of just a block of code, this would be really appreciated! # Thank you guys! ### BTW there is the code ## HTML ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>repl.it</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body scroll="no" style='overflow:hidden'> <canvas id='canvas' height='590' width='1350'> <script src="script.js"></script> </body> </html> ``` ## JS ```can = document.getElementById('canvas'); ctx = can.getContext('2d'); var x = 10; var y = 570; var left = false; var right = false; var doors = [60, 130, 239, 493, 640, 893, 1042, 1204]; var door = false; var gr; var x1,x2; var b = false; setInterval(function(){ arrowHandle(); move(); },30) function mainStage(){ var gr = door.toString(); //All the game functions ctx.clearRect(0,0, can.width, can.height) checkDoors(); draw(); doorAction(); ctx.fillStyle = 'black' ctx.fillText(gr.toString(), 100, 100) } function iN(s){ ctx.clearRect(0,0, can.width, can.height) drawDoors(s); ctx.fillStyle = 'red'; ctx.fillRect(x, y, 10, 10) ext(); } i = 0 function draw(){ //Add as needed drawDoors(60);//door 1 if (i == 0){ doors.push(60); i += 1; } drawDoors(130);//door 2 if (i == 1){ doors.push(130); i += 1; } drawDoors(239);//door 3 if (i == 2){ doors.push(239); i += 1; } drawDoors(493);//door 4 if (i == 3){ doors.push(493); i += 1; } drawDoors(640);//door 5 if (i == 4){ doors.push(640); i += 1; } drawDoors(893);//door 6 if (i == 5){ doors.push(893); i += 1; } drawDoors(1042);//door 7 if (i == 6){ doors.push(1042); i += 1; } drawDoors(1204);//door 8 if (i == 7){ doors.push(1204); i += 1; } drawPlayer(); function drawPlayer(){ ctx.fillStyle = 'red'; ctx.fillRect(x, y, 10, 10) } } function arrowHandle(){ window.addEventListener('keydown',keydown, false) function keydown(e){ if (e.keyCode == 37){//left left = true; } if (e.keyCode == 39){//Right right = true; } } window.addEventListener('keyup',keyup, false) function keyup(e){ if (e.keyCode == 37){//left left = false; } if (e.keyCode == 39){//Right right = false; } } } function move(){ if (left === true){ x -= 5; } if (right === true){ x += 5; } } function checkDoors(){ doors.forEach(function(el){ el2 = el + 25 if(x >= el && x <= el2){ x1 = el; x2 = el2; ctx.fillStyle = 'yellow'; ctx.fillRect(x1 + 5, can.height - 35, 20, can.height) door = true; } if(x < x1 || x > x2){ door = false; } }); } function doorAction(){ if (door == true){ window.addEventListener('keydown', ent, false) if (door == false){ window.removeEventListener('keydown', ent, false) } function ent(e){ if (door == true){ if (e.keyCode == 38){ gooo = setInterval(iN, 30, x1); clearInterval(street); } }else{ window.removeEventListener('keydown', ent, false) } } } } street = setInterval(mainStage,30) function drawDoors(cr){ ctx.fillStyle = 'black'; ctx.fillRect(cr, can.height - 40, 5, can.height) ctx.fillRect(cr + 25, can.height - 40, 5, can.height) ctx.fillRect(cr, can.height - 40,25,5) } function ext(){ if (x >= x1 && x <= x2){ window.addEventListener('keydown',exit,false) function exit(e){ if (e.keyCode == 40){ clearInterval(gooo); newInt = setInterval(mainStage, 30); } } } if (x <= x1 || x >= x2){ window.removeEventListener('keydown',exit,false) } } ``` ## CSS ``` canvas{ border:1px solid black; } ``` # EDIT Check it out now, it is working!
20
posted by MarkelL (4) 4 days ago
7
How does the prizing work for joint projects?
I was just thinking, as I'm working on a game with @coderash, how would the prizing work? Would the bitcoin just go to the account it was made on, then you split it between yourself, or will repl split the prize for you?
2
posted by Galamphin (50) 2 days ago
7
HTML, CSS, JS Error Pages
Say you created a new repl called, bob.repl.co (I know this wouldn't be possible, it's just an example), and in the repl you created multiple HTML files, eg. index.html, about.html, hello.html ect. If you typed in bob.repl.co/hello.html it would take you to that page. So, I was thinking it would be really cool if you could make your own customised error page, not just the one that pops up made by repl. So if you typed in bob.repl.co/jeff.html instead of it taking you to this page: ![Screenshot_2019-03-17 Not Found](https://storage.googleapis.com/replit/images/1552813924503_4bbb98669aebb1691a26917cf7b5883d.pn) It takes you to a custom error page, designed by you!
15
posted by Galamphin (50) 5 days ago
6
Repl.it work dumb question
@hayaodeh and @themaka , how does it feel to work in Repl.it? Does it have a headquarters? If so, where? Just felt like knowing.
8
posted by Lanna (19) 4 days ago
4
Database-Like File
Hi there repl.it users, I just had a question that I needed answering for a game I'm making. I would like to store the amount of points someone gets in one game in a file after someone quits the game. In addition, I would like to make this file unchangeable by any users except me. How can I do this?
9
posted by KiKUP (20) 3 days ago
2
ReferenceError: prompt is not defined
Hi there, Newbie seeking basic advice. When I try to use prompt or alert e.g. prompt("Enter passcode"); I get the following error.. ReferenceError: prompt is not defined. Any idea what I'm doing wrong ;0)
8
posted by shwaldemar (1) 2 days ago
11
Is there an actual trophy like in the picture?
Is there a awesome trophy that looks like the one in the picture next to the countdown, because If someone could 3D print it, it would be sick!
9
posted by coderash (41) 7 days ago
3
Can we have a [DogeScript](dogescript.io) language to complement LOLCODE?
Please up-vote if you want the language.
3
posted by Variable_X (2) 1 day ago
1
add XSLTProc package in Bash repl
(I'm not entirely confident that I'm requesting support in the correct place, but I don't see where else to submit this. So my apologies if I'm lost; if you know where I should go, would you mind pointing me in the right direction?) I'd like to do some XML processing in Repl.it using the Bash repl. I can see that the packages `libxml2` and `libxslt1.1` are installed, but `xmllint` and `xsltproc` are not installed. I'd love to install them, but `apt` requires administrator privileges and my repl says `sudo` cannot be found. Is there a way for me to request for packages to be added to a Bash repl?
4
posted by dnrtc (0) 14 hours ago
4
Raspberry Pi Plug-in
If there is a plugin already, ignore this, but I don't think there is and there definitely should be, upvote this post if you think there should be too!
2
posted by coderash (41) 2 days ago
6
nohup: redirecting stderr to stdout
Occasionally whenever I run any pygame repl (at least to my knowledge regardless of code) it which eventually display "nohup: redirecting stderr to stdout" and stop everything. This happens every time I make a new pygame repl, after some time. I have no idea what the problem is. This happens even if I replace all the code.
4
posted by Deacon_Cronin (5) 4 days ago
5
Does anyone use c++?
I feel like most of the people's on repl it only use python, does anyone else use c++ like me?
20
posted by ItsEmpCs (16) 9 days ago
2
HTML & CSS linking
I have an inquiry! So I want to know how to link both CSS and html so that when I use CSS it styles html but it's not working.I have tried <link rel="stylesheet" type="text/css" href="stlye.css"> but it still doesn't work. Any help would be much appreciated.
14
posted by ZControls_Games (3) 5 days ago
3
Nested IF/ While loop problem
I think I'm starting to get annoying now. Sorry. Yeah about the question, is it possible to create a "while loop" that consists of a nested if? Language: Python
12
posted by Lanna (19) 5 days ago
1
Java script lesson
im stuck on my lesson to write a new variable named 'length' then assign it the length of str. im stuck and confused for 3 days im just not understanding what to do..
6
posted by MrRichaun (0) 1 day ago
2
Python, Syntax Error in elif
https://hastebin.com/sodoqoribu.bash (Here is my code)
7
posted by DanteChiappino (1) 2 days ago
2
CNAME records, CloudFlare, Freenom, and disappointment
First of all, I set up a Freenom domain (free domain, if you want to know). I used CloudFlare to set up the CNAME records, and the target was the custom domain Repl.it allows you to set. But then, a plot twist happened: It wasn't reading the record. I've set it up perfectly with no errors. My disappointment is immeasurable and my day is ruined.
16
posted by JohnDoe29 (1) 7 days ago
1
I need help with arrays! :/
So I've got a code where the player inputs the amount of numbers for the list then will have to input the numbers for list they decided it to be. However, i manage to get the sum to add the total. It's just finding the lowest number to the largest number And I can't find anything about it.
20
posted by Wo1ves1n0 (4) 8 days ago
1
Replit C++ Running Command Line Arguments
I am having trouble running command line arguments on my C++ repl. I have managed to open the shell using command+shift+p, but when I try running the arguments, it says "permission denied." Any ideas how to fix this?
6
posted by PatrickSalas (0) 2 days ago
3
What does/is nohup.out?
I was just wondering, in Pygame what does nohup.out do/is?
3
posted by Galamphin (50) 2 days ago
6
Reference to Online Python Courses?
As @theangryepicbanana suggested for me to start a course since I'm asking a lot of questions, and Python still seems amazing but hard, I've decided to start an Online Python Course. I'm not going to go into details about Python, I'm just going to learn the basics. So sorry for beating around the bush, and sorry for disturbing everyone with my questions. One last question, does anyone have a good website that teaches Python online for free? Sorry again.
6
posted by Lanna (19) 8 days ago
2
Can you create a database with Repl?
Hello, Can you write a database with Repl? Regards
5
posted by CarrollN (2) 2 days ago
3
Repl graphics
I'm not sure what it is actually called, but repl has a feature that allows for graphics from pygame, love2d, java swing, etc.. Every time I try to use this it doesn't load and comes up with some error like 'could not load display', it was working for a bit (I had a pygame window running with some stuff loaded) but now it can't ever seem to work. Anyone know what's going on? Thanks in advance!
6
posted by DashL (8) 6 days ago
1
I need help with getting buttons to going to a page
I need help getting my buttons when I click them to go to a certain website for example to help people on stuff EDIT: HTML
14
posted by _10cps_ (0) 10 days ago
1
GAME JAM
Can you submit more than one than one repl to the game jam?
8
posted by DJWang (13) 5 days ago
1
Number in your username?
Why is there a number in your username? There is a 5 in my username, as in @Steven_The_GuyT (5) Can someone tell me what that is used for?
5
posted by Steven_The_GuyT (7) 2 days ago
2
SQLite Browser
I am teaching SQL to my students and we are using SQLite and Python. It would be great if there was a built-in SQLite browser so students could see their database tables/entries.
2
posted by mrletts (1) 2 days ago
Load more