Feature - Implemented Request a Fax from CLI

Rinn

Developer
The downside to sending the message manually is mafia won't wait to receive and acquire the photocopied monster.
 
Yes, but does the "fax" command use the monster names as provided by Faxbot (and therefore sometimes not even monster names) or the monster names as supported in mafia and through ASH's $monster?

Best example off the top of my head are Faxbot's "Hobelf (WC)" and "Hobelf (Elf Alley)" for mafia's "Hobelf" and "Elf Hobo" respectively.
 

Bale

Minion
The "fax" command does not use any monster names. It doesn't communicate with faxbot either. All it does is send and receive faxes.

I know this because I typed "help fax" in the CLI. StDoodles advice was good, but only I listened to him. Even StDoodle doesn't listen to StDoodle or he probably wouldn't have posted. :D
 
Last edited:

lostcalpolydude

Developer
Staff member
I added this patch to my build a while back. It's basically just the relevant code from FaxRequestFrame copy-pasted into a CLI command. Ideally (for code maintenance, but probably not for performance? I'm just guessing here) one of the files could call a function in the other file for the redundant logic.
 

Attachments

  • faxbotcli.patch
    9 KB · Views: 45

fxer

Member
was this idea abandoned? or is there maybe a script that makes it easier to request a fax from within ash?
 

fronobulax

Developer
Staff member
Not quite abandoned. It has been sitting in my to do pile but I have not gotten around to reviewing and doing. I'll move it to the front and report back.
 

fxer

Member
From someone else glancing at this it sounds like it will require some refactoring of the code, like removing the guts of the code from the pop-up window to where ash/cli can make calls to it?
 

holatuwol

Developer
Without looking at the code involved here, technically, ASH/CLI can make calls to window logic like it does for the familiar trainer. It just needs to be refactored to take parameters rather than just look at whatever input fields are available in the window.
 

lostcalpolydude

Developer
Staff member
In FaxRequestFrame, I think actionConfirmed could be refactored like:

Code:
		public void actionConfirmed()
		{
			int list = FaxRequestFrame.this.monsterIndex;
			Object value = FaxRequestFrame.monsterLists[ list ].getSelectedValue();
			actionConfirmed( value );
		}

		public void actionConfirmed( Object value )
		{
			if ( value == null )

Or maybe the second function could be renamed instead of overloading that function name (especially if it creates some kind of conflict with the button listener, or however that GUI stuff works). Then FaxbotCommand could just be

Code:
FaxRequestFrame.actionConfirmed( command );

However, "command" is a String and "value" needs to be a different data type, and I don't know how to do the conversion.

This would be missing any type of error checking on the input value, at least before getting the "unknown command" message from faxbot.
 

lostcalpolydude

Developer
Staff member
So I realized it isn't really that simple. The CLI command doesn't send the monster name along, only the faxbot command. The name could be shown just for GUI requests (as it currently is for me) which would require making "name" global and a little bit of logic to check for it being empty, and the "Monster monster" block would need to be moved to the parameterless version.

I kind of doubt my solution to this would be sane.
 

Veracity

Developer
Staff member
Revision 10281 refactors the guts of FaxRequestFrame to make it easy to write a "faxbot" command.
It also supplies a simple-minded faxbot command: you can type "faxbot cmd" to send "cmd", literally, to FaxBot.

The Frame is more user friendly, in that it displays a list of monsters for you and you don't need to know the actual command needed to fetch them (although it does show you), but this is scriptable.
 

Banana Lord

Member
Awesome! I've been waiting for this :D. Any plans for an ash command or two? Just curious, the "simple-minded" CLI command you've implemented will be enough to accomplish everything I want to at this stage.
 

Banana Lord

Member
Yep, that's what I'm planning on doing. I'll whip up an ash function for Harvest, but I'll need to do things like construct a data file for the monsters that FaxBot supports and the commands it recognizes to get them, and then have the function check that the monster is available, and that FaxBot is online etc. All the usual things. I was just wondering if there'd be something a little neater built-in at some point.
 
Top