RandBot -- a randomized clan buffbot

zarqon

Well-known member
RandBot 3.2

What does it do?
RandBot is a script which randomly maxcasts a random buff on a random clan member. Random!

How does it work?
RandBot is designed to function best as a mood script, although it can also be called directly. You will get maximum randbuffing from this while adventuring using the starfish trick.

RandBot only functions in aftercore. It automatically detects what buffs you can cast, and gets a list of your clan members (hitting the server for this once per day, not once per run). Before each combat, if you have at least randbot_reqamt MP (default 50), it picks a random buff and a random clan member, and maxcasts that buff on that clan member. Awesome!

RandBot will skip casting on inactive players. Inactivity is determined by the number of days since last login. Default is 7 days (1/4 of what KoL uses in the clan roster) but you can edit that number to suit your clan's size and activity level.

There are three variables you can edit in the script -- a clannie blacklist (for clan members you want to skip), a whitelist (for extra-clan members you want to include), and a buff blacklist (for buffs you want to skip). Read the script for further details.

Recommended:
  • High-level character (avoid getting hit, high MP cap).
  • Items that reduce the MP cost of skills.
  • Items to increase the duration of buffs (relevant Epic weapons, JEW hat).
  • Boosted monster level will result in more MP gained per combat.
  • Heavier familiars will result in more MP gained per combat.

How to use it:
  • Download RandBot.ash and recordings.ash to your scripts directory.
  • Install SmartStasis (or use your own "stasis" ccs of choice).
  • Get ZLib if you don't have it already.
  • Optionally, configure RandBot's script settings, either using Prefref Plus in the relay browser, ZLib in the CLI, or by editing your vars_myname.txt file directly in a text editor. All of the settings for RandBot begin with randbot_.
  • Add the script to your mood: Unconditional trigger | call RandBot.ash
  • Report any bugs or suggestions here!

Changelog
11.6.07 - ver. 1.0 posted.
11.7.07 - Added a check to prevent possible endless loop when no clannies can recieve your buffs.
11.30.07 - 1.1 changes: fixed a situation where the script would abort if you began with full MP, reorganized the code a bit, simplified minimum MP requirement, compacted and increased stat report.
12.17.07 - Automated the selection of the custom combat script! Also, restores your original combat/ccs settings, and your original familiar (optional).
12.27.07 - 1.2 changes: Rolled back the ccs selecting due to errors. It will still set you to use a ccs, but it will not specify the script. Clear conditions before adventuring, to prevent an error if there were leftover conditions. RandBot also now shows ministats after each combat, so you don't have to wait until the end to see how meat/MP-profitable an area is.
1.13.08 - Allows the user to specify where to adventure, rather than using your last location.
6.19.08 - 1.3 changes: Reimplemented ccs autoselecting. Included version-checking. Code and print optimizations. Print a report afterwards showing who received which buffs.
10.14.08 - 1.4 changes: Added Hobopolis buffs to the list of buffs.
10.15.08 - 2.0 major update! Randbot will now skip casting on inactive members (members who have not logged in for X days). X is configurable in the script -- default is the KoL standard 30 days, but I recommend something much smaller. Added an option to skip casting on PvP players. Also added a blacklist, so you can skip casting on any players you want. Skips casting on yourself by default (by default, you are the only player in the blacklist).
11.29.08 - 2.1 changes: now that we load showplayer.php for each clannie, don't bother trying to cast on people in HC or Ronin. Added functionality for whitelisting players not in your clan. Remove swap_familiar option. Lower default inactivity threshold to 15 days.
5.05.09 - 2.2 changes: drastically improve post-run report format. Also print a mini-report for each player after each cast.
6.14.09 - 2.3 changes: moved some functions out -- now requires ZLib. Fixed the color of Hobopolis buffs in final report.
7.25.09 - 2.4 changes: use script settings rather than variables, now that the new Zlib makes that available.
12.30.09 - 2.5 changes: added Crimbo '09 buff. Use ZLib's new vprint().
3.24.09 - 2.6 changes: fix url_encoding error introduced with recent build. Note player level when updating players, and don't attempt to cast Hobopolis buffs on players under level 15.
2.20.14 - 3.0 changes: RandBot is now a mood script. Various other enhancements.
10.31.17 - 3.1 changes: http => https. Also burn mana making recordings if applicable. Rather than save the clan in an external file, simply maintain it in a static variable. Also track casting and initiate daily casting limit per player per buff. Print reports after each cast and at the end of the day.
2.25.21 - 3.2 changes: Hey, KoLmafia has functions for dealing with timestamps now! We no longer need to hit KoL for now() and we don't need to hit the quick and dirty PHP timestamp converter on my server to convert the last login string either. Two fewer server hits per clan member is pretty nice.
 

Attachments

  • recordings.ash
    3.3 KB · Views: 53
  • RandBot.ash
    8.9 KB · Views: 1
Last edited:

dangerpin

Member
Re: RandBot 1.0 -- a randomized clan buffbot

I'm having a problem downloading the ash file, is anyone else experiencing that?
 

zarqon

Well-known member
Re: RandBot 1.0 -- a randomized clan buffbot

Ok, I just updated the RandBot.ash file... try again.
 

dangerpin

Member
Re: RandBot 1.0 -- a randomized clan buffbot

Thank you, Zarq! I hope to use this a bit while I level up to 30. I'll keep you posted. Hopefully my clan will get a kick out of it.
 

logwarrior

New member
I created a kolmafia account just to say how much I like this script. I actually started a new AT solely for this bot.

PS. The Origami gentlemens magazine is perfect for your Familiar equip.
 

Enameless

New member
I just tried this script out and well totally awesome. This script is exactly what I need to put my clan's buff bot to use until I find more stable internet in which to run her on. I couldn't have hoped for or created a better script.

-Enameless
 

Wolffauer

New member
Very nice!

I pulled a few bits out of it to supplement my clan buffbot's scripts so now when he gets bored (no one requesting buffs) he can randomly buff clan members.
- Wolffauer

BuffBot: NotBot
 

zarqon

Well-known member
Update Bump!

I revisited this script today, since a few little things had been niggling at me:

  • RandBot will now automatically select your ccs. This was broken in mafia when I originally implemented it long ago, but seems to be working now.
  • When RandBot completes adventuring, it will print a report detailing who received which buffs. It's fun information to see.
  • Some general code and output cleanup. I've learned a bit since I wrote this.
  • Added version-checking like in my other scripts, so I won't need to always post "bump" update posts like this.

We have a clanbot who basically runs this script every day, and we all end up with loads of random free buffs. It's great. Also, very delayed thanks to the authors of the above complimentary comments! Glad it has useful to people outside my clan as well. :)
 

Gert

New member
Just curious ... does it distinguish between hardcore and softcore clan members? Or what happens when it tries to buff hardcore/ronin members?

Again, just curious
 

zarqon

Well-known member
If a cast is unsuccessful, for instance the target is in Ronin/HC or already has three different AT buffs, RandBot tries a different random buff on somebody else until it finally succeeds (or until it has tried casting 10+members times).
 

Poki

New member
This looks like a very useful script (nicely written, too), and I'm sure I'll be using it in the future, when I get around to re-enabling my buffbots.

I have some requests, though:
Can you please add a list of clan-members to pass-over when sleecting buff candidates? I don't want my random buffbot to buff myself, so as to avoid any possibility of multi-abuse.

I've not used PvP for a long while. Is there still a purity test? If so, is it possible for the script to check the status of the hippy stone (or PvP rank) of clan members to determine whether that clanmate should be ignored for buffing?

I would like any clanmates who haven't logged-in for x days (perhaps 3 weeks, perhaps when they get flagged inactive) passed-over for buffing, too, as others would get more benefit.

Hmm, just having a quick thought ... there are other scripts in this repository, like item-handling. Linking this with one of those ("if exists maximize.ash call maximize MP" to be run before each block of turns spent, and then to change equipment to minimize MP costs before running the buffs, or something) would automate and streamline the whole process. I can't see anything after a quick search of this forum, but if there's a turn-analyser script it might be nice to run that before spending turns at your selected location, so it can let you know if it thinks you're in a non-optimal location, and where the optimal location would be for your class / stats / equipment.

Thanks
 

zarqon

Well-known member
These are some good ideas. I've wanted to do the inactive members thing for a while, but you can't get activity from the page that lists everyone.

Checking the hippy stone would be one additional sever hit per clan member which would drastically increase the server load. It could be done only when casting, and the data could be stored. Hmmm, that might work. I'll see about implementing this when I get back from my tour of the US.

Other than reading and writing data files and calling scripts, there is no way to access external files in mafia. If there were an ASH equivalent to the CLI's call command we could say
PHP:
if (call("maximize.ash","mp")) { stuff }
but at present calling a nonexistent script will halt operation.

The version I'm using right now will skip casting on yourself. I wasn't sure if I wanted that in the released version or not though. You can use it if you like.

NOTE: This is not an official release. Whatever that means.
 

Attachments

  • RandBot.ash
    8.7 KB · Views: 61

zarqon

Well-known member
@Poki: Your feature requests have been added!

2.0 Major Update

  • RandBot will no longer cast on inactive members, and you can set how many days since last login that is.
  • There is now an option to skip casting on PvP players.
  • RandBot now has a blacklist, in case you want to skip over anyone else. By default, my_name() is blacklisted, so your bot will not cast on itself.

Enjoy!
 
Last edited:

zarqon

Well-known member
Updates!

  • Now that we're loading additional player info (PvP etc), RandBot will no longer try to cast on players in Hardcore or Ronin.
  • Someone kmailed me about adding a whitelist, to be able to buff players not in your clan. I thought that was a fine idea, and have added functionality for whitelisting players. You'll need to specify their name and player id.
 
Last edited:

Tipmon

Member
This sounds like a great idea and when i get the buff bot i tryed to set up going again(been going through a lot of leveling and such) ill try to use it with him
 

ghettoflower

New member
this is tricky, but

i have always loved this script.. i'm finally out of hc/ronin and might just use it for a while.. i am not sure if i should post here or wait till the following year like the last person did.. cheers!
 

Bale

Minion
Sure. The purpose of SmartStasis is to make your starfish function and the new one works better.

I'm more concerned if randbot still works since it over a year since its last update.
 

Gdunge

Member
Next question: HOW do I make RandBot work with the new SmartStasis?

I have the idea that all I need to do is drop RandBot.ash into the /scripts folder, based on Zarqon's instructions. But how would that work?

I searched the code and didn't find the string "RandBot" anywhere. Then I searched the OLD code and STILL didn't see it.

Clearly I have some defect in my reasoning and/or understanding.

So how does RandBot work? How does it hook into SmartStasis, or vice versa?

Hmmm.... perhaps it goes into my CCS?

consult SmartStasis.ash
consult RandBot.ash
attack

???
 

Bale

Minion
I believe you're having trouble with this step.
  • Run the script!

After you have put randbot into your /script folder it will appear in the scripts menu of your KoLmafia window. (At the top of your KoLmafia window is a list of drop-down menus. One of those is "Scripts".) Click on it and you'll see RandBot. Then click on RandBot to run the script.

As for how it links into SmartStasis... If you set up SmartStasis correctly (see instructions in the SmartStasis thread) then the SS script will be used to run every combat you encounter. RandBot will enter battle with monsters and SmartStasis will get mp while fighting them. After the fight RandBot will spend those mp and then start a new fight.
 
Top