QuakeScript
Jump to navigation
Jump to search
QuakeScript is a language made by WoodyFan3412
in this language there are commands, they're alot like the commands in games like half-life
Syntax
the first "word" is the command name, anything after that are the command arguments
quotation marks are used to group multiple words
use the backslash character to put quotation marks in a string
semicolon is used for putting multiple commands in 1 line
echo "Hello World" // this is a comment echo "hello, this message contains \" quotations \" " echo "apple"; echo "is a"; echo "fruit" echo Hello set "Hello, World!" echo theta
Commands
This is a list for all the console commands:
Command Name | Arguments | Function | Example |
---|---|---|---|
quit | quits everything. | ||
exit | does the same as quit. | ||
echo | <text> | prints the text to the console | |
show_console | shows the Console | ||
hide_console | hides the Console | ||
clear | clear the entire console | ||
wait | <seconds> | wait a certain amount of seconds | |
input | <message> | basically just the "prompt" function in javascript, asks the user for input and stores it in the Theta variable | input "Type any number" |
getkey | <keyname> | sets the "theta" variable to 1 if the key is pressed, 0 if the key isin't pressed | getkey "a" |
jmp | <label> | jumps to a certain label and also sets the return address, if the arguement is a number, it jumps to that index in the code instead. | jmp "#MyFunction" |
jze | <label> | same as jmp, but it only jumps to the label if "theta" is set to 0 | |
jnz | <label> | same as jmp, but it only jumps to the label if "theta" is NOT 0 | |
assert | <bool> | Works the same as the assert function in alot of other languages. if this value is 0, then it throws an ERROR | |
return | jumps back to the return address | ||
getkey | <keyname> | sets the "theta" variable to 1 if the key is pressed, 0 if the key isin't pressed | getkey "a" |
set | <value> | sets "theta" to the new value | |
add | <value> | adds value to the "theta" variable | |
sub | <value> | subtracts value from the "theta" variable | |
mul | <value> | multiplies the "theta" variable by this value | |
div | <value> | divides the "theta" variable by this value | set "30"; div 2 |
join | <string> | adds this string to the end of the "theta" variable (String Concat) | set "Hello, "; join "World!" |
inc | adds 1 to the theta variable, same as "add 1" | set 15; inc | |
dec | subtracts 1 from the theta variable, same as "sub 1" | set 17; dec | |
mod | <value> | a modulus operator | set 53; mod 2 |
write | <index> | writes "theta" to this index in the memory | set 15; write 1 |
read | <index> | gets this value from the memory and sets "theta" to it | read 1; echo "theta" |
Examples
Hello World
echo "Hello, World!" // output: Hello, World!
Math
set "15" add 30 add 45 echo "theta" // Output: 90
Naughty or Nice
input "Type a number, it can be 0 or 1." // if it's 0, jump to the "naughty" label jze #naughty // if not, then jump to "nice" jmp #nice #naughty echo "you are NAUGHTY! >:(" quit #nice echo "you are NICE! :D" quit
Loop
// a loop, it starts at 1 and counts to infinity set "0" jmp #loop #loop // add 1 inc // print the value echo "theta" // jump to the loop, causing it to repeat again jmp #loop // Output: 1 2 3 4 5 6 7 8 9...
Data Storage
// by default, there's a memory limit of 3000 (3 kilobytes), since the memory is finite QuakeScript is technically not Turing-Complete set "something unreal" write "1" set "another thing" write "2" // anything that is read is stored in the "theta" variable read 1 echo theta // output: "something unreal"
99 bottles of beer
jmp #init #init // how many bottles // change this number to increase or decrease the length of the song set 99; write 1 jmp #loop #loop // read from the memory, and store it in the "theta" variable read 1 join " bottles of beer on the wall," echo theta read 1 join " bottles of beer!" echo theta echo "take one down, pass it around." read 1 dec write 1 // do the final verse if bottles is 1 dec jze #finalverse inc join " bottles of beer on the wall!" echo theta // jump to the loop, causing everything to repeat jmp #loop #finalverse // there is a final verse here because it's not correct to say "1 bottles of beer on the wall" echo "1 bottle of beer on the wall!" echo "1 bottle of beer on the wall, " echo "1 bottle of beer!" echo "take it down, pass it around" echo "no more bottles of beer on the wall!" quit
Truth Machine
input "Enter any number" jze #end jmp #loop #end echo "0" quit #loop echo "1" jmp #loop
Cat Program
input "Enter Anything" echo theta