Feature - Implemented Support for Fax Machine

slyz

Developer
When you have a Fax Machine installed in your clan, you can Send a fax when you have a photocopied monster in your inventory, and you can Receive a fax when you don't already have a photocopied monster in your inventory.

When sending a fax, your photocopied monster is consumed.
When receiving a fax, you obtain a photocopied monster.

I tried to modify ClanLoungeRequest.java to take into account the Fax Machine, but my experience with java is not up to the task: I tried to copy the code for the Pool Table, but instead of having the same preaction and a different option number for each choice, 'Send' and 'Receive' have different preactions (sendfax and receivefax) and no options.

It would also be great to have a CLI "fax" command, with "send" and "receive" options.

With the FaxBot project, I think people will be using the fax machine regularly, and although it isn't urgent at all, especially during the Crimbo season, it would be a great feature for Mafia to have.
 

slyz

Developer
I think I wrapped my mind around it. Here is a patch that adds support for the Fax Machine. It makes Mafia update the photocopied monster count when sending/receiving faxes. I also added the "fax" CLI command, it accepts 'send, 'put', 'receive' or 'get' as parameter.

If this works as intended, identifying the photocopied monster from the item description would be the final touch, I think.

I have included the changes posted in the photocopied monster patch here, but only the changes to ClanLoungeRequest.java, FaxCommand.java, KoLmafiaCLI.java and ItemPool.java are needed for the Fax Machine support.

If a dev wants separate patches, for simplicity, I can of course post them.

EDIT: I have been looking at the gCLI output, and I realized that my english isn't really good enough to come up with good, concise comments to print out:
Code:
> fax get

Receiving a fax.
You acquire an item: photocopied monster
You receive a monster from the fax machine

> fax send

Sending a fax.
You load your photocopied monster in the fax machine
Visiting Fax Machine in clan VIP lounge
You acquire an item: photocopied monster
It would be great if someone could throw in better ideas.

EDIT2: The "photocopyMonster" preference is now reset to "" when you loose the photocopied monster by sending it to the fax.

EDIT3: see post #7 for a patch with monster identification
 
Last edited:

bumcheekcity

Active member
Great idea, but I suggest the fax command should make an extra server hit (definitely when you recieve a monster, but also probably when you send one) and confirm WHAT you've got by parsing the item description page.
 

slyz

Developer
Since receiving a fax is the only time where you acquire a photocopied monster without knowing what it is, it should definitively always call whatever function will identify the monster. Perhaps also on login, if you have a photocopied monster in your inventory and the photocopyMonster preference is empty. And, of course, each time you look at the item description (through the relay browser or with visit_url() ).

I'm not too certain about identifying the monster you send though: is it just for logging purposes? If photocopyMonster is empty when you send a fax, the monster should be identified, and "You load a photocopy of a fluffy bunny in the fax" printed in the gCLI/session log?

I updated the patch in the second post: I had forgotten to clear the "photocopyMonster" preference when the photocopied monster was lost by being send to the fax.
 
Last edited:

slyz

Developer
The item description of the photocopied monster is "This is a sheet of copier paper with a grainy, blurry likeness of a %copymonster on it.". I haven't seen a lot of those item descriptions yet, but it seems like %copymonster isn't always the full monster name. If it's just a substring (ignoring case), is it always enough to completely identify the monster? Could people post some examples here? (item description text / full monster name).
 

lostcalpolydude

Developer
Staff member
I would be surprised if anything is incomplete enough that whatever code is used to convert a string to a monster couldn't handle it.
 

slyz

Developer
Identifying the monster was surprisingly easy: consequences.txt already did this for the spooky putty and the 4D camera.

Here is a new patch, which contains all the changes explained in post#2, as well the monster identifying part. The string stored in photocopyMonster is simply the string extracted from the item description (just like with putty and cameras). Scripts will need to use to_monster() anyway.

I also changed the messages printed to the gCLI:

Code:
> fax get

Receiving a fax.
You acquire an item: photocopied monster
You receive a photocopied Astronomer from the fax machine.

> fax send

Sending a fax.
You load your photocopied Astronomer in the fax machine.
 

Attachments

  • FaxMachine.patch
    21.2 KB · Views: 37

slyz

Developer
Thanks a lot. This, with the FaxBot pane, will make things a lot easier.

Just out of curiosity, I noticed the monster name wasn't printed in the gCLI when receiving a fax. Is that intentional? It looks like line 622 of ClanLoungeRequest.java was meant to be:
Code:
RequestLogger.printLine( "You receive a photocopied " + monster + " from the fax machine." );
instead of
Code:
RequestLogger.printLine( "You receive a photocopied monster from the fax machine." );
 

Veracity

Developer
Staff member
That was unintentional. I changed some of your code but didn't finish the job. I will correct it as you suggest.
 

Ruduen

New member
Just a small thing, but would it be possible to get the Faxbot send to automatically open chat if it's not already open? If you forget about it, then it just ends up timing out even after you normally would've received the success message.
 

stannius

Member
Just a small thing, but would it be possible to get the Faxbot send to automatically open chat if it's not already open? If you forget about it, then it just ends up timing out even after you normally would've received the success message.

+1
 
Top