HALP. Troubleshoot my simple script?

I have a simple script to request buffbot buffs, and today it stopped working. What the heck am I doing wrong? AFAIK I have not changed this script recently.

PHP:
script "getBuffbotBuffs.ash"

import <zlib.ash>

// Get buffs from Binary
cli_execute("csend 4 meat to binary");

// Get buffs from Buffy
kmail("buffy", "20 Ode to Booze", 0);

As-is, I get Script parsing error (getBuffbotBuffs.ash, line 6) - cli_execute().
If I comment that line, I get Script parsing error (getBuffbotBuffs.ash, line 9) - kmail(), from zlib.ash.

I have:
  • Tried a new hourly build (13460)
  • Tried a new daily build
  • Checked out zlib again manually

I'm prepared to look like a total idiot when someone points out my missing semicolon.
 
Last edited:

Razorsoup

Member
I'm not an ASH expert but have you tried putting a semicolon after the "script" and "import" lines?

Edit: I just copied and ran your code on my machine and it worked without any errors. I'm running r13460 on Windows XP.
 
Last edited:
Thanks for the tip, Bale. I didn't know how to do that. For anyone else reading, you can even more precisely replicate my original code by including the turncount:
PHP:
cli_execute("send to buffy || 20 Ode to Booze");
That said, I like my original kmail() solution because it means I can get a ton of buffs in one kmail, instead of one message per buff. (Pending getting this script working again).
 

lostcalpolydude

Developer
Staff member
My guess would be some weird whitespace issue, which likely wouldn't make it to your forum post after copy-pasting.
 
My guess would be some weird whitespace issue, which likely wouldn't make it to your forum post after copy-pasting.
Not a bad thought. Hoping that might be the key, I:

  • copied my own code from the forum and pasted it over my existing code
  • backspaced my existing code and re-typed it
  • deleted the .ash file entirely, started with a clean Notepad doc, re-created and re-saved it
None of the above fixed the issue. I still get Script parsing error (getBuffbotBuffs.ash, line 6).
 

Bale

Minion
started with a clean Notepad doc, re-created and re-saved it

I remember someone else having an unreproducible error. It turned out that notepad was saving his document with UTF-8 encoding instead of ANSI. You might want to check that.
 

xKiv

Active member
Did Notepad decide to save the file with a BOM for some reason?

Anyway, I would try adding semicolons to the "script" and "import" lines and seeing if that at least changes which line reports an error.
(I checked a couple scripts just now and they use script "filename.ash"; and import <whoosh.ash>; with semicolons, so I expect that adding the semicolons won't introduce new errors).

(ETA: ninja'd by Bale on the BOM issue while I was checking my semicolon privilege)
 
I remember someone else having an unreproducible error. It turned out that notepad was saving his document with UTF-8 encoding instead of ANSI. You might want to check that.
It's saving with ANSI encoding. That said, maybe I've got a more insidious problem along those lines. Would someone mind uploading a copy of my script that works for them? (You could change the specific messages so as not to waste your buffbot uses if they're important to you). Then I can see if it's just my native copy that's bad for some reason.
Did Notepad decide to save the file with a BOM for some reason?

Anyway, I would try adding semicolons to the "script" and "import" lines and seeing if that at least changes which line reports an error.
(I checked a couple scripts just now and they use script "filename.ash"; and import <whoosh.ash>; with semicolons, so I expect that adding the semicolons won't introduce new errors).

(ETA: ninja'd by Bale on the BOM issue while I was checking my semicolon privilege)
Adding semicolons to both of those lines changes the error to Script parsing error (getBuffbotBuffs.ash, line 3) (the import line). So it looks like the script line works fine with a semicolon, but not the import.
 

Veracity

Developer
Staff member
I took the script you posted.
I saved it as "something.ash".
I told KoLmafia to "validate something.ash"
No problems.

There are no syntax errors in your script that the current KoLmafia has anything to complain about.

I have no idea what your problem is - but it is something to do with your particular system, rather than your script, as posted, or in KoLmafia itself.
 
Well, I figured it out. It took me nuking my whole Mafia installation and re-installing, but I figured it out.

When I used to run this script, I'd get the message "Changing "tavern cellar" to "The Typical Tavern Cellar" would get rid of this message (zlib.ash, line 648)". So a couple days ago, I did just that - changed line 648 of my zlib.ash.

For some reason, when editing that file in particular, Notepad wanted to encode with UTF-8 rather than ANSI.

So re-downloading zlib.ash and re-editing line 648 but making sure to encode in ANSI fixed the problem.

As a non-expert it seems weird to me that this originally produced an error on line 6 of my code, which doesn't even use zlib. But what do I know?

I guess credit goes to Bale on this one. I never would have had an eye on the encoding scheme if not for him! But thanks everyone for the help. I was just about out of hair to pull.
 
Top