Bug Numerous problems with command syntax instructions

jseagull

New member
Hello,

This isn't exactly a "bug," but I didn't see a better category in which to post this. It's an issue with the information on the site. If this doesn't belong here, please feel free to move it.

Today, I was trying to find out how I could use a command to request a buff from Buffy through the cli, and therefore be able to use it in a basic script. Couldn't find one, so my next thought was to see if there is a way to send a player a private message via cli, since Buffy is able to work with chat pms. I came across some pages here that seemed like they were what I was looking for, but no matter what I tried, I couldn't get any of the options to work, and I couldn't figure out what I was doing wrong. I am not a coder, but I can definitely follow instructions, and I tried to make sure I followed everything exactly.. to no avail.

Eventually, I reached the point of spamming variations into the cli until something worked. The command I had been trying to use -- chat_private( string, string ) -- Only worked when a blank space was added between the command and the first parenthesis, like so: chat_private ( buffy, 25 ode ) . This was confusing, since every example of similar commands I had been trying were all formatted to have the command touching the parenthesis with no blank space in between.

I thought to myself, well, maybe this command isn't meant to be entered into cli this way, maybe this is how you're supposed to use it in a script? I made a two-line script testing whether the "with space" or "without space" version would work in a script. Only the "with space" version worked. I tried other commands. chat_clan? Same thing. use_skill? Yup...

That was when I went from confused to just kind of frustrated to realize that I had been going at it for an hour trying to understand what I was doing wrong, when it seemed like there was actually some kind of widespread error that ended up in all the instructions I had been looking at.

I encountered this problem throughout many pages I had explored to try to understand how this is supposed to work. Here are just a few of the ones I was trying to work with:

After adding the white space between the command and the parenthesis symbol, in each case, I found that the commands were able to be used successfully in the cli and in basic plain text scripts. So why do all the instructions indicate no space there? What's happening here? As I said, I am not a coder, but if I had to guess, it looks like maybe there were lists of commands that got copy/pasted from somewhere, and in the process, they lost the space that belongs there? maybe?

Anyway, long story short: I super appreciate all of you who have come together to make this fantastic tool, but as someone with limited coding skills, I have no way of easily knowing whether something is not working because of a me-mistake or a you-mistake. I also think this site and the kolmafia tool are a really cool way for people to learn a bit about coding, but I could definitely see how a less persistent person than myself would just get frustrated and give up on trying after an experience like this. It might save someone else a future headache if these errors were corrected, and avoid scaring people away from trying to learn this stuff. Thanks a bunch. :)
 
Last edited:

heeheehee

Developer
Staff member
This isn't a typo -- this is a distinction between typing commands into the CLI, and running an ASH script.

The former is intended as an interactive experience. Notably, all built-in ASH functions are available in the CLI as if via `using`, so you could type something like
Code:
> mp_cost saucegeyser
24
which would use the mp_cost ASH function.

Note that if you create a .txt file, you can list CLI commands directly. If you instead save the file with the .ash extension, then Mafia will interpret it as an ASH script, which allows you to define more complex logic (e.g. functions of your own) and uses the syntax listed on the wiki pages (since those were initially intended as an ASH reference). As of some years ago, there's also the option to use JavaScript with .js files.
 

heeheehee

Developer
Staff member
The simplest way to use ASH directly in the CLI is to prefix your command with `ash`:
Code:
> ash chat_private("Buffy", "25 ode")
Returned: void

If you don't care about the return value of the command (or sequence of commands), then you can use `ashq` to suppress that line.
 
Top