Auto login in & farm /w multis

Briangun

New member
I've tried searching for over an hour now on how to do this, i apologize if i overlooked my answer. I'm completely new to scripting/bats files.

I want to keep this simple, I would very much like KoLmafia to auto login and farm for my characters each day. Big pluses if it's simple enough for my wife to monitor when i get deployed.

So far I only had the Knob treasure room in mind, but I would be open to any other suggestions.

Thanks!
 

Briangun

New member
I'm thinking I'll have windows schedule KoLmafia along with a keyboard macro to log me in. Mafia would take over with the breakfast and 'login script'. Have a timer wait 5 minutes than hit the keyboard strokes to log me out, wait 30 seconds than log in with my next character.

C++ for the keyboard macro, default windows scheduler to start the process.... hmmm not sure how to start my login script, but i know this is the command i want it to run:
ash while (my_adventures() > 0) adventure(my_adventures(), $location[knob treasury]);

It'd be great if i could make the character buy/eat food/drink as part of the breakfast or beginning of the script.
 
Last edited:

fronobulax

Developer
Staff member
Since I saw the magic word "deployed" I am quite ready to forgive your faux pas about multi-abuse and thank you for serving.

That said, mafia can be configured to run a user specified script on login so that might be a place to start. There is script EatDrink that would probably serve your needs.
 

jwylot

Member
It's not multi abuse if the farming character derives all the benefits and doesn't pass them on.

No idea why a keyboard macro is relevant. For each character you need to set up a task in Windows Scheduler to launch a .bat file calling java -w kolmafia.jar to launch.

Each character will need his own folder. Set up mafia to auto login and create a login script to do what you need. Probably use it to call Neocowfarm.ash, which includes eatdrink and to exit when done.

This way the whole process can be automated without involving your wife at all.
 

Rinn

Developer
Here's how I automate through a scheduled task:
java -jar kolmafia-latest.jar --CLI automation-epicgamer.ash

Then automation-epicgamer.ash contains

Code:
void main()
{
    cli_execute("login epicgamer");
    //Do stuff
    cli_execute("quit");
}
Doing this I launch each character in order from the same task (I only have two).

Additionally I call my mafia update exe before starting, and to be extra sure it's going to run I kill any running java processes, so all the commands I run in my task are:
Code:
taskkill /im jusched.exe /f
taskkill /im javaw.exe /f
taskkill /im java.exe /f
KoLMafiaUpdate.exe -o
java -jar KoLmafia-latest.jar --CLI automation-epicgamer.ash
java -jar KoLmafia-latest.jar --CLI automation-multi.ash
Make sure the start in directory is correct, and the arguments are in the correct place in the task. Login scripts aren't necessary since you can pass in a script to run through the command line.
 
Last edited:

LARRYT3HCABLEGU

New member
Im probably gonna get yelled at for this but this is what i do:

Make a .BAT File and place it in the directory of your Kolmafia Jar file
*Change KoLmafia.jar to what your JAR Files name is*
*Also change the EXAMPLE.txt files to the name of the Txt File you create*

java -jar KoLmafia.jar --CLI scripts\multi\EXAMPLE1.txt
java -jar KoLmafia.jar --CLI scripts\multi\EXAMPLE2.txt
java -jar KoLmafia.jar --CLI scripts\multi\EXAMPLE3.txt

Then create a .txt File for each account to run
*Change the login EXAMPLE1 to the account name and the script to the directory of the script to run on start-up*

login EXAMPLE1
call scripts\multi\SleazyFarm.ash
exit

Also for this to work you need to manually go into KoLMafia and login to each account at least once (and have it safe the password) for it to work.

!!Mods may delete this if they seem fit as i am only on for a few minutes every month or two to update!!
 

fianor

Member
I have my main and 4 multi's. In my login script it checks if I am logged in as my main like this:


Code:
if (my_name() != "MyMain") cli_execute ("call muti.ash");

and does my normal daily farming and such if it is. If it's not it calls this script (multi.ash):

Code:
void main() {
	if (my_name() == "multi#1"){
		cli_execute("bounty hunt");
		cli_execute("login multi#2");
	}
	if (my_name() == "multi#2"){
		cli_execute("bounty hunt");
		cli_execute("login multi#3");
	}
	if (my_name() == "multi#3"){
		cli_execute("bounty hunt");
		cli_execute("login multi#4");
	}
	if (my_name() == "multi#4"){
		cli_execute("bounty hunt");
		cli_execute("quit");
	}
}

which logs in to each multi, bounty hunts (by calling on the bounty.ash from these forums) then logs into the next multi. I don't have windows task scheduler running it automatically, I log in and start the process myself, but I can't see why using this as a start up script and having mafia start on a schedule wouldn't work. Of course you'd have to log in once manually and save the passwords for each multi. But as previously mentioned, the ability to log in and run a farming or w/e script doesn't change what is and isn't multi abuse. Automation is acceptable, sending the profits from multiple accounts to a main is abuse. Not that we really need to tell you, #6 will get you pretty quick if you do abuse it.


Also I don't see any reason you'd need multiple installs of mafia, just have a seperate script per character (if needed) and instead of always calling on your one script (the "bounty hunt" call on mine) just call on the right script for each character.
 
Last edited:

StoreKeeper

New member
I use a script for my multis to allow me to do things like rollover outfit changes and various "breakfast" activities that are not part of Mafia. Since I run it myself, I simply created an ASH script to do it. I have one script before I start playing and another when I am done. They both look something like:



void DoBreakfast()
{
// Insert code here to do what you want done.
}
void main()
{
// Create a list of characters.
string [ int ] CharList;
CharList[1] = "FirstCharacter";
CharList[2] = "SecondCharacter";
CharList[3] = "ThirdCharacter";

for x from 1 to 3 by 1
{
cli_execute( "login " + CharList[x]);
DoBreakfast();
cli_execute( "logout");
}
}

You could modify it to do more than what I use it for. You could also use a scheduler program to kick it off.
 
Ok, I'm having a problem with setting an auto-adventuring script up for my character. I have the code written as such:

Code:
string adventure_location = "The Hippy Camp";

if(my_adventures() > 0 && my_inebriety() <= inebriety_limit())
{ adventure(my_adventures(), to_location(adventure_location)); }

However, given that I have 14 adventures available, the CLI provides me with the error:
Code:
14 none does not exist in the adventure database.

Any ideas?
 

Bale

Minion
There is no location called "The Hippy Camp". It's called "Hippy Camp". Drop the "The" and you'll be fine.
 

Bale

Minion
If you had used location adventure_location = $location[The Hippy Camp], you'd have gotten the error before running the script and the error message would have been a lot easier for you to debug.

Don't store a location as a string unless there is a good reason for it. It only adds extra runtime when you convert it and makes your script harder to debug. This is my good programming tip of the day.
 
I was thinking of accepting it as a parameter for my main function so that I just type in the adventure location I wanted to use for the day.

Or, instead of a text input box for the location to adventure today, perhaps a drop-down menu. Do you think this could be implemented with a map of:
Code:
void main(string[location] where_to_adventure)
{
     // auto-adventuring code
}
 
Last edited:
Top