Hi there is there a message edit command so you can edit messages you have already written
HI there I am making a fantasy levitation system and I really want to try and use a command which lets me edit a message that is already in the console
There was one which said you could use
Which does not work
Thanks Levi H
@hockneyle19 Woah there slow down, how did you manage to get your hands on Discord-like code then? What you provided was coincidentally really close to how Discord.js handles message editing.
Anyways, to understand how to change text in the console, you first have to understand how the console works. As is obvious enough, the console is a large grid and each cell in this grid holds characters. When you print some text, the terminal puts its contents on the row that it's looking at, then goes to the next row.
This is not too far off from how, say, a typewriter works. When you want to type a line onto the paper, you'd simply type the characters you want, hit the newline key, then reset the paper position so that when you go to type more text later, you start from the left.
Now, to change the printing position (in computing terms, this is called moving the cursor) you need to use an ANSI escape code. Those let you send commands to the terminal by printing a special sequence of characters.
Here's a simple method that handles that for you:
Now, to edit something you've printed, first move the cursor to wherever that text is in the terminal, print something, then move the cursor back to its original place.