trouble with switch case

I'm running Windows XP SP2, Java 1.6.0_11, and KoLmafia v13.3.1

So I've been trying to clean up a script I've been working on, but I think I'm using the switch case commands wrong. I'm trying to change this:

Code:
boolean stop=false;

if(item_amount($item[Asbestos ore]) < Asbestos || item_amount($item[Chrome ore]) < Chrome || item_amount($item[Linoleum ore]) < Linoleum || item_amount($item[lump of diamond]) < Diamond || item_amount($item[stone of eXtreme power]) < stonepower || item_amount($item[meat stack]) < meatstacks)
{
        (outfit ("Mining Gear") );
	if(varwall <= 54 && varwall >= 9)
		{cli_execute("mining.php?mine=1&which="+int_to_string(varwall)+"&pwd");}
}	
else
{
	print ("Miner, miner, you're quite the miner!", "blue");
	stop=true;
}

to switch case. I tried this:

Code:
boolean stop=false;

if(!stop)
{
  switch
	{
	case item_amount($item[Asbestos ore]) < Asbestos:
	case item_amount($item[Chrome ore]) < Chrome:
	case item_amount($item[Linoleum ore]) < Linoleum:
	case item_amount($item[lump of diamond]) < Diamond:
	case item_amount($item[stone of eXtreme power]) < stonepower:
	case item_amount($item[meat stack]) < meatstack:
	case item_amount($item[bubblewrap ore]) < Bubblewrap:
	case item_amount($item[cardboard ore]) < Cardboard:
	case item_amount($item[styrofoam ore]) < Styrofoam:
	if(have_outfit("Dwarvish War Uniform"))
		(outfit ("Dwarvish War Uniform") );
	else
		{(outfit ("Mining Gear") );}

	if(varwall <= 54 && varwall >= 9)
	{cli_execute("mining.php?mine="+int_to_string(mine)+"&which="+int_to_string(varwall)+"&pwd");}
        }
}	
else
{
   print ("Miner, miner, you're quite the miner!", "blue");
   stop=true;
}

but that's not working. I just learned about switch case so I'm not sure I'm getting the syntax right???
 

Bale

Minion
I don't see anything wrong with your syntax for the switch-case statement, but I can't vouch for the rest of the script. Does (outfit ("Dwarvish War Uniform") ); work? It might help someone find your error if you'd tell us what error message you get, and tell us what is on that line number.
 
Well, there's no error message the script just loops. Here's the two versions I'm working with. Miner.ash works but Minernew.ash doesn't. It seems like Minernew.ash doesn't execute the wall() function properly and that's why I thought I was misusing the switch-case statement. I put all the print statements in my counter loop to make sure the counter was working and that seems fine. What do you think?

I don't have the Dwarvish War Uniform to test (outfit ("Dwarvish War Uniform") );. Why, is that incorrect?

I get this in the gCLI:

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)

[2135] Itznotyerzitz Mine (in Disguise)
KoLmafia declares world peace.
 
Last edited:
Top