Feature - Rejected Allow for ASH-callbacks to be called after every adventure, or specific encounters

Gramphos

New member
I'm writing a script that manages turtle taming, and it keeps track of when turtle adventures are encountered. It works with the adv1 function, and checking the lastEncounter property for known turtle encounters after each call. But I want it to register turtles found during manual adventuring as well, which means that I currently have to call my function check_for_turtle() each time I've found one during manual adventure.

Therefore I would like for a way to tell mafia to call a specific ash-function sometime during registerEncounter(). I imagine an interface something like this:

Code:
void callback_function(string encounter) {
   do stuff
}

register_encounter_callback(string callback_function);
Registers callback_function as a callback for ALL encounters.

register_encounter_callback(string callback_function, string encounter);
Registers callback_function as a callback for encounter only

remove_encounter_callback(string callback_function);
Removes all registrations of callback_function

And possible a
Code:
register_encounter_callback(string callback_function, string[] encounters);
which would be equivalent to
Code:
foreach encounter in encounters {
    register_encounter_callback(string callback_function, encounter);
}
but possible could be made more efficient.
 

slyz

Developer
Why not do a BetweenBattle script? It will be called by Mafia every turn (apparently though, it's called before adventuring when auto-adventuring, and after adventuring if playing manually through the relay browser.)
 

Theraze

Active member
Using both BBS and moods, this can be done already with scripts firing before or after battles. I'd vote for rejecting, functionality already exists.
 
Top