Command Line
A Simple command line!
Features
This app provides the starting code for your own command line creations
It also has 2 built in commands help
and clear
Adding New Commands
Adding in new commands is not difficult at all!
var name = event.key;
var code = event.code;
if (code == 'Enter') {
let command = document.getElementById("command").value
if (command == 'YOUR COMMAND') {
//What you want your command to do!
}
}
It is as simple as that!
Let's break down the code and take a closer look.
First we are declaring 2 different variables
var name = event.key;
var code = event.code;
You can look at the name
variable as the name of the key that was pressed and the code
is the codename of the key that was pressed
We use this data to see when the enter
key is pressed so that we know when to trigger the code.
Next we are using an if
statement to see of the code
of the key that was pressed is equal to enter
if it is then we will get the value from the command line input and set that as a variable
from there we are comparing the command
variable (the user input) to your command. if is it TRUE
(the command is equal to the other command)
then it will run the code inside the if statement
And that is it! Super simple!!
Handling Errors
If you do encounter an error with this app please feel free to ask on the Autocode discord server!
This app comes AS IT without any warranty.
Credits
Made By: Magma69
Discord: @rr41#8118