HakerScript

From Esolang
Jump to navigation Jump to search

HakerScript is an esoteric language made by User:Provitia for esolang jam hosted on Truttle1 Discord Server. It's intended to be both confusing and readable at the same time.

Basics

HakerScript is an 1D language, like C, Java or Python. Commands are separated by line breaks and all literals/keywords are separated by space like that:

commandname argument

The twist is that you only have two commands - install and uninstall. Install is used to include more commands called "packages" and uninstall is used to delete an existing command (even if it isn't package). All packages are listed in section 2. Here's how you can install a package:

install "packagename"
uninstall "packagename"

Note that 'install' command pauses program by 4 seconds, while 'uninstall' pauses it by 1. There are only 3 datatypes - integers, strings and None which can only be returned by few packages. String literals are defined using double quotes but not single quotes

Package reference

Now when you know basic syntax, let's take a look at all the packages

Package table
Package name Usage Return type Description
newline newline None Prints a new line
show show <literal> None Prints a text without writing new line
input input Integer Returns a number user entered
inputstr inputstr String Returns a string user entered
bruteforce bruteforce <variable name> <literal> Any Pauses the program from 1 to 5 seconds randomly and assign value to variable
ping ping <variable name> Any Pauses program for 1 second and returns variable value
sum sum <literal> Any Returns sum of literal given and last value bruteforced. If there's no last value, simply return literal
negate negate <integer> Integer Returns -integer
goto goto <integer> None Jumps to line with number of integer given. If the line number is smaller than 1 or bigger than total line count, end the program
check check <literal> None Checks whether literal is 0. If not, jump to the line with number of current line number doubled, otherwise continue as usual
silence silence None Toggleable. Disables all prints caused by "install" and "bruteforce". Pauses program for 5 seconds when used
turtlejam turtlejam None Toggleable. You now can't use number literals, instead you should type "turtle" amount of times you want the number to be (e.g. turtleturtleturtle for 3, use noturtle for 0)

Stuff you should know

  1. Variable names must be in V4 IP format.
  2. You can use other commands instead of arguments for example (e.g. show negate 2 prints -2)
  3. Each package installed slows down execution of one command by 0.1 seconds (that's why uninstalling might be important for optimising!)

Code samples

Hello world!

install "show"
show "Hello world!"

Truth machine

install "check"
install "show"
install "bruteforce"
install "input"
install "ping"
install "goto"
show "Enter either 0 or 1: "
bruteforce 127.0.0.1 input
check ping 127.0.0.1
goto 9999
show ping 127.0.0.1
goto 11





goto 11

Note that if you enter '2' for example, the program will print 2 indefnitely instead of 1. It's easily fixable by changing

show ping 127.0.0.1

to

show 1

99 bottles of beer

install "show"
install "sum"
install "negate"
install "goto"
install "bruteforce"
install "ping"
install "newline"
install "check"
bruteforce 127.0.0.1 99
check ping 127.0.0.1


show "No more bottles of beer on the wall, no more bottles of beer."
newline
show "Go to the store and buy some more, 99 bottles of beer on the wall."
goto 9999



show ping 127.0.0.1
show " bottles of beer on the wall, "
show ping 127.0.0.1
show " bottles of beer."
newline
show "Take one down and pass it around, "
bruteforce 255.255.255.255 negate 1
bruteforce 127.0.0.1 sum ping 127.0.0.1
show ping 127.0.0.1
show " bottles of beer on the wall."
newline
goto 10

Note that this code also puts a bunch of logs of bruteforcing and installing packages. You can use package 'silence' to stop this.

Implementations

So far there's only implementation by User:Provitia which isn't very accurate and needs further improvements. https://pastebin.com/9wiweyFJ (sorry for its quality, i was kinda lacking time)