what are all the ways mafia can consult a script? like recovery, breakfast

jasonharper

Developer
A quick search through the source code turned up these scriptable overrides.

CLI scripts (which can of course invoke an ASH script via "call"):
loginScript
logoutScript
betweenBattleScript
preAscensionScript
postAscensionScript

ASH-only scripts:
plantingScript
counterScript
recoveryScript
buyScript
chatbotScript

There's nothing currently triggered when you eat or drink things. What would this allow you to accomplish? Would it need to be called before the actual consumption (so you could deny or modify the request), or afterwards (so you could see the results), or possibly both?
 

mredge73

Member
I would like to know this too, here is a list that I got from the preferences:

Breakfast, both on log on and log off
customCombatScript, after combat is initialized
betweenBattleScript, works before a battle begins?
chatbotScript, initializes when you get a private message
counterScript, initializes when a relaycounter expires
plantingScript, automatically plants mushrooms
postAscensionScript, not sure how this one works
preAscensionScript, not sure how this one works
recoveryScript, Bale uses this one
buyScript, not sure how this one works

Of course these are not documented anywhere, you have to search around the forums her to find code snippets to learn from. Good Luck, I don't think there is one for when you eat or drink anything.


Edit:
Looks like we posted at the same time.
 
there is a pvp minigame that compares how many unique foods and drinks you have consumed in the last 30 days

I want mafia to track all teh food and booze I consume for a month, so I know what new stuff I can eat or drink. I think this is possible to do with a script, but an easier way would be for mafia to just print out a file and use that to track all of it. this would let me print out a list of new possible foods

I was thinking after, but possibly both
 

jasonharper

Developer
Hmmm, if I were implementing that I think I'd just visit the consumption history page every day, parse the items & counts shown there, and write it to a map file with a name based on the current date. To determine what was consumed in the last 30 days, read today's map and the one you have that's closest to 30 days old, and subtract corresponding entries. This approach would handle any food or booze that was consumed outside of mafia, for example newly added items that mafia doesn't know about yet.
 

Bale

Minion
Yep. No need for that script to execute after eating. Just run it once a day before eating your food so that you know what you should eat.
 
Top