A -very- basic guide to old school scripting using CMUD
Posted: 14 Jun 2017 13:42
Area in question: The entrance (A) and four rooms (1, 2, 3 and 4) containing three guards each.
Make a simple text-file using notepad, let's call it "square.txt". For this instruction you
plan to start in room A, move east, follow the numbers and end up back where you started.
The file should look like this when you're done:
e;kill guard
n;kill guard
e;kill guard
s;kill guard
w;w;#close 1
Move or place the file directly into your cmud-directory.
Alias for starting script: start_kill_square
Command: #file 1 square.txt;#read 1
Triggers you will need:
String: died.
Command: kill guard
String: You find no such living creature.
Command: #read 1
Execution: Stand in room A and write: start_kill_square
Watch as the beauty of automation unfolds.
Explanation:
As your alias does #read 1 square.txt it will load the file into cmud's memory. #read 1 will
execute the first line in your file, in this case "e;kill guard", meaning it will move east
and kill guard. As your first guard dies, your trigger on "died." will make you attack the
next guard and so on untill there are no more guards left. The game will then echo "You find
no such living creature." and your trigger now makes cmud read the next line in the file, in
this case "n;kill guard". The rest is self-explanatory. As the last line is read, the command
#close 1 will now unload square.txt from cmud's memory.
This is what you could call the skeleton of a script, and is basically all there is to it.
A tip: Pay attention! This type of scripting will not take into consideration that someone
else may be fighting in a room, and will simply attack the guard regardless. This is considered
extremely rude and people have been killed over less. A simple #read 1 if you see someone fighting
will skip the room and proceed to the next. (hint: triggers are your friend)
Don't expect anyone to send their script, they may have put time and efforts into making it.
Make your own!
Make a simple text-file using notepad, let's call it "square.txt". For this instruction you
plan to start in room A, move east, follow the numbers and end up back where you started.
The file should look like this when you're done:
e;kill guard
n;kill guard
e;kill guard
s;kill guard
w;w;#close 1
Move or place the file directly into your cmud-directory.
Alias for starting script: start_kill_square
Command: #file 1 square.txt;#read 1
Triggers you will need:
String: died.
Command: kill guard
String: You find no such living creature.
Command: #read 1
Execution: Stand in room A and write: start_kill_square
Watch as the beauty of automation unfolds.
Explanation:
As your alias does #read 1 square.txt it will load the file into cmud's memory. #read 1 will
execute the first line in your file, in this case "e;kill guard", meaning it will move east
and kill guard. As your first guard dies, your trigger on "died." will make you attack the
next guard and so on untill there are no more guards left. The game will then echo "You find
no such living creature." and your trigger now makes cmud read the next line in the file, in
this case "n;kill guard". The rest is self-explanatory. As the last line is read, the command
#close 1 will now unload square.txt from cmud's memory.
This is what you could call the skeleton of a script, and is basically all there is to it.
A tip: Pay attention! This type of scripting will not take into consideration that someone
else may be fighting in a room, and will simply attack the guard regardless. This is considered
extremely rude and people have been killed over less. A simple #read 1 if you see someone fighting
will skip the room and proceed to the next. (hint: triggers are your friend)
Don't expect anyone to send their script, they may have put time and efforts into making it.
Make your own!