Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
6

how to erase only one line

thenullified
thenullified

hi guys. im creating the next installment of the humble story of a teapot.
i want to know if its possible to erase only certain lines like:
teapot:
support = 1
...
[1]make some potcrafts
[2]use the power of 0/0 and cause multiversal instability
[3]summon the genie using the lamp-shaped teapot
user picks 3
shows:
teapot:
support = 1
...
[3]summon the genie using the lamp-shaped teapot
you used the lamp-shaped teapot
genie: ....

and also, if anyone know how to create a backspace effect, help me too
if you can teach me how, ill add you to the game and upvote all the comments you put here.
the repl is a preview of the minigames
thanks to

@SixBeeps
@CodingCactus
@Muffinlavania
for your help!(although i havent really found a satifactory ans yet).
thanks!

2 years ago

Voters

Comments

TopNew
7
Muffinlavania
Muffinlavania

This is python right? This is how i do it:
import sys
print("Not going to be erased")
print("Is going to be erased")
sys.stdout.write('\x1b[1A') #These two lines move the cursor up and
sys.stdout.write('\x1b[2K') #Erase that line(I think)

2 years ago
7
Muffinlavania
Muffinlavania

@Muffinlavania
This just straight up deletes the lines btw, not really smoothly like the "backspace effect"

2 years ago
3
CodingCactus
CodingCactus

clear the console and don't print out that line is how i would do it

2 years ago
1
thenullified
thenullified

that would be troublesome with my code. but ill add a mention to the game anyway.

@CodingCactus

2 years ago
3
CodingCactus
CodingCactus

@starblazer
i'm pretty sure that you can't just delete lines, once they are displayed, they are displayed, maybe there is a package that does it for you?

2 years ago
2
SixBeeps
SixBeeps

@starblazer
@CodingCactus
I'd pair it with an array containing the options that have already been used, and only print each option if they are not in the array.

2 years ago
1
thenullified
thenullified

i have completely no idea how to do [email protected]

2 years ago
1
thenullified
thenullified

here are the mentions in my sequel:


@SixBeeps
@CodingCactus
@Muffinlavania

('+m', '+m', '', 'attempt to reverse-engineer Muffinlavania's turtle onkey() into a 3d printer'),
('+s', '+s', '', 'Find the CodingCactus and get his encoded cacti encyclopedia'),
('+t', '+t', '', 'get the unsanitzed 15 cents from SixBeeps since its 3 nickels too many'),

2 years ago
1
thenullified
thenullified

this is the raw source code

2 years ago
Load more