Feature - Rejected support for different choice.php overrides

rlbond86

Member
It would be very convenient if mafia would support multiple choice.php relay overrides. Right now if I want to override one choice adventure, I have to create choice.php and test for that adventure, which conflicts with any other choice overrides. I was thinking maybe mafia could specially handle choice.php and run the file choice_XXX.ash for choice adventure XXX.
 

Veracity

Developer
Staff member
Do you also want a different fight.php override for each kind of monster?

Seriously, can you give an example of why you would want to have "other choice overrides" rather than one file which handles all choices?

Also seriously, we choose the script based on the URL it is overriding - which is choice.php - without having fetched the URL. In the case of choice.php, we can't tell what the choice is until we visit the URL - and it is up to the script to do a visit_url() if it wants.

Which means that what you ask is not possible, given how relay scripts work.
 
Last edited:

Theraze

Active member
And this:
conflicts with any other choice overrides.
is just not true. If you want to test for if it's your choice, and you want to check if it's another choice, and you want to check on a third choice... that's fine. Check on each choice. That's why the delightful "else if" was created. :)
 

rlbond86

Member
And this:is just not true. If you want to test for if it's your choice, and you want to check if it's another choice, and you want to check on a third choice... that's fine. Check on each choice. That's why the delightful "else if" was created. :)

It does if multiple script writers have made scripts and you don't want to merge them all together.
 

Theraze

Active member
Don't want to doesn't mean you can't or that they conflict. Just means you're lazy. :) Which is fine... but hey, like the Lady says, you can't always not get what you don't want. :)
 

StDoodle

Minion
Damnit V, I'm gonna hear / sing it that way from now on, and I'm blaming you for all the weird looks I get. :p
 

Catch-22

Active member
I sorta support this in that I think it should be possible to script choice adventures to override the built-in KoLmafia behaviour (or lack thereof), it's different to overrides though.
 

Bale

Minion
I sorta support this in that I think it should be possible to script choice adventures to override the built-in KoLmafia behaviour (or lack thereof), it's different to overrides though.

Differently from the way that BestBetweenBattle handles it?
 

Theraze

Active member
And the additional handling added for master relay overrides makes this QUITE easy for scripters.
 

Bale

Minion
And the additional handling added for master relay overrides makes this QUITE easy for scripters.

Good point. A master relay override to import the choice.ash overrides he wants and a script to switch between them. That's pretty much "Feature - Implemented"
 

Catch-22

Active member
Differently from the way that BestBetweenBattle handles it?

Hmm.. When I think about it actually, I'd say the BBB does a decent job, maybe what I'm after is just a BBB style script that will change some of the lesser used choiceAdventure preferences for me. I think matt.chugg was asking for something similar to what I would like to see here.

Good point. A master relay override to import the choice.ash overrides he wants and a script to switch between them. That's pretty much "Feature - Implemented"

You can't "import" within a closure, but I just whipped something up which might be of use (not sure if it works), attached.
 

Attachments

  • choice.ash
    566 bytes · Views: 36
Last edited:

Bale

Minion
You can't "import" within a closure, but I just whipped something up which might be of use (not sure if it works), attached.

That is not what I meant. Import the script and then use it. Your way would probably work also though.
 

Catch-22

Active member
That is not what I meant. Import the script and then use it. Your way would probably work also though.

The other trouble with import is that you lose anything in the main() method, which may or may not be important, depending on the style of the original scriptwriter. I can see where rlbond86 is coming from in that merging/importing a bunch of choice.php override scripts could become quite nightmarish over time. If what I came up with actually works, hopefully it will be at least a little easier for him to manage.
 
Top