Softcode

From Serenity : The Wiki
Jump to: navigation, search

The MUSH allows you to make commands of your own. This is often termed 'softcode'. There are any number of reasons you might want to create new commands:

  • you don't like typing the current command: +mkt/sell <number> <commodity>=<ship>/<code> can be reduced to msell <commodity> if you always use the same ship and always ship a full load.
  • you want to string together multiple commands: +wield <weapon> & +toggle <mode> can be reduced to arm <weapon> <mode>
  • you want to automate something: going from outside your ship to the flight deck, turning on all the systems on your ship, and other activities can be reduced to a single command.

Before You Start

Your character needs to be set to allow soft coded commands:

 @set me=!NO_COMMAND

This removes the block that is placed on your character by default.

 @lock/command me=me

This locks your command structure so only you can trigger them. Without this, your commands are usable by anyone, but they still act as if you initiated them.

Basics

 Example 1:
 &cmd`arm me=$arm */*:@fo me=+equip %0;@fo me=+toggle %1

We'll break this down one step at a time:

  • '&cmd`arm' - This section says create a reference for our new command. Each command should start with &cmd`<reference>, where reference is related to the command. 'arm' is the full name for our command, but we could use 'ready_wpn' or any other reference.
  • 'me=' - this says, this command is attached to me. It could be any object, but you have to own the item first, and all serenityMUSH items except characters are owned by the system - so effectively, 'me' is the only thing that will work for the average player.
  • '$arm' - the command's name is 'arm'. The dollar sign is very important, skip it and your command will not work.
  • ' */*' - this says that after 'arm', there will be 1 space followed by some text, a '/', then more text.
  • ':' - this divides what you type from what the command does.
  • '@fo me=+wield %0' - this is "act like I just typed in +wield and the first block of text."
  • ';' - this separates multiple commands in a compound command.
  • '@fo me=+toggle %1' - this is "act like I just typed in +toggle and the second block of text."

So when we're all done, we can type 'arm Ruger/semi' and it will behave just like you typed in:

 +equip Ruger<enter>
+toggle semi<enter>

When you are creating the command, remember everything between the '=' and the ':' is required to be typed. If you put '$command * = */*' and type in 'command bob=apple/wash' it won't work because your command is missing the spaces before and after the '='. Also remember that the text blocks are numbered from 0 not 1 and you can have up to 10 blocks of text: %0 - %9.

 Exmple 2:
 &cmd`armr me=$armr:@fo me=+wield Ruger;@fo me=+toggle semi;

This command is essentially the same, except it always performs the same action. Typing 'armr' will always arm your Ruger and set it to 'semi'. This is helpful if you only use 1 weapon, however it's often used for stringing together several commands that never change - such as powering on all the systems of a ship. The important thing to note is that there is no space between '$armr' and the ':'. If you accidentally put one there, the system will not execute your command because it is expecting a single space following the 'armr'.

If you wanna do more complicated stuff, typing 'help function list' and 'help user-defined' from in the MUSH will take you to help pages that'll be a good starting point for learning how to write these commands. There's also a code channel you can ask questions on.


There are several commands on the softcode commands page that are ready to be copy-pasted and used.