Happy Medium drinks via Consult Script

mstieler

Member
Alright, so Bale pointed me over this way and gave me the start of what I'm hoping will alleviate issues with trying to farm up Medium drinks while on autopilot. I tweaked it a bit, and added the skill use to it.

Code:
boolean happiermediumdrinks() {
   if(my_familiar() != $familiar[happy medium])
      return false;
   if($familiar[happy medium].image == "medium_3.gif")
      return true;
   return false;
}

void main(int initround, monster foe, string page) {
use_skill($skill[Siphon Spirits]);
}

Bale had the happy medium image bit set with
Code:
if($familiar[happy medium].image == "medium_2.gif" || $familiar[happy medium].image == "medium_3.gif")
Which, I think, will return the orange aura or red aura drinks, though I'd prefer to stick to red aura, as they edge out the orange ones a bit.

And if I'm reading the CCS/Consult part of the Wiki, all I'd need to add to my CCS would be
Code:
[ default ]
consult happiermediumdrinks.ash
{rest of CCS stuff goes here}
I'm not certain, but I think I can put "early" actions ahead of the consult part, like pickpocket, throw shield/noodles, Rain-Doh blue balls, etc, but, as I haven't worked with Consults in CCS before, I'm not certain it works that way.

So, halp/feeback please?
 
You can put that sort of stuff before (or you could add them to your script as well). Also, you main needs to call the boolean function if that is going to have any effect on what the script does...
 
You can put that sort of stuff before (or you could add them to your script as well).
Kay, good to know.
Also, you main needs to call the boolean function if that is going to have any effect on what the script does...
I thought I was calling the boolean with the first line
Code:
boolean happiermediumdrinks() {

Is there something else I need?
 
PHP:
boolean happiermediumdrinks()
{
     // stuff
     return something;
}
Here you are defining the function. You need to use it somewhere, like this:
PHP:
void main(int initround, monster foe, string page)
{
     if ( happiermediumdrinks() ) use_skill($skill[Siphon Spirits]);
}
This means: if happiermediumdrinks() returns true, use Siphon Spirits.
 
I gotcha now. Also, is it necessary to set the first part
Code:
if(my_familiar() != $familiar[happy medium])
as a "!=" and return false, or can it work just off the
Code:
if($familiar[happy medium].image == "medium_3.gif"
part, unless Comma Chameleons, Doppelshifters and familiars Wardrobed into Happy Mediums not affect the medium's image?
 
You can simplify even more by doing:
PHP:
boolean happiermediumdrinks()
{
   return ( $familiar[happy medium].image == "medium_3.gif" );
}
 
That works as long as you never put away the happy medium while it's charged. If you want it to be compact and more resilient,
PHP:
boolean happiermediumdrinks()
{
   return ( $familiar[happy medium].image == "medium_3.gif" && my_familiar() == $familiar[happy medium] );
}
would work.

You could put the rest of your CCS into the consult script, but things in a consult script can't be made into a KoL macro. If you have several actions in your CCS, combat will go a lot faster by not moving them into the script.
 
Oh right, what I meant was:
PHP:
boolean happiermediumdrinks() 
{ 
   return ( my_familiar().image == "medium_3.gif" ); 
}
 
Per slyz request in chat, my all-around CCS:

Code:
[ booth slime ]
item bottle of Gü-Gone

[ default ]
try to steal an item
try to steal an item
skill throw shield
skill entangling noodles
skill feed
if hascombatitem rock band flyers
    item rock band flyers
endif
skill release the boots
if hasskill moxious maneuver
    section moxious maneuver
endif
if hasskill saucegeyser
    section saucegeyser
endif
if hasskill weapon of the pastalord
    section pastalord
endif
skill shieldbutt

[ fan slime ]
item bottle of Gü-Gone

[ moxious maneuver ]
skill moxious maneuver

[ mutated alielephant ]
if !haseffect On the Trail
    skill transcendent olfaction
endif
section default

[ pastalord ]
skill weapon of the pastalord

[ pirate ]
if hascombatitem 2947
    try to steal an item
    try to steal an item
    skill throw shield
    skill entangling noodles
    item The Big Book of Pirate Insults
    skill shieldbutt
endif
section default

[ saucegeyser ]
skill wave of sauce
skill saucegeyser
skill saucegeyser

[ shieldbutt ]
skill shieldbutt

[ tomb rat ]
if hascombatitem rock band flyers && hascombatitem tangle of rat tails
    try to steal an item
    try to steal an item
    item rock band flyers, tangle of rat tails
    skill throw shield
    skill entangling noodles
    skill feed
    skill shieldbutt
endif
section default

[ vendor slime ]
item bottle of Gü-Gone

Edit: Can I set the consult script to return false if I have fewer than say, 20 adventures remaining? I think that would get around the "putting away while charged" bit.

Editedit: I just needed to look further on the wiki for my_adventures()
 
Last edited:
Here is an untested consult script:
PHP:
string to_macro( skill sk )
{
	return ( have_skill( sk ) && my_mp() > sk.mp_cost() ) ? "skill " + sk.to_int() + ";" : "";
}

string to_macro( item itm )
{
	return ( item_amount( itm ) > 0 ) ? "use " + itm.to_int() + ";" : "";
}

boolean happiermediumdrinks()  
{
	return ( my_familiar().image == "medium_3.gif" );  
}

string generate_macro()
{
	string macro;
	macro += "pickpocket;";
	macro += "pickpocket;";
	macro += to_macro( $skill[ throw shield ] );
	macro += to_macro( $skill[ entangling noodles ] );
	macro += to_macro( $skill[ feed ] );
	macro += to_macro( $item[ rock band flyers ] );
	macro += to_macro( $skill[ release the boots ] );
	if ( happiermediumdrinks() ) macro += to_macro( $skill[ Siphon Spirit ] );
	foreach sk in $skills[ moxious maneuver, saucegeyser, weapon of the pastalord, shieldbutt ]
	{
		if ( sk.to_macro() != "" )
		{
			macro += sk.to_macro() + "repeat;";
			break;
		}
	}
	return macro;
}

void main( int initround, monster foe, string page ) 
{
	visit_url( "fight.php?action=macro&macrotext=" + generate_macro() );
}

I'm not sure about things like have_skill( $skill[ feed ] ), but you can test that by equipping the fangs and executing this line in the gCLI:
Code:
ashq import <consult_script.ash> generate_macro().print()
If you see "skill 7116" appear, then it should work.
 
With the Fangs & OPS equipped, running that gave me:

pickpocket;pickpocket;skill 7114;skill 3004;skill 3008;repeat;

So it doesn't look like it would use Feed

Edit: testing it out didn't use Feed, just Throw Shield, Noodles, then Weapon of the Pastalord

Edit 2: With Fangs equipped, but no OPS, it still gave me the above readout, which seems strange.

Edit 3: Could I use my CCS for Pickpocket through feed, remove those lines from the Consult script, have the CCS use the script after Feed, and go from there, since Feed appears to be the sticking point for it?

Edit numero quatro: OK, so my_adventures() may not work, as I'll still have the familiar out. Would that need to be part of a mood then? If I have under 20 adventures left, I can't adventure with the Medium out?
 
Last edited:
This version uses BALLS' "hasskill" predicate instead of relying on Mafia's have_skill().
PHP:
string to_macro( skill sk, string cmd )
{
	return "if hasskill " + sk.to_int() + " ; skill " + sk.to_int() + "; " + cmd + " endif;";
}
string to_macro( skill sk ) { return to_macro( sk, "" ); }

string to_macro( item itm, string cmd )
{
	if ( itm.item_amount() == 0 ) return "";
	return "use " + itm.to_int() + "; " + cmd;
}
string to_macro( item itm ) { return to_macro( itm, "" ); }

boolean happiermediumdrinks()  
{
	return ( my_familiar().image == "medium_3.gif" );  
}

string generate_macro()
{
	string macro;
	macro += "pickpocket;";
	macro += "pickpocket;";
	macro += to_macro( $skill[ throw shield ] );
	macro += to_macro( $skill[ entangling noodles ] );
	macro += to_macro( $skill[ feed ] );
	macro += to_macro( $item[ rock band flyers ] );
	macro += to_macro( $skill[ release the boots ] );
	if ( happiermediumdrinks() ) macro += to_macro( $skill[ Siphon Spirit ] );
	macro += to_macro( $skill[ moxious maneuver ], "repeat;" );
	macro += to_macro( $skill[ wave of sauce ] );
	macro += to_macro( $skill[ saucegeyser ], "repeat;" );
	macro += to_macro( $skill[ weapon of the pastalord ], "repeat;" );
	macro += to_macro( $skill[ shieldbutt ], "repeat;" );
	return macro;
}

void main( int initround, monster foe, string page ) 
{
	visit_url( "fight.php?action=macro&macrotext=" + generate_macro() );
}
You could do a little better by adding an MP check before using skills, but I guess your recovery script is setup to make sure you can end your fights without any MP troubles.
 
Last edited:
Hey slyz, I just noticed one little thing off: my CCS, when I have Wave of Sauce & Saucegeyser would cast Wave first then Geyser to take advantage of Splashback, but I notice in the Consult it just does Geyser. Would you be able to tweak the consult/macro bit to do that? No rush, as I'll be running as Pasta or Boris for a few days.
 
Back
Top