Trouble identifying a fax monster

Code:
	if( !is_online( "faxbot" ) ) abort( "Faxbot is dead!" );
		chat_private ("faxbot", "chieftain");
	wait (40);
	if (item_amount($item[photocopied monster]) == 0)
		cli_execute ("fax get");
	string chief = "C. H. U. M. chieftain";
	if (item_amount($item[photocopied monster]) > 0 && contains_text(chief,visit_url("desc_item.php?whichitem=835898159")))
		cli_execute ("try; use photocopied monster");
	else
		abort ("Fax doesn't have a chieftain");

I want mafia to fight the chieftain (that comes in via faxbot) if it's there, and abort if it's not. When I tried it, a chieftain was successfully faxed in, my script just wasn't able to figure that out, and I got the abort message. Edit: experimentally I tried something else (a clod hopper), and it also was not properly identified.

Also, how do I get printed message to also display in the progress bar, not just the CLI?
 

Ethelred

Member
Code:
    if( !is_online( "faxbot" ) ) abort( "Faxbot is dead!" );
        chat_private ("faxbot", "chieftain");
    wait (40);
    if (item_amount($item[photocopied monster]) == 0)
        cli_execute ("fax get");
    string chief = "C. H. U. M. chieftain";
    if (item_amount($item[photocopied monster]) > 0 && contains_text(chief,visit_url("desc_item.php?whichitem=835898159")))
        cli_execute ("try; use photocopied monster");
    else
        abort ("Fax doesn't have a chieftain");

I want mafia to fight the chieftain (that comes in via faxbot) if it's there, and abort if it's not. When I tried it, a chieftain was successfully faxed in, my script just wasn't able to figure that out, and I got the abort message. Edit: experimentally I tried something else (a clod hopper), and it also was not properly identified.

Also, how do I get printed message to also display in the progress bar, not just the CLI?


Here's a code fragment I use for my daily faxing, a lot of which I lifted from another script, that works reliably for me.

Code:
#
#        Uses code lifted and adapted from AfterBore.ash by ShaBob from kolmafia.us
#

string TARGET = "four-shadowed mime";            //    Mime
string REQUEST = "mime";                        //    Mime
        
//    Checker to see faxbot is active and that we have the correct target monster
    if ((item_amount($item[photocopied monster]) == 0)) 
    {
        cli_execute ("fax get");
    }
    while ( get_property( "photocopyMonster" ) != TARGET )
    {
        if( !is_online( "faxbot" ) ) abort( "Faxbot is dead!" );
        if (item_amount ( $item[photocopied monster] ) != 0)
        {
            cli_execute ("fax put");
        }
        chat_private ("faxbot", REQUEST );
        wait (60);
        cli_execute ("fax get");
    }

Sorry, can't help with the progress bar part.
 

slyz

Developer
The photocopy's desc_item doesn't contain the full monster name, so looking for "C. H. U. M. chieftain" in the result of visit_url() fails.

If you want your method to work, simply make sure the string you are looking for is in the source code of the desc_item.

EDIT: I should have checked before posting. In the case of the chieftain, the description DOES have the full name...

The issue was actually that the arguments of contains_text() are the wrong way around.

Replace
PHP:
contains_text(chief,visit_url("desc_item.php?whichitem=835898159"))
with this:
PHP:
contains_text(visit_url("desc_item.php?whichitem=835898159"),chief)
I prefer writing it the following way, even though it is functionally equivalent:
PHP:
visit_url("desc_item.php?whichitem=835898159").contains_text(chief)
 
Last edited:

StDoodle

Minion
Unless you've defined
PHP:
string chief = "chief";
somewhere, shouldn't that be
PHP:
visit_url("desc_item.php?whichitem=835898159").contains_text("chief");
;)
 
Top