Looking for a way to match text at an url without forcing a page reload.

mellissaleo

New member
This is my first attempt at a script. And I`m not really a coder. My apologies if I am not using technical coding terms and if I`m asking something painfully obvious.
And this is my first time starting a thread in the Mafia forums, so if I have posted in the wrong place, my apologies and point me in the direction of the appropriate subforum for asking for help.


What I am trying to script is a buffbot for my clan.
What I need help with is a way to match text at the skills page to see if buffing failed.
I have searched the forums and the wiki and I have found the function: visit_url (). However, that function, to the best of my understanding, forces a reload of the skills page, so the text whether the buffing failed is lost.
The CLI prints out that the buffing failed, so there is obviously a function that is able to note that. I just don`t know where to look for it.


Thanks in advance for help or instructions how to clarify what I`m looking for, if it isn`t clear from this description.
 

slyz

Developer
Maybe you can try using boolean use_skill( int, skill, string ). See here for specifics.

I can't test this right now, but try to find out in which cases it returns false: when Mafia is unable to restore enough MP to cast, I guess, but try using it to cast an AT song on someone who already has the maximum number of songs running. Maybe it also returns false if that person has too many AT songs?
 

slyz

Developer
Code:
> ash use_skill(1,$skill[The Ballad of Richie Thingfinder],"a clanny")

Casting The Ballad of Richie Thingfinder on a clanny 1 times...
Selected target has the maximum number of AT buffs already.
Returned: false
Code:
> ash use_skill(1,$skill[chorale of companionship],"another clanny")

Casting Chorale of Companionship on another clanny 1 times...
Selected target cannot receive buffs.
Returned: false
Code:
> ash use_skill(1,$skill[chorale of companionship],"Player Formally Known As A Clanny")

Casting Chorale of Companionship on Player Formally Known As A Clanny 1 times...
Selected target is too low level.
Returned: false

Looks like use_skill() returns false for players that are too low level, players in HC/Ronin, and players who already have the maximum number of AT songs. It probably just returns false whenever Mafia can't find "successfully cast" in the response, or something like that.
 

mellissaleo

New member
That looks exactly as what i was looking for.
Thank you very much, slyz!
I have not had any time since the weekend ended to play more with the code. But I am looking forward to next weekend to try implementing that.
 
Top