Bug - Not A Bug Faxbot monster names not aligned

ckb

Minion
Staff member
If I go to People -> Request a Fax and open the fax dialog, I can choose the option: Big Creepy Spider [spider]

However, ash faxbot($monster[big creepy spider]); returns false

This is because requesting 'spider' from faxbot returns a $monster[completely different spider]

Not sure where Mafia is pulling this information from, but it is like two different sources because it is giving different information.
 

Veracity

Developer
Staff member
You should talk to weas; KoLmafia has absolutely no hard-coded information whatsoever about what faxbot can send you. It reads the XML configuration file from faxbot to get the list of monsters and the command to request them and gives you whatever the config file says.

If you have any doubts about that, filter on "butt" and notice that you have three options:

1000 ML Butt [bigbutt]
Mr. Skullhead's Luscious Butt [skullhead]
Riff's Lucious Butt [riff]

Do you seriously imagine that we have those built-in to KoLmafia?
 

Veracity

Developer
Staff member
A follow up:

Looking at the faxbot XML file, I see "Big Creepy Spider".
Looking at monsters.txt, I see "big creepy spider".
And looking at the ASH function, I see boolean faxbot( monster monsterName ).

That's a pity, since, as you can see with the "butt" example, Faxbot's database is not guaranteed to have a one-to-one mapping with a KoL monster name - and in the case of the spider, the name differs from KoL's name by capitalization. We could save and look up via "canonical" name, but that won't help you a bit with $monster[ somebody else's butt ].

I have no idea what you mean by "requesting 'spider' from faxbot returns a $monster[completely different spider]". It "returns" that monster? Are you saying that the photocopied monster has that string on it? Or what?
 

ckb

Minion
Staff member
In mafia CLI, I do this:

> ash faxbot($monster[big creepy spider]);
Returned: false


> ash faxbot($monster[completely different spider]);
Visiting Fax Machine in clan VIP lounge
Asking FaxBot to send a fax of Big Creepy Spider: spider
Receiving a fax.
You acquire an item: photocopied monster
You receive a photocopied completely different spider from the fax machine.
Returned: true

When this happens, I get this in my chat window:
private to FaxBot: spider
FaxBot (private): FaxBot has copied a Big Creepy Spider into your clan's Fax Machine.

So, somewhere, Mafia knows faxbot has a $monster[completely different spider] but NOT a $monster[big creepy spider]. Based on the list from the 'Request a Fax' dialog and the returned chat dialog it is likely parsing the weas XML for the request and response, but clearly the ash command is doing something different, because it knows the difference between the spiders.

If I do cli_execute("faxbot spider"); the result is a photocopied monster in my inventory with this description:
This is a sheet of copier paper with a grainy, blurry likeness of a completely different spider on it.
 
Last edited:

ckb

Minion
Staff member
Ahhhh... I see now. This is in faxbot.xml:
Code:
<monsterdata>
<name>Big Creepy Spider</name>
<actual_name>completely different spider</actual_name>
<command>spider</command>
<category>Sorceress's Quest</category>
</monsterdata>

I have made a request to weas. Hoping I can get this fixed.

Also, where does faxbot.xml come from? Who maintains it? Is it faxbot or Mafia?
 

Veracity

Developer
Staff member
In mafia CLI, I do this:

> ash faxbot($monster[big creepy spider]);
Returned: false
So, although FaxBot advertises a "Big Creepy Spider", KoLmafia is not finding it when it looks up "big creepy spider", which is the actual KoLmafia name for that creature.

> ash faxbot($monster[completely different spider]);
Visiting Fax Machine in clan VIP lounge
Asking FaxBot to send a fax of Big Creepy Spider: spider
Receiving a fax.
You acquire an item: photocopied monster
You receive a photocopied completely different spider from the fax machine.
Returned: true
Interesting. So, KoLmafia is looking up "completely different spider" and finding it. We'll see why, shortly...

When this happens, I get this in my chat window:
private to FaxBot: spider
FaxBot (private): FaxBot has copied a Big Creepy Spider into your clan's Fax Machine.
Yes. When KoLmafia looks up "completely different spider", it finds FaxBot's config record with the "pretty" name of "Big Creepy Spider" and the command "spider".

And if you look at the photocopied monster, what do you get? I'll tell you, since I just did the whole process manually:

From chat:

private to FaxBot: spider
FaxBot (private): FaxBot has copied a Big Creepy Spider into your clan's Fax Machine.
At the fax machine, I "receive" the fax:

You hear the fax machine ringing, so you walk up to it to see what's coming in. The top half of a document prints out, but then the stupid thing jams and starts beeping at you.

You get the jam cleared and hit a bunch of buttons trying to get it to continue, but all you manage to do is print out a copy of the last thing somebody tried to fax out. Oh well.

photocopied monster You acquire an item: photocopied monster
and when I look at it, I get this:

This is a sheet of copier paper with a grainy, blurry likeness of a completely different spider on it.
I sent the "spider" command to FaxBot and it sent me a "completely different spider".

So, somewhere, Mafia knows faxbot has a $monster[completely different spider] but NOT a $monster[big creepy spider]. Based on the list from the 'Request a Fax' dialog and the returned chat dialog it is likely parsing the weas XML for the request and response, but clearly the ash command is doing something different, because it knows the difference between the spiders.
Wow, major assumptions there. "clearly" "the ash command is doing something different". Did you look at the code for the ash command - like I did, before I responded the first time? I didn't think so.

Runtime Library.java:

Code:
		String monsterName = FaxBotDatabase.getFaxbotMonsterName( monster.getName() );
		String command = FaxBotDatabase.getFaxbotCommand( monster.getName() );
monster.getName for $monster[completely different spider] is "completely different spider". Duh.

FaxBotDatabase.java:

Code:
	private static final Map<String, String> monsterByActualName = new HashMap<String, String>();
	private static final Map<String, String> commandByActualName = new HashMap<String, String>();
...
				// Build actual name / command lookup
				FaxBotDatabase.monsterByActualName.put( monster.actualName, monster.name );
				FaxBotDatabase.commandByActualName.put( monster.actualName, monster.command );
...
	public static final String getFaxbotMonsterName( String actualName )
	{
		return FaxBotDatabase.monsterByActualName.get( actualName );
	}

	public static final String getFaxbotCommand( String actualName )
	{
		return FaxBotDatabase.commandByActualName.get( actualName );
	}
So, it is looking up strings in hash tables using the key "completely different spider" - and finding them.

Where did it get the strings that it used as the hash table key?

The "name" and "command" field are what you saw printed. But, what is that "actualname" field? Here is how we make a Monster object:

Code:
                private Monster getMonster( Element el )
		{
                        String monster = getTextValue( el, "name" );
                        String actualMonster = getTextValue( el, "actual_name" );
                        String command = getTextValue( el, "command" );
                        String category = getTextValue( el, "category" );
                        return new Monster( monster, actualMonster, command, category );
                }
Ah ha. There is an "actual_name" field for each monster in the XML file. So, what is in the actual FaxBot config file?

Code:
<monsterdata>
<name>Big Creepy Spider</name>
<actual_name>completely different spider</actual_name>
<command>spider</command>
<category>Sorceress's Quest</category>
</monsterdata>
Isn't that interesting? FaxBot has a "completely different spider" in a fax, which it advertises as a "Big Creepy Spider", available via the "spider" command. For some reason, it is in the "Sorceress's Quest" category - because the spider web is a tower item, I assume, and it doesn't matter which spider you get it from.

If I do cli_execute("faxbot spider"); the result is a photocopied monster in my inventory with this description:
This is a sheet of copier paper with a grainy, blurry likeness of a completely different spider on it.
Exactly.

As I said, talk to weas about this; KoLmafia is treating FaxBot's XML config file exactly as intended - and the "completely different spider" (actual_name) is advertised as a "Big Creepy Spider" (name) obtainable via "spider" (command).

This continues to be "not a (KoLmafia) bug".
 

Veracity

Developer
Staff member
And.... as I composed that lengthy reply, complete with code samples, I see that lost pointed out the bug and you found it yourself. Double ninja!

The faxbot.xml file is on www.hogsofdestiny.com and is maintained by faxbot, not KoLmafia.
 

ckb

Minion
Staff member
Wow, major assumptions there. "clearly" "the ash command is doing something different". Did you look at the code for the ash command - like I did, before I responded the first time? I didn't think so.

Veracity - you are giving me WAY too much credit for my understanding of java and Mafia. I do not really know how to look at the code, much less understand it. My "programming" skills pretty much stop at ash scripting.

So for those reasons, to me, a user, the ash command and the CLI command and the 'Request a Fax' dialog are all doing different things. Or at least, they are all accepting different arguments. I understand now that from a code perspective they end up doing the same things, but from a user interface point of view, they are behaving differently.

From the faxbot.xml, we get a few entries for each <monsterdata>
The CLI faxbot command accepts the <command>
The 'Request a Fax' dialog accepts the <name>
The ash faxbot() command accepts the <actual_name>

These are each a little different for a Mafia user.

I wonder if listing the <actual_name> would be more useful in the 'Request a Fax' dialog (or at least more consistent with other behaviors).
In the case of multiple <monsterdata> entries with the same <actual_name>, it would list the <name>
This would account for the multiple butts.

Or maybe I can just get faxbot updated... or at least faxbot.xml
 
Last edited:
Top