Results 1 to 7 of 7

Thread: Faxing In Factory Worker (female)

  1. #1
    Junior Member
    Join Date
    Sep 2018
    Posts
    5

    Default Faxing In Factory Worker (female)

    Hello All,

    I am trying to fax in a factory worker (female) from cheesefax, but the Faxbot() command seems to always get striking factory-worker elf from EasyFax (using "Faxbot factory worker").

    Using a simple cli_execute("/msg "+targetFaxbot+" "+targetMonster); does work, but then does not collect it.

    Is there a way to pass in a string literal so Faxbot() pulls the correct monster, or do I need to go into a visit_url to go collect my fax? Better way of doing this?

    Thanks in advance for the help!

  2. #2

    Default

    You will need to use workarounds like the ones you have already explored. Alternate versions of monsters are needed infrequently enough that it isn't really worth adding support for that.

  3. #3
    Junior Member
    Join Date
    Sep 2018
    Posts
    5

    Default

    Thanks - I'll look into the workaround. I appreciate the response.

  4. #4
    Developer
    Join Date
    Apr 2006
    Posts
    922

    Default

    You should call can_faxbot(monster) before trying to fax anything:

    Code:
    > ash $monster[factory worker (female)].can_faxbot()
    
    Returned:     false
    There are a number of monsters that are in the fax network that aren't exposed in the xml file the faxbots are providing so mafia won't be aware of them. If those monsters are actually available you can usually look at the bot's display case to get the correct message to send to get the fax.
    Last edited by Rinn; 09-11-2018 at 09:21 PM.

  5. #5
    Junior Member
    Join Date
    Sep 2018
    Posts
    5

    Default

    Thanks Rinn for your comment. I usually do build in a check into my code but was merely just demonstrating what I wanted to do. I will definitely add something like that though in my code, so thank you.

    One question though with the can_faxbot(monster) function - I looked at Cheesefax's xml (@http://cheesellc.com/kol/faxlist.xml) and I do see the desired factory worker in the XML. Adding this to can_faxbot does throw a null, shown below. I did look to see if the bot had a DC for a better command, but for some reason Cheesefax does not have one that I saw. There is a HTML list posted in the profile, but it still lists just "factory worker" as the command. Maybe I am missing it though as I am still learning (just started in March).

    Code:
    ash $monster[factory worker].can_faxbot()
    
    Bad monster value: "factory worker" ()
    Returned: void
    Here is the accompanying xml:

    HTML Code:
    <monsterdata>
      <name>factory worker</name>
      <actual_name>factory worker</actual_name>
      <command>factory worker</command>
      <category>None</category>
    </monsterdata>
    By the function description and your usage, I would think my snippet would return true.
    so far (havent added in a can_faxbot() yet) I have this which almost works - I just need to grab that fax as run_choice very obviously does not work:

    Code:
    void faxMonster(string targetFaxbot, string targetMonster){
    	chat_private(targetFaxbot ,targetMonster);
    	wait(10);
    	visit_url("clan_viplounge.php?action=faxmachine&whichfloor=2");
            //this is not a choice adventure so need something else
    	//run_choice(2);
    	while(item_amount($item[photocopied monster]) == 0){
    		print("No photocopied monster, skipping in...");
    			wait(5);
    	}
    }
    
    
    void main(){
    	faxMonster("Cheesefax", "factory worker");
    }
    Thanks all for the help - I am still learning!
    Last edited by LordHaplo; 09-12-2018 at 03:44 AM. Reason: Formatting+ a bit more info

  6. #6
    Developer
    Join Date
    Apr 2006
    Posts
    922

    Default

    Yeah that's because mafia tracks those monsters as 'factory worker (male)' and 'factory worker (female)' to prevent ambiguity but those names don't match the kol name. Since that information isn't stored for cheesefax when mafia loads the xml the name doesn't match and that entry is ignored.

    There is a field 'manuel_name' in the $monster record that is more likely to be the string that the faxbots accept, but there's no telling what monster you would actually get on that request (if it was valid).
    Last edited by Rinn; 09-12-2018 at 06:02 PM.

  7. #7
    Junior Member
    Join Date
    Sep 2018
    Posts
    5

    Default

    Thanks again everyone that helped me as I learn the tricks of ASH and Mafia. Not only Rinn and lostcalpolydude but also Cheesecookie for a consult.

    I have patched together some code that does indeed work and has a bit of validation, posted below for other to pick apart to better my knowledge if anyone cares:

    Code:
    string handlefaxOneOffs(string targetMonster){
    	switch(targetMonster){
    		case "factory worker (female)":
    			targetMonster = "factory worker";
    			break;
    		default:
    			abort("Error - is this a one off?  You will need to add it manually if so.");
    	}
    	return targetMonster;
    }	
    string handlefaxOneOffs(monster enemy){
    	string temp = "";
    	switch(enemy){
    		case $monster[factory worker (female)]:
    			temp = "factory worker";
    			break;
    		default:
    			abort("Error - is this a one off?  You will need to add it manually if so.");
    	}
    	return temp;
    }	
    void faxMonster(string targetFaxbot, monster enemy){
    	print("hold on to yer hats - here comes a "+to_string(enemy)+"!");
    	string temp = handlefaxOneOffs(to_string(enemy));
    	chat_private(targetFaxbot ,temp);
    	wait(10);
    	visit_url("clan_viplounge.php?preaction=receivefax&whichfloor=2", true);
    	while(item_amount($item[photocopied monster]) == 0){
    		print("No photocopied monster, skipping in...");
    			wait(5);
    	}
    	if(get_property("photocopyMonster") != handlefaxOneOffs(enemy)){
    		abort("what happened????  You got a "+get_property("photocopyMonster"));
    	}else{
    		print("success!");
    	}
    }
    void main(){
    	faxMonster("Cheesefax", $monster[factory worker (female)]);
    }
    I will probably add in trashing the existing photocopy and trying again later (again from cc_ascend) but that's for later.
    This is now purely academic as I have recently been schooled on why a sk8 gnome would be better for turn count in HCCS. Still, glad to work though as it helps me understand.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •