View Full Version : Is there a script for switching characters?
phalen33
09-18-2015, 08:04 PM
I was curious, is there an existing lich script for switching characters? I have cobbled together a basic script that works and before making it more user friendly I just wanted to make sure I wasn't reinventing the wheel. What I am looking to do is run a script to switch characters on the same account or login a character on another account. I have a rather grand plan for streamlining my pocket chars.
Thanks
Tillmen
09-18-2015, 09:15 PM
I've used Lich's reconnect feature to switch characters, but it's not at all user friendly, or even documented. Also, it may not work for some or any Windows users, because Windows is a jerk.
Anyhow, to use it you would first have to save quick login data for the character.
Then, you modify the ARGV array (that's the array of command line arguments used to start Lich) to make it look like you logged in from the character you want with the reconnect option, even if you didn't.
Then, you exit the game using "qui" or "exi", because typing out "quit" or "exit" disables the reconnect
ARGV.clear
ARGV.concat [ '--login', 'Noob', '--reconnect', '--reconnect-delay=5+10', '--start-scripts=noobscript' ]
put 'qui'
The --reconnect-delay makes it wait 5 seconds before trying to reconnect, and each time it fails to connect it adds another 10 seconds to the delay.
Also in there is --start-scripts, which will tell Lich to start one or more scripts at login, in addition to the normal autostart scripts.
Of course, this method is only useful if you want to log out of the current character.
You're probably using exec or system or spawn or ShellExecute or ShellExecuteEx or possibly something else to start Lich. While some or all of these may work for you, they may not work for other people. There doesn't seem to be any discernible reason why. That's just something to keep in mind if you distribute a script and people tell you it doesn't work. It's also possible that they all work all the time, since it's starting Ruby and not the Simu Launcher. I dunno.
phalen33
09-19-2015, 02:14 AM
I tried using exec, but it makes my current session go unresponsive. Think it's the whole replace the current process and run the command part of exec. So I have been using system to run lich and pass in my .sal file. With this I can do --start-scripts as well. I also put it into a new thread so that the script would actually end. Would you recommend one method of running lich from within a script over the other?
If Tillmen doesn't know a script already for this then it must not exist. Just have a rough proof of concept at the moment, but it works. I will see if I can make a fancy version for distribution.
phalen33
09-19-2015, 09:06 PM
I made a user-friendly version and uploaded it to the repository. The name of the script is login.lic. I have tested it with wizard and stormfront frontends. I wrote it to use the same entry.dat as the lich.rbw. I added methods for list/add/delete/modify for managing the entries in the entry.dat file. The script allows you to store your character's login information and then quickly login/switch characters by using,
;login <character name>
You can also specify start scripts,
;login <character name> <script1,script2,script3....>
See ;login help for full usage info.
My personal motivation for creating this script is to streamline my pocket characters. Make a key macro to run the script that calls my empath and runs a script to have her come to my table and heal me. Hit another button to log into my rogue and run a script to run to my table and pick my boxes. Hit my last macro and log into my ranger to come to my table and spell me up. I guess I am just too lazy to run SGE and execute a script every time I rest and need something.. :)
This is my first public script and as Tillmen stated above the system command could act differently on different systems. If you run into any errors or see any problems then please let me know.
Thanks
Donut
09-19-2015, 09:26 PM
this is a great script, thank you
phalen33
09-21-2015, 02:44 AM
You're welcome. I hope it works well for you.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.