View Full Version : Auto login in & farm /w multis
Briangun
03-13-2011, 07:39 PM
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!
icon315
03-13-2011, 08:33 PM
Not sure there is a way to log in using mafia scripting.
Briangun
03-13-2011, 10:05 PM
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.
Ethelred
03-13-2011, 10:09 PM
.... Than at the end mail most of the meat to my main.
You do realize that this is blatant multi-abuse and is likely to get your accounts banned, don't you? As such, you're unlikely to get much sympathy or help from this forum.
Briangun
03-13-2011, 10:25 PM
My bad. No, I was not aware.
fronobulax
03-14-2011, 01:25 AM
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 (http://kolmafia.us/showthread.php?1519-EatDrink.ash-Optimize-your-daily-diet-%28and-see-how-your-old-diet-stacks-up%29.) that would probably serve your needs.
jwylot
03-14-2011, 10:51 AM
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.
This way the whole process can be automated without involving your wife at all.
We're still talking about Mafia, right?
We're still talking about Mafia, right?
Silly boy. That's why it automates your mom, not your wife.
jwylot
03-14-2011, 11:00 AM
Lmao
fronobulax
03-14-2011, 02:06 PM
What jywlot said (http://kolmafia.us/showthread.php?6255-Auto-login-in-amp-farm-w-multis&p=46832&viewfull=1#post46832) although I'd be more comfortable if we left your wife out of it ;-)
Here's how I automate through a scheduled task:
java -jar kolmafia-latest.jar --CLI automation-epicgamer.ash
Then automation-epicgamer.ash contains
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:
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.ashMake 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.
LARRYT3HCABLEGU
03-21-2011, 08:31 PM
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
04-11-2011, 10:04 PM
I have my main and 4 multi's. In my login script it checks if I am logged in as my main like this:
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):
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.
StoreKeeper
05-26-2011, 06:00 AM
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.
RealBurgerKing
06-27-2011, 09:15 AM
Ok, I'm having a problem with setting an auto-adventuring script up for my character. I have the code written as such:
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:
14 none does not exist in the adventure database.
Any ideas?
There is no location called "The Hippy Camp". It's called "Hippy Camp". Drop the "The" and you'll be fine.
RealBurgerKing
06-27-2011, 07:24 PM
Thanks for the reply Bale, however I have yet to test the script due to the current downtime.
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.
RealBurgerKing
06-27-2011, 09:16 PM
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:
void main(string[location] where_to_adventure)
{
// auto-adventuring code
}
RealBurgerKing
06-28-2011, 12:05 AM
Thanks again Bale, works perfectly now.
Winterbay
06-28-2011, 05:13 AM
Having something like this:
void main(location adventure_location)
{
//Code
}
Will give you a popup when you run the script with a searchable list of all locations.
RealBurgerKing
06-28-2011, 06:11 PM
Sweet, thanks for that Winterbay!
Powered by vBulletin® Version 4.2.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.