Kaldonis
04-26-2017, 06:45 AM
Probably some other people already wrote such a thing as login rewards have been out for awhile, but I'm lazy. Also, if I had written it in ruby it would probably be more useful to other people, though I guess Mac OS users should be able to use this one as well. I wrote it for myself and I like bash.
You need to have Tillmen's ;log.lic in your Global autostart, as this script is used to determine if the character logs in successfully or not.
Feel free to use the code below. My wife seems to like it, since she now never has to worry about logging in each character as I just run the script every day (manually!). I don't think Wyrom ever gave an explicit response about putting something like this as a cron job, though I had asked on the officials near the release of login rewards. (There's actually no way for them to distinguish between you being at the keyboard or not...) Anyway, whatever they say you know, "Script responsibly whilst raking in all the login rewards."
You shouldn't need to change much besides the list of CHARNAMEs though it's worth checking where you have installed lich vs. where I assumed. Naturally, lich needs to know the login credentials for all the characters.
The logic is as follows: log in the character, then check if a log file with today's date matches based on the return signal of ls. Once there's a log file, the character logged in, so kill that instance of lich. Do this for each array element in CHARNAME. (Note that it uses the computer's local date which is not the same as the game time, but I guess if you live in another timezone like me you would know that...)
#!/bin/bash
# separate names of characters by spaces
# must already have login data saved to lich for each one
declare -a CHARNAME=(Kaldonis Goatface Ceilingcat)
i=0
DATE=$(date "+%Y-%m-%d")
PORT=8000
while [ $i -lt ${#CHARNAME[@]} ];do
DIR="$HOME/lich/logs/GSIV-${CHARNAME[$i]}"
printf "Logging in ${CHARNAME[$i]}..."
ruby $HOME/lich/lich.rbw --login "${CHARNAME[$i]}" --without-frontend --detachable-client=$PORT &> /dev/null &
PID=$!
LOGIN=2
while [ $LOGIN -ne 0 ];do
sleep 1
ls $DIR/$DATE-*.log &> /dev/null
#we might miss this command if the character was already logged in on another PC
#grep "Thank you for logging into GemStone" $DIR/$DATE-*.log &> /dev/null
LOGIN=$?
sleep 1
printf "."
done
kill -9 $PID &> /dev/null
# kill will exit by the time the message is generated, so we have to wait for it...
wait $! 2>/dev/null
printf "\n"
let "i += 1"
done
You need to have Tillmen's ;log.lic in your Global autostart, as this script is used to determine if the character logs in successfully or not.
Feel free to use the code below. My wife seems to like it, since she now never has to worry about logging in each character as I just run the script every day (manually!). I don't think Wyrom ever gave an explicit response about putting something like this as a cron job, though I had asked on the officials near the release of login rewards. (There's actually no way for them to distinguish between you being at the keyboard or not...) Anyway, whatever they say you know, "Script responsibly whilst raking in all the login rewards."
You shouldn't need to change much besides the list of CHARNAMEs though it's worth checking where you have installed lich vs. where I assumed. Naturally, lich needs to know the login credentials for all the characters.
The logic is as follows: log in the character, then check if a log file with today's date matches based on the return signal of ls. Once there's a log file, the character logged in, so kill that instance of lich. Do this for each array element in CHARNAME. (Note that it uses the computer's local date which is not the same as the game time, but I guess if you live in another timezone like me you would know that...)
#!/bin/bash
# separate names of characters by spaces
# must already have login data saved to lich for each one
declare -a CHARNAME=(Kaldonis Goatface Ceilingcat)
i=0
DATE=$(date "+%Y-%m-%d")
PORT=8000
while [ $i -lt ${#CHARNAME[@]} ];do
DIR="$HOME/lich/logs/GSIV-${CHARNAME[$i]}"
printf "Logging in ${CHARNAME[$i]}..."
ruby $HOME/lich/lich.rbw --login "${CHARNAME[$i]}" --without-frontend --detachable-client=$PORT &> /dev/null &
PID=$!
LOGIN=2
while [ $LOGIN -ne 0 ];do
sleep 1
ls $DIR/$DATE-*.log &> /dev/null
#we might miss this command if the character was already logged in on another PC
#grep "Thank you for logging into GemStone" $DIR/$DATE-*.log &> /dev/null
LOGIN=$?
sleep 1
printf "."
done
kill -9 $PID &> /dev/null
# kill will exit by the time the message is generated, so we have to wait for it...
wait $! 2>/dev/null
printf "\n"
let "i += 1"
done