Get Underground! (Digital Underground Potion farming)

Khay

New member
Ok, getting this error:

Else without if (mole.ash, line 10)

Don't see any unassociated else commands, myself...
 

Camber

Member
Ok, getting this error:

Else without if (mole.ash, line 10)

Don't see any unassociated else commands, myself...

Found it, a couple of missing brackets. To Maintain your style, add a open bracket to this line: retrieve_item(1, $item[green smoke bomb]); }
to look like this: { retrieve_item(1, $item[green smoke bomb]); }

And then add another close bracket to the end of the usegong() function

PHP:
void usegong()
{
	if (my_adventures() < 12)
		{print("Not enough adventures to get another potion. Stopping."); exit; }
	else
	{
		if (item_amount($item[llama lama gong]) == 0)
			{print("No more gongs! Aborting."); exit; }
		else
		{
			if (item_amount($item[green smoke bomb]) < 3)
				{retrieve_item(1, $item[green smoke bomb]); }
			else
				{set_property("choiceAdventure276","2"); use(1, $item[llama lama gong]); }
		}
	}
}

Are you using a coding editor? it helps by matching { } pairs for you and color-codes commands. I and many others use Notepad++ and Bale created an user-defined ASH language pack for it. Here is a forum discussion and how to use it.
 
Last edited:

Spiny

Member
Just a minor nitpic for future reference Khay, when pasting in your blocks of code, please enclose it within code tags so it looks easier on the eyes like in the others' posts. Thanks :)
 

Khay

New member
Camber - thanks a ton! Lol... the only "editor" I am using is Notepad.exe :p I don't actually do much (or really ANY) programming; I understand it, and am pretty good at it once I learn the syntax for whatever particular language, but I do other things for fun, usually, instead of this :)

Spiny - sorry :D I noticed what they were doing, but not HOW, so I just posted. I'll search around and figure it out if I need to post more code, though. :)
 

Khay

New member
Alright, crud. New error was:

main method must appear at top level (mole.ash, line 40)

I looked carefully at the script, and decided "to heck with it", and just to at least test it out, got completely rid of both the checkuse and main sections, and added another bracket to the end of the molehill part, as it needed it. Then, wonder of wonders, it loaded the script! Woo-hoo!

Ummm... at this point, I realized I am a complete idiot/noob, because...

Ok, once the script is loaded, how do I RUN it? I cannot find anything that says "run script(s)"... yeah.
 

heeheehee

Developer
Staff member
All right. Since throw_item() returns a buffer, the relevant bit of code to see if it throws the item or not... would be:
PHP:
while(throw_item($item[green smoke bomb]).contains_text("Looks like that one was a dud.")) {
    print("Failed to run away. Using another green smoke bomb");
}

Running it is as simple as placing it in your \mafia\scripts directory, then running the script via the Scripts dropdown, where it should appear (Try refreshing the menu if it isn't there).
 
Last edited:

Spiny

Member
Spiny - sorry :D I noticed what they were doing, but not HOW, so I just posted. I'll search around and figure it out if I need to post more code, though. :)

Code blocks are merely pasting what you have and preceding it with the word code enclosed in square brackets [] and ending the block with /code also enclosed in square brackets.
 
Last edited:

that_bloke

New member
Sorry for the necro, but I tried using this script and couldn’t get it to work..
I msg’ed the OP about 2 weeks ago and didn’t get any info... Could someone help me resurrect it so I can do some Und.Potion farming... thanks!
 

Bale

Minion
So many possible errors without any information that it is hard to know what the problem is. Should we start gambling about what his error was? My bet is that he used a text editor that added formatting characters.
 

that_bloke

New member
Sorry for that! I really thought I was missing something (like copy the code into this ‘nifty program’, press play, and get an .ash output to be used to kolmafia) because I used TextEdit (OS X) to basically copy/paste the block of text and run it in Kolmafia.

The output I get is: Script parsing error (Underground.ash.txt, line 1)

The file is in my Scripts folder and it’s called Underground.ash. Other scripts, which have been edited for little things (i.e. the SlimeTube one) are recognized even though it states Slime.ash.txt in kolmafia.
 

Bale

Minion
The output I get is: Script parsing error (Underground.ash.txt, line 1)

Yay! I win the bet!

The problem is that you copy-pasted the script into a text editor that adds formatting characters. Use a text editor that only handles plain text and is incapable of formatting.
 

Theraze

Active member
Depressingly, when you get that message, you usually have to open the script in a hex editor and remove the 3 weird characters at the front of the file. Not sure what causes it, but I've been having it happen with BatBrain fairly consistently for the past week or three.

It's not just editors capable of formatting... Windows Notepad (not Notepad++) doesn't format, but had been causing this for me.
 

that_bloke

New member
Huh. I'd thought that notepad was safe even though wordpad was a bust. OS X will run notepad++, right?

Ughhh.. I wish I was this ^ smart to have figured it out.

Notepad++ will run but under a Win Environment... I’ll get a hex editor and see if the way suggested by Theraze fixes the issue. All in all, thanks for the input all!

Ok, downloaded Hex Fiend, tried to remove the 3 characters added and got another message.. went over again at the code the OP posted and copy/pasted it into Hex Fiend and now it works.. like a charm!
 
Last edited:

roippi

Developer
I'm sure OSX comes with at least one of VI(m)/emacs/nano/pico. In the future you can use one of those.
 

Ethelred

Member
Get TextWrangler from Bare Bones Software. It's a great free programmer's text editor for MacOS X. Will even find those nasty little gremling characters for you.
 

Pyren

New member
Actually, none of those solutions are really necessary in OS X. Opening the script in Textedit, simply go to Format -> Make Plain Text. Then File -> Save As... and add .ash to the filename. It should prompt you to make sure that you really want to use .ash as the file extension, simply click .ash in the prompt box and you should be good to go.

In the future, you can set your Preferences for TextEdit to default to plain text instead of rich text. It's under the menu TextEdit -> Preferences... -> New Document - Format.

Having done that, I was able to use the script successfully, no parsing errors left.
 
Top