CommandCraft is a text-based game that allows users to create and execute custom commands. It is a fun and interactive way to learn about command execution in a programming context.
- Replit: Play CommandCraft
- GitHub: Source Code
CommandCraft is licensed under the MIT License. The source code is freely available, and you can modify and distribute it under the terms of the MIT License.
- $createcommand [name] [code]: Create a custom command with the given name and code.
- Example:
$createcommand greet print("Hello, world!")
- Example:
- $echo [message]: Print the given message.
- Example:
$echo Hello, world!
- Example:
- $commands: Show all custom commands.
- Example:
$commands
- Example:
- $input [prompt]: Prompt the user for input and display what they entered.
- Example:
$input What is your name?
- Example:
- $help: Show the help message.
- Example:
$help
- Example:
-
Starting the Game:
- Run the game on Replit: Play CommandCraft.
- You’ll see a welcome message and can start typing commands.
-
Creating a Command:
- Use
$createcommandto define a new command. - Example:
$createcommand greet print("Hello, world!") - This creates a command
greetthat, when executed, prints "Hello, world!".
- Use
-
Executing Commands:
- Type the name of your custom command to execute it.
- Example:
greet(after creating it with the above example).
-
Echoing Messages:
- Use
$echoto print any message. - Example:
$echo Hello, world!
- Use
-
Listing Commands:
- Use
$commandsto view all custom commands you’ve created.
- Use
-
Taking Input:
- Use
$inputto prompt the user for input. - Example:
$input What is your name? - The input will be displayed after the prompt.
- Use
-
Getting Help:
- Use
$helpto display the help message with a list of available commands.
- Use
CommandCraft includes error handling to catch and display errors that occur during the execution of custom commands. If you attempt to execute an undefined command, you will see an error message prompting you to check the available commands using $help.
> $createcommand greet print("Hello, world!")
> greet
Hello, world!
> $echo This is CommandCraft
This is CommandCraft
> $input What is your favorite color?
What is your favorite color?
You entered: Blue
> $commands
greet: print("Hello, world!")
You can find the source code on GitHub: Source Code.
Feel free to fork the repository, make improvements, and submit pull requests. Report any issues or bugs via the GitHub issues page.
- GitHub: @calestial_ashley
- Display Name: Calestial Ashley
Enjoy playing CommandCraft and exploring the possibilities with custom commands!