Multi-account script...

H

Havanacus

Guest
I'm not sure if there is already a script like this somewhere in these forum but I have been searching for days with little results... I'm incapable of writing these scripts myself so I ask of others now to try... I need a script that can log onto four accounts(one after the other) and adventure in a pre-determined area... I don't know if this is possable using just a single script but I would like comformation before I forget about it... at a later point, I plan to apply another script I found posted in this site made for farming items and placing them in a clan bank so if that can be considered in the first script it would be great... Thanks, bye...
 

Havanacus

New member
oh, by the way, weather you believe me or not, I will mot be using this foe personal gain... These four accounts are completely separated from my other account and are(will be) in a clan of only themselves... My reason for doing these kind of things is just to get a taste of what this kind of code can do... All of the items collected will remain permanently in the clan stash for just my personal amusement... I can't prove this to anyone but it is your decision wether or not to help me...
 
In order to log onto multiple accounts one after the other you need to step out of kolmafia scripting to switch between the accounts. A batch file (has .bat extention) is basically a script telling dos what to do.

MultiAccount.bat:
Code:
java -jar KoLmafia-7.1.jar --CLI script=scripts\script3.txt
java -jar KoLmafia-7.1.jar --CLI script=scripts\script2.txt
java -jar KoLmafia-7.1.jar --CLI script=scripts\script1.txt
java -jar KoLmafia-7.1.jar --CLI script=scripts\script.txt

script#.txt:
Code:
login username
call scripts\doit.ash
exit

username is the character name on kol different in each file, doit.ash does not have to be an ash script, it can be a regular script. It can be almost any script on this sight. Script#'s name could be changed to the charname on kol.

This method will start kolmafia in a text only mode. That shouldn't matter much though since you wont be interacting anyway.
 

Wolfie

New member
u can make 1 large script well i wouldnt say large but depending on how advanced u plan to make each run. i had to make one for when i go out of town on business then i just make sure someone runs it while im gone basically its like

Code:
login char1
cli_execute("adventure * The haunted pantry");
cli_execute("wait 30"); (optional of course to put in i just use them so it pauses between each char a lil)

login char2
cli_execute("adventure * The haunted pantry");
cli_execute("wait 30");

of course this isnt the exact code and is very basic but its an example of how i got it to work granted mine is just as simple i normally modify once i find out of a business trip so i can stockpile foods etc and make sure they eat drink and adventure in whichever place is gonna give me the best stat gains for my lvl in turn works out pretty well havent had a prob with it yet.
hope this helps out a lil
 
Hey guys I noticed this thread which had the same question I do. Thanks to everyone that submitted help, my batch script is looking glorious ;D It brought up this question though. Where does KoLmafia store the password. I just looked at login in the user manual and it says that the password needs to be stored in a file but it doesn't tell you where. I want to type in all the passwords manually so that I don't have to run KoLmafia like 10 times just to save the password.
 
It encodes the passwords, so even if we tell you where it is stored you would be hard pressed to add them in.

Sorry about that.
 
I'm actually more glad to hear that... I thought about it and then realized that could sound really shady (what I was asking ) and that it would be very unwise to keep the pwds unsecure. I just wish there was an easier way to save the pwd without having to log in completely - which I've already done and it took like 45 mins lol
 

Sako

Member
Just a little change to Efil's .bat file, to log on multiple accounts at once.

Code:
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script3.txt
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script2.txt
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script1.txt
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script.txt

This way, a new command window will be created for each character, and each of them will run a new instance of kolmafia. Tested & working.
 
[quote author=Sako link=topic=119.msg1051#msg1051 date=1150017466]
Just a little change to Efil's .bat file, to log on multiple accounts at once.

Code:
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script3.txt
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script2.txt
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script1.txt
start java -jar KoLmafia-7.1.jar --CLI script=scripts\script.txt

This way, a new command window will be created for each character, and each of them will run a new instance of kolmafia. Tested & working.
[/quote]
Yes, this will work, however if you run this batch and start task manger, switch to processes view and click the word image name, this will put all the instances of java.exe together. Note the amount of memory used by each instance. There was no mention of how many characters would be run using this method but I can tell you that babysitting friends and family members accounts while they can't that I generally run between 2 and 20 accounts at a time. The memory usage  in my situation would reach the "blue screen of death" point quite often if I tried running like that.

In contrast, having them run 1 after the other minimizes memory needs, but if the second script aborts, it will leave you with the cli running so any characters after that will not run. But then I ask is it really fair to someone else that plays kol to run 20 characters at once each of which their owner is unable to get to the internet for whatever reason?

This method is most attractive to people who have an always on internet connection, and it is typical of always on internet connections to be high speed. I have watched multiple instances of kolmafia running on my PC (again in task manager this time networking) and it can easily peak out the abilities of my internet connection. I have the fastest internet connection short of having a special line to my home that is possible. If to many people run their internet connections peaked out communicating with kols servers at once, the lag monster will return very quickly on kol.

I can give multiple reasons not to run multiple instances of kolmafia at once, but I think the strongest possible reason is that if they find that any one IP address is using excessive bandwidth on kol's servers at once, it may result in that IP address being banned from kols servers permanently.
 

holatuwol

Developer
[quote author=efilnikufecin link=topic=119.msg1060#msg1060 date=1150051081]In contrast, having them run 1 after the other minimizes memory needs, but if the second script aborts, it will leave you with the cli running so any characters after that will not run.[/quote]
Change it so that the player name is the first line of the script (rather than "login player name") and redirect the input; this ensures that an abort will not affect your run sequence in any way.
 
[quote author=holatuwol link=topic=119.msg1069#msg1069 date=1150076233]
Change it so that the player name is the first line of the script (rather than "login player name") and redirect the input; this ensures that an abort will not affect your run sequence in any way.[/quote]
I had thought about creating the following file:
exit.txt
Code:
exit
and redirecting that file as the input for kolmafia, but had never actually thought of redirecting the "wrapper" script.

Changing MultiAccount.bat to:
Code:
java -jar KoLmafia-7.1.jar --CLI < scripts\script3.txt
java -jar KoLmafia-7.1.jar --CLI < scripts\script2.txt
java -jar KoLmafia-7.1.jar --CLI < scripts\script1.txt
java -jar KoLmafia-7.1.jar --CLI < scripts\script.txt

and script#.txt to
Code:
username
call scripts\doit.ash
exit

Should do it.

Script#.txt could also read:
Code:
username
doit.ash
exit
if the "doit.ash" script is in the scripts folder.

Another little addition:
Code:
cli_execute("mirror success.txt");
print(my_name());
cli_execute("mirror");

adding that as the very last thing into "doit.ash" or whatever your filename of choice

and adding:
Code:
del success.txt > nul

to the begining of MultiAccount.bat will build a list of character names which made it from the begining of the script "doit.ash" to the end. In this case though "doit.ash" must be an ash script. because I believe the my_name() function is only available in ash scripting.
"Del success.txt > nul" will delete the file with no prompt whatsoever to the user. Placing it at the begining of the batch file will cause a fresh list to be generated daily. also remember to have the batch file in the same directory as kolmafia (or modify the path to all files accordingly).

a small explanation:

the > character routes any output from a dos based program to the filename which follows. The file will be overwritten if it exists.

using >> will do the same, but add the output to the end of the file rather than to overwrite the file.

nul is nothing, nowhere. When redirecting the output of a program or command to nul, the output is simply discarded as if it never even existed.

using < tells dos that when the program is waiting for input to read a line from the filename that follows the character and send it to the program as if the user had typed it in manually.
 

Sako

Member
Yeah, I'd never use like 50 accounts at once... I usually run the batch file with 2 characters at once, and I'm fine with it, as it uses an average 30% of my dialup connection, and 2 instances of javaw still use less memory than Firefox. Not that I have ram problems with 1GB DDR :p
 
[quote author=Alexander Daychilde link=topic=119.msg1071#msg1071 date=1150097497]
I'm always loath to put del statements in batch files - it's a bit of paranoia that has possibly saved me as much as it has caused me to waste hours finding alternatives... ;D

Why not at the top of the batch file:
Code:
@echo off > success.txt

That'll start you off with a nice clean blank success.txt... :)
[/quote]

That should work fine too. I haven't actually tried that method though it seems a more desirable method for sure.

[quote author=Sako link=topic=119.msg1072#msg1072 date=1150100054]
Yeah, I'd never use like 50 accounts at once... I usually run the batch file with 2 characters at once, and I'm fine with it, as it uses an average 30% of my dialup connection, and 2 instances of javaw still use less memory than Firefox. Not that I have ram problems with 1GB DDR :p
[/quote]

Yeah I prefer to save money by using an older computer rather than buy a new one. I'll use the money saved in about 7 years when my son turns 16 to buy him a car  ;)

Edit I just looked over a script for a friend who is using this method, and they had a loop set up to print their character name then spend an adventure and repeat. While this does work, since she was using a batch file to go through her 3 characters, I added to her batch file a simple command before starting kolmafia each time
Code:
title charname
where charname is the name of the character kolmafia will logon next. This way you can always just look at the taskbar, or title of the dos box to see which character is logged on. This method works in WinXP, and maybe before but I am unsure which version it was implemented in.
 
Top