i had to work my auto login stuff over because i finally needed support for different accs on 1 bnet acc
and because i often see shitty auto login lua codes in this forum, i think it could be useful for some people, so i'm posting this here
- supports multiple wow accs on one bnet acc
- changes realm if necessary
- can simply be spam executed in an endscene hook via dostring/framescript_execute until your character is online, no need for any timers or additional ifs 
Code:
string login = "if (WoWAccountSelectDialog and WoWAccountSelectDialog:IsShown()) then "
"for i = 0, GetNumGameAccounts() do "
"if GetGameAccountInfo(i) == '" + accname + "' then "
"WoWAccountSelect_SelectAccount(i) "
"end "
"end "
"elseif (AccountLoginUI and AccountLoginUI:IsVisible()) then "
"DefaultServerLogin('" + username + "', '" + password + "') "
"AccountLoginUI:Hide() "
"elseif (RealmList and RealmList:IsVisible()) then "
"for i = 1, select('#',GetRealmCategories()) do "
"for j = 1, GetNumRealms(i) do "
"if GetRealmInfo(i, j) == '" + realm + "' then "
"RealmList:Hide() "
"ChangeRealm(i, j) "
"end "
"end "
"end "
"elseif (CharacterSelectUI and CharacterSelectUI:IsVisible()) then "
"if GetServerName() ~= '"+ realm + "' and (not RealmList or not RealmList:IsVisible()) then "
"RequestRealmList(1) "
"else "
"for i = 0,GetNumCharacters() do "
"if (GetCharacterInfo(i) == '" + name + "') then "
"CharacterSelect_SelectCharacter(i) "
"EnterWorld() "
"end "
"end "
"end "
"end ";
username = your bnet login
password = ...
accname = your "sub account", if any
name = character name
realm = your characters realm
i don't think that i missed something, but if it spits out an error let me know
but only lua errors, if your app crashes then you ****ed up your own code, it's not an error in this lua code, and i don't care