Banana Lord
Member
Forgive my ignorance, but what is the name of that parameter?
Last edited:
void main( int round, string opponent, string text )
{
buffer mac; // macro in progress
string macro(string mac) // ASH function for submitting a macro
{
print( mac );
print( "" );
print( url_encode(mac) );
return visit_url("fight.php?action=macro¯otext="+url_encode(mac), true, true);
}
// We want to pickpocket regardless of what we're fighting
mac.append( 'pickpocket; ');
// Use spooky putty if possible and advisable
if(get_property("spookyPuttyCopiesMade") != "5") // Check for available putties
{
if(item_amount($item[spooky putty sheet]) == 0) // Make sure you have a putty sheet
abort("No putty!"); // don't even hit the server for your abort situation
if ( item_drops(to_monster(opponent)) contains get_property("currentBountyItem").to_item() ) // Only use putty if the monster drops your current bounty item
mac.append( 'use spooky putty sheet; ' );
else
print("That monster doesn't drop your bounty item so putty was not used", "blue");
}
else
print("You're out of putties for today so spooky putty was not used", "blue");
// Olfact the monster if you can, and if it drops your bounty item
if( item_drops(to_monster(opponent)) contains get_property("currentBountyItem").to_item() ) // Only olfact if the monster drops your current bounty item
{
if(have_skill($skill[transcendent olfaction]))
mac.append( 'skill transcendent olfaction; ' );
}
else
print("That monster doesn't drop your bounty item so it was not olfacted", "blue");
// Finish the fight
mac.append(" while !pastround 25; attack; endwhile; ");
// finally, submit the macro
macro(mac);
}
You could do a main like this:As I want to eventually reduce NCF's combat handling to a single consult script and a single CCS, is there a way I can change the void main() { } bit to something like void bounty_combat() { } so that it can be called as a function at an appropriate time by an overarching combat script? Does that make sense?
void main( int round, string opponent, string text )
{
if ( condition ) bounty_combat( int round, string opponent, string text );
else other_combat( int round, string opponent, string text );
}
if ( item_drops( opponent.to_monster() ) contains get_property( "currentBountyItem" ).to_item() )
I remove the bold from post #3.Banana Lord said:Hah! Figured out what my versioning problem was! Bale, could you remove the bold face from the script title in the third post?
That's exactly how I did it. How encouraging.PHP:if ( item_drops( opponent.to_monster() ) contains get_property( "currentBountyItem" ).to_item() )
Thanks for that, but weirdly I'm still getting the message to update to 1.3.4. Hmmm.I remove the bold from post #3.
item wanted;
matcher bounty_matcher = create_matcher( "<b>[0-9]+ (.+?)</b>", data );
while( bounty_matcher.find() )
{
wanted = bounty_matcher.group( 1 ).normalize_item();
todays_options[i] = find_BHH_object(wanted);
print("LOCATION #" + i + " : " + to_string(todays_options[i].bountyLocation));
}
Okay, when I tried to run the new stable version, it asked for a value for "int rnd" "string opp" and "string text"
Earlier versions never did this and I have no idea where, if, it says what those values should be.
Thanks for that!I couldn't run through 1.5.0 (see below about the value requests), but when I tried to revert back to 1.3.4, I got the same BHH error both with the old bounty hunting .ash and then new one.
item wanted;
int i = 1;
matcher bounty_matcher = create_matcher( "<b>[0-9]+ (.+?)</b>", data );
while( bounty_matcher.find() )
{
wanted = bounty_matcher.group( 1 ).normalize_item();
todays_options[i] = find_BHH_object(wanted);
print("LOCATION #" + i + " : " + to_string(todays_options[i].bountyLocation));
i = i + 1;
}
item wanted;
int i;
matcher bounty_matcher = create_matcher( "<b>[0-9]+ (.+?)</b>", data );
while( bounty_matcher.find() )
{
wanted = bounty_matcher.group( 1 ).normalize_item();
todays_options[i] = find_BHH_object(wanted);
print("LOCATION #" + i + " : " + to_string(todays_options[i].bountyLocation));
i += 1;
}
if(bountymap[i].bountyItem == wanted)
if(bountymap[i].bountyItem == wanted.to_item())