Some Questions

So I'm working on a few scripts, trying to get back into the swing of things. I can't seem to find a good compilation and documentation of all the ASH functions and CLI commands available in mafia. The wiki is confusing at best, so...

First, does mafia have the capability to send chat messages and kmails, and respond to proposed trades?
I've looked at zLib and see some functions to send kmails, but is there an easy way to parse through them.
I know there is a chat_reply() function, but is there a way to send an uninitiated message in PM or open chat? (ie. a clan informational/welcome bot)
I've also looked at the tradeaway.ash script, but i'm having some issues working through parts of it.

Second, i've looked at "value.ash" and looked into the mall_price() and historical_price() functions, but is there already a place to get the information available on the wiki marketplace page? ie. the other data such as "quantity", up/down %, etc.. I'm sure it wouldn't be to hard to make a scraper and parse it into a map file, but I would prefer not to duplicate someone's work.

Hopefully this can all come together to be something useful for the community. Thanks so much!
 

Spiny

Member
If you want to create a chatbot of sorts, you should direct your attention to Pykol. If you want to create a mallbot, mafia doesn't facilitate that. If you're interested in the current worth of your assets, dj_d's networth.ash is a quick and easy script or you can try the greasemonkey script Logikol pricegun.
 
Not a mallbot and not a networth script. I am basically trying to create a bot that is somewhere between a trash can and a philanthropy effort :p
Basically creating a pre-determined amount that the bot is willing to pay-out per item (whether it be 100%, 110%, 500%, whatever). Obviously I will have to write in some checks to make it so that the bot is not abused, limitations and such. But the basic function that I am working out right now is figuring out how much to reply with in trade (the mall value, and whether or not it is a highly traded item or not), and then how to actually put that into a trade.
 

Grotfang

Developer
First, does mafia have the capability to send chat messages and kmails, and respond to proposed trades?

Yes, but you would need to write bits of it yourself. As far as I'm aware, responding to trades is not implemented by anyone yet. Responding to kmails is, though you might need to get your learning hat on.

I know there is a chat_reply() function

Not any more there isn't.

is there a way to send an uninitiated message in PM or open chat?

chat_private( target , message ) is the one you want to go for there. Also, chat_clan( string ) should post a message in your clan chat channel.
 

Alhifar

Member
Out of curiosity, can I ask why this is? I no longer really care, but I had written a bot that was publicly used for a short time, which utilised chat_reply() to respond to public /msg's.
 

holatuwol

Developer
With centralized chat (where everything goes through KoLmafia), the only way to support chat_reply would be to store it in the script object itself (which isn't straightforward since it's a runtime library function), since the most recent person who PM'd you would constantly change if the relay browser was open at the same time.

Rather than deal with that, I decided to take out chat_reply entirely and maybe implement it later if I felt like it. I figured people would still want the ability to PM people, but I didn't feel comfortable letting people PM anyone they wanted (PMs are a bit more obtrusive than kmail). Hence, the most likely people using your bot (clan members) became the first option and kmail could be used as a backup in case that wasn't possible.
 
Hmm :/ Ok. This is going to be trikier than I though. pykol looks somewhat promising, I'll have to dig further into it. Though I was hoping there would be a simple(r) solution using ASH. Thanks for all the feedback.
 

Grotfang

Developer
It is an awesome function. I especially like how it still accepts people on the whitelist, so frequent movers can still get a response!
 

zarqon

Well-known member
I know squat about chat. But for parsing kmail, DaMaster has put together what looks to be a handy bunch of kmail parsing functions here. They are based on the simple kmail parser in the Script Registry script.

Somewhere, mredge posted a modified version of the kmail parser that also breaks out meat and items as separate fields. I usually parse those along with message text in my scripts (type "ashref extract" in the CLI for clues as to how), but it is probably handier to use his version if you can find it.
 
Top