Feature - Implemented Change background color to red when failing to cast Ode

Greenen72

Member
As it is, when I cast Ode from the Item manager and I have 3 AT buffs already, it returns
"Casting The Ode to Booze 1 times...
Selected target has the maximum number of AT buffs already."

I'd request this change the background to red
 

Bale

Minion
Agreed. Every now and then I am rather surprised when the drink manager asks me if I'd like to drink without Ode and I'm all like, "but I just cast Ode! Are you completely daft you Alzheimers inflicted program!" Then I check the CLI and I find out the problem. It would be really nice to know there's a problem when I click the "ode" button.
 

roippi

Developer
The background turning red is more than just a cosmetic effect. That is mafia entering ABORT_STATE, which among other things stops any scripts that may be running.

This is trivial to change, but are there unintended consequences of doing so? Would aborting scripts on failed skill casts be an issue?
 

Fluxxdog

Active member
I believe what Bale's describing is a silent fail from a UI button. If a button is used and there's an error or failure, there should be an indication of it. No scripts should be running if the button can be pressed. If you press the ode button and it fails, yeah, an abort state would seem an appropriate response.

use_skill() returns a boolean as to whether it's successful or not. The script running it should handle the function, whether abort or popping a MMJ or simply moving on to greener pastures. I use a wrapper myself that combines MP saving with a true limit on how many times a skill can be cast.
 

lostcalpolydude

Developer
Staff member
I believe what Bale's describing is a silent fail from a UI button. If a button is used and there's an error or failure, there should be an indication of it. No scripts should be running if the button can be pressed. If you press the ode button and it fails, yeah, an abort state would seem an appropriate response.

use_skill() returns a boolean as to whether it's successful or not. The script running it should handle the function, whether abort or popping a MMJ or simply moving on to greener pastures. I use a wrapper myself that combines MP saving with a true limit on how many times a skill can be cast.

That button and a script would ultimately lead to the same ABORT_STATE for mafia. I imagine a complex setup could be made to do different things depending on whether that response text came from pressing the button or some other action, but is it really worth it?
 

Fluxxdog

Active member
?? Why would use_skill() cause an abort if it was programmed otherwise?
Code:
if(use_skill(1,$skill[Magic Missle])) print("I cast a spell!");
else print("You never actually cast the spell!");
And what does that have to do with the button returning error or abort?
Maybe this line of questioning comes from not understanding how the button works. The buttons have always seemed like an internal script. Why shouldn't a button return an abort state or some other error when it fails? If you can press the button, scripts shouldn't be running anyway as mafia greys out the buttons when scripts run.
 

roippi

Developer
Mafia (and any sanely programmed java application) uses inherited classes to perform actions. The code to cast ode is not wholly contained in that button. Clicking it spawns a UseSkillRequest, just as calling use_skill() does. Or the CLI command "cast."

So, just like I said before: this change would lead to mafia entering an ABORT_STATE whenever a skill fails to cast. I am asking if that is a problem.
 

slyz

Developer
Why couldn't the OdeListener in UseItemEnqueuePanel.java check for extra turns of Ode after posting the UseSkillRequest? It could enter ABORT_STATE there.

Since scripts do not use that button, it wouldn't be a problem at all.
 

roippi

Developer
I was thinking it was pretty unintuitive for the button to function differently than the CLI and ASH, but since you're actually looking at the CLI when executing those commands.. I can see it being okay for special button behavior.
 

Fluxxdog

Active member
Mafia (and any sanely programmed java application) uses inherited classes to perform actions. The code to cast ode is not wholly contained in that button. Clicking it spawns a UseSkillRequest, just as calling use_skill() does. Or the CLI command "cast."

So, just like I said before: this change would lead to mafia entering an ABORT_STATE whenever a skill fails to cast. I am asking if that is a problem.
OK, now I see your point. Thanks ^^
 
Top