Page 1 of 1

Please help... wont change characters automaticly..

Posted: Tue Feb 07, 2017 9:11 am
by saytonic
I've been reading and searching and trying things for hours.. no luck

I'm trying to run the elf daily quest, on 5 characters, each on a different account..

this is what i have now:

daily script:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
   <!-- #  1 --><waypoint x="31847" z="4592" tag ='Main'>
<onLoad>
function relog() <!--Put your Character list here see http://www.solarstrike.net/phpBB3/viewt ... =27&t=1245 for more info-->
 SetCharList({
			{account=11, chars= {5}},
			{account=12, chars= {5}},
			{account=13, chars= {5}},
			{account=14, chars= {5}},
			{account=15, chars= {5}},
 })
 LoginNextChar()
 yrest(3000)
 player:update()
 loadProfile()
 loadPaths("Daily.xml");
   end
   </onLoad>    
         local dqCount, dqPerDay = RoMScript("Daily_count()");
         if 10 > dqCount then   
            queststate = getQuestStatus("Helping Them Grow");
            if queststate == "complete" then
               -- Complete quest
               player:target_NPC("Blinsik");
               sendMacro("CompleteQuest()"); yrest(2000);
               -- Accept quest
               player:target_NPC("Blinsik");
               sendMacro("AcceptQuest()"); yrest(2000);
               --__WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));   
            else
               -- Accept quest
               player:target_NPC("Blinsik");
               sendMacro("AcceptQuest()"); yrest(2000);
            end
         else
		sendMacro("Logout();"); yrest(60*1000);
		LoginNextChar()
		settings.load();
		settings.loadProfile("DailyElf");
		yrest (4000)
		loadPaths("Daily");
         end
   </waypoint>
   <!-- #  2 --><waypoint x="31812" z="4849">   </waypoint>
   <!-- #  3 --><waypoint x="31415" z="5720" tag = "Item">
         queststate = getQuestStatus("Helping Them Grow")
         if queststate == "incomplete" then
            player:target_NPC("Cleansing Crystal");
            yrest(3000);
            __WPL:setWaypointIndex(__WPL:findWaypointTag("Item"));
         end
   </waypoint>
   <!-- #  4 --><waypoint x="31878" z="4692">   </waypoint>
   <!-- #  5 --><waypoint x="31843" z="4593">   </waypoint>
</waypoints>

userfunction_loginnextchar.lua:

Code: Select all

--==<<           Rock5's LoginNextChar Functions              >>==--
--==<<             By Rock5        Version 1.51               >>==--
--==<<                                                        >>==--
--==<<       Requirements: 'fastLogin Revisited' v3.0         >>==--
--==<<                                                        >>==--
--==<<  www.solarstrike.net/phpBB3/viewtopic.php?f=27&t=1245  >>==--

local charList = {}
local CharacterLoadCount = 1
local RestartClientInterval = 0 -- Restarts client after this many character changes. 0 means 'disabled'.

function SetCharList(_table)
	--[[ Example
		SetCharList({
			{account=1, chars= {1,2,6}},
			{account=2, chars= {1,3}},
			{account=4, chars= {}},
		})

		Or for groups of accounts
		SetCharList({{
			{account=1, chars= {1,2,6}},
			{account=2, chars= {1,3}},
		},
		{
			{account=4, chars= {}},
		}})
	--]]

	-- Error check account lists
	local function checklist(_ltable)
		local errorcheck = false
		if type(_ltable) ~= "table" then
			errorcheck = true
		end
		for k,v in pairs(_ltable) do
			if type(v) ~= "table" then
				errorcheck = true
				break
			end
			if v.chars == nil then
				_ltable[k].chars = {}
			end
			if type(v.account) ~= "number" and type(v.chars ~= "table") then
				errorcheck = true
				break
			end
			for __,vv in pairs(v.chars) do
				if type(vv) ~= "number" then
					errorcheck = true
					break
				end
			end
			if errorcheck then break end
		end

		if errorcheck then
			error("SetCharList(); Invalid argument.")
		end
	end

	if _table[1].account ~= nil then -- Just a list
		checklist(_table)
	else
		for k,v in pairs (_table) do
			checklist(v)
		end
	end

	charList = table.copy(_table)
end

local function GetNextChar()
	local currAcc = getAcc()
	local currChar = getChar()
	local numChars = RoMScript("fastLoginNumChars")

	-- If groups of lists then find which list
	local lcharList
	if charList[1].account ~= nil then -- Just a list
		lcharList = charList
	else
		for k,group in pairs(charList) do
			for i,account in pairs(group) do
				if account.account == currAcc then
					lcharList = group
					break
				end
			end
		end
	end

	-- Find current char in list
	local found = false
	local nextAcc, nextChar
	if lcharList then
		for __, acc in pairs(lcharList) do
			-- Current account found now look for current character.
			if #acc.chars ~= 0 then
				for __, char in pairs(acc.chars) do
					if found == true then
						nextAcc = acc.account
						nextChar = char
						break
					end
					if currAcc == acc.account and currChar == char then
						-- next character is the one we want to load
						found = true
					end
				end
			else -- No chars specified for this account. Do all.
				if found == true then
					nextAcc = acc.account
					nextChar = 1
					break
				end
				if currAcc == acc.account then
					if currChar < numChars then
						nextAcc = acc.account
						nextChar = currChar + 1
						break
					else
						found = true
					end
				end
			end
			if nextAcc ~= nil then break end
		end
	end

	return nextChar, nextAcc
end

function ChangeChar(char, acc, chan)
	local reloads = RoMScript("CharsLoadedCount")
	if reloads ~= nil then
		CharacterLoadCount = reloads
	end

	if RestartClientInterval > 0 and CharacterLoadCount >= RestartClientInterval then
		if ChangeCharRestart(char, acc) ~= false then
			return
		end
	end

	if char == "current" then
		char = getChar()
		acc = nil
	end

	if char == nil then
		printf("Changing to next character")
	else
		printf("Changing to character %d", char)
	end

	if acc == nil or char == nil then
		printf(" on the same account")
	else
		printf(" account %s", tostring(acc))
	end

	if chan then
		printf(" channel %d", chan)
	end

	printf(".\n")
	if type(acc) == "string" then
		acc = "\""..acc.."\""
	end
	if type(chan) == "string" then
		chan = "\""..chan.."\""
	end

	-- Remember acc and char login details
	CurrentLoginAcc = acc or RoMScript("LogID")
	CurrentLoginChar = char or RoMScript("CHARACTER_SELECT.selectedIndex") + 1

	CharacterLoadCount = CharacterLoadCount + 1
	SlashCommand("/script ChangeChar("..(char or "nil")..","..(acc or "nil")..","..(chan or "nil")..")")

	rest(2000)
	waitForLoadingScreen()
	repeat rest(1000) until isInGame()
	rest(3000)

	player:update()

	-- Remember login server
	CurrentLoginServer = RoMScript ("GetCurrentRealm()")

end

function LoginNextChar()
 	-- Character list defined?
	if #charList == 0 then
		error("LoginNextChar(); No character list defined. Use \"SetCharList(_table)\" to define list before using \"LoginNextChar()\"")
	end

	nextChar, nextAcc = GetNextChar()

	if nextAcc == nil then
		if (Quit_Game == "true") then
			-- we will quit game
			print("Last player finished. We will Quit game")
			RoMScript("QuitGame()")
		else			-- Last character
			print("Last player finished.")
			player:logout()
		end
	end

	ChangeChar(nextChar, nextAcc)
end

function SetChannelForLogin(_value)
	RoMScript("} UserSelectedChannel = \"" .. _value .. "\" a={");
end

function PrintCharList()
	if charList[1].account ~= nil then -- Just a list
		for k,v in pairs(charList) do
			printf("account = %d\tchars = ",v.account)
			print(unpack(v.chars))
		end
	else
		for k,group in pairs(charList) do
			print("Account group "..k)
			for k,v in pairs(group) do
				printf("\taccount = %d\tchars = ",v.account)
				print(unpack(v.chars))
			end
		end
	end
end

function SetRestartClientSettings(frequency, client)
	if type(frequency) == "number" then
		RestartClientInterval = frequency
	end

	-- This variable is also set if the game was started with login.lua or the login function
	if client then
		current_client_lnk_in_use = client
	end
end

function ChangeCharRestart(char, acc, client)
	-- Check if 'login' userfunction is installed.
	if not login or not killClient then
		print("Please install the latest version of the \"login\" userfunction.")
		return false
	end

	if char == "current" then
		char = CurrentLoginChar or getChar()
	end

	if acc == nil then
		acc = CurrentLoginAcc or getAcc()
	end

	if char == nil or acc == nil then
		error("Character and account not specified.")
	end

	if client == nil then
		client = getServerLink()
	end

	if client == nil then
		print("No client shortcut link specified. Not restarting client.")
		return false
	end

	printf("Changing to character %d account %d with client lnk \"%s\"\n", char, acc, client)
	RestartClientCount = 1

	killClient() rest(1000)

	login(char, acc, client)

	return true
end

function IsLastChar(override)
	local currAcc = getAcc()
	local currChar = getChar()
	local numChars = RoMScript("fastLoginNumChars")

	if override == nil then
		if #charList > 0 then
			override = "LoginNextChar"
		else
			override = "ChangeChar"
		end
	end
	if override then override = string.lower(override) end

	if override == "changechar" then
		return (currChar == numChars) -- last char of this account
	elseif override == "loginnextchar" then
		return (GetNextChar() == nil)
	else
		error("Incorrect arg#1 used in 'IsLastChar'. Should be 'changechar', 'loginnextchar' or nil.")
	end

	return false
end

function getChar()
	return RoMScript("CHARACTER_SELECT.selectedIndex")
end

function getAcc()
	return RoMScript("LogID")
end

function getServerLink(server)
	if server == nil then
		server = CurrentLoginServer
	end

	if ServerLinkList and ServerLinkList[server] then
		return ServerLinkList[server]
	else
		return current_client_lnk_in_use
	end
end

-- Default onClientCrash function to restart client.
function onClientCrash()
	ChangeCharRestart("current")
end
What am I doing wrong? please help.. im baffled..

Re: Please help... wont change characters automaticly..

Posted: Sat Feb 11, 2017 6:46 am
by CoIogne01
hi
Soory I speek no english

so
1. downlodoad from this post viewtopic.php?f=27&t=1245&hilit=Loginxml
loginxml and put it in interface Folder (Runes of Magic/Interface/loginxml) and edit it for you.
usefunktion_loginnextchar.lua and put it in userfunktions Folder.

2.Put this in your Waypoint

Code: Select all

<onLoad> 	  
		
		function loadprofile()
			player = CPlayer.new();
			settings.load();
			settings.loadProfile(convertProfileName(player.Name))
		end

</onLoad>
1 client
3

Code: Select all

.<!-- # 31 --><waypoint x="890" z="12956" y="323">
			SetCharList({
					{account=45 , chars= {}},			-- all chars from this acc
			
					{account=45 , chars= {2,3,4}},		-- only chars 2,3,4			
				
					{account=46 , chars= {2,3,5,6,7}},				
				
					{account=47 , chars= {1,2,3,4,5,6}},			
			
					{account=48 , chars= {1,3,4,5,6,7}},			
			
					{account=49 , chars= {2,3,4,5,6,7,8}},			
				})
					LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)			-- loadPaths("daily2")
				</waypoint>
1-8 Client

Code: Select all

SetCharList({{
					{account=45 , chars= {2,3,4,5,6,7,8}},			
				},{
					{account=46 , chars= {2,3,4,5,6,7,8}},			
				},{
					{account=47 , chars= {1,2,3,4,5,6,7}},			
				},{
					{account=48 , chars= {1,3,4,5,6,7,8}},			
				},{
					{account=49 , chars= {}},						
				},{
					{account=66 , chars= {2,3,4,5,6,7,8}},			
				},{
					{account=67 , chars= {}},						
				},{
					{account=68 , chars= {2,3,4,5,6,7,8}},			
					}})
sampel -- After finishing this script do dailies but have each client do different dailies.

Code: Select all

 if IsLastChar() then				-- from any list
      if getAcc() == 45 then 		-- End of first CharList
         ChangeChar(1,45) 			-- First char of first acc.
         loadProfile()
         loadPaths("daily1")
      else 							-- if ist not acc 45
         ChangeChar(2,46) 			-- First char of second list.
         loadProfile()
         loadPaths("daily2")
      end
   else
      -- It's not the last character so continue with the list and reload this file.
			SetChannelForLogin("random")
			SetRestartClientSettings(7, rom)
			LoginNextChar()
			loadProfile()
			loadPaths(__WPL.FileName)
   end
next sampel

Code: Select all

<!-- #  1 --><waypoint x="111" z="5555" y="777" tag="main">
	speed("on")
	fly()
			queststate = getQuestStatus(ID)
			if (queststate == "incomplete") then
				__WPL:setWaypointIndex(__WPL:findWaypointTag("go1"))
			else
			local dqCount, dqPerDay = RoMScript("Daily_count()");
			if 10 > dqCount then 
				player:target_NPC(ID) 
				CompleteQuestByName(ID)		
				AcceptQuestByName(ID)	
				__WPL:setWaypointIndex(__WPL:findWaypointTag("main"))
			else
				SetCharList({{
					{account=45 , chars= {2,3,4}},					
				},{
					{account=46 , chars= {2,3,5,6,7}},				
				},{
					{account=47 , chars= {1,2,3,4,5,6}},			
				},{
					{account=48 , chars= {1,3,4,5,6,7}},			
				},{
					{account=49 , chars= {2,3,4,5,6,7,8}},			
				},{
					{account=66 , chars= {}},						
				},{
					{account=67 , chars= {}},						
				},{
					{account=68 , chars= {2,3,4,5,6,7,8}},			
				},{
					{account=70 , chars= {1}},						
				}})
					if getAcc() == 45 then 
						if IsLastChar() then 						
							ChangeChar(2,49) 								
							loadProfile()
							loadPaths(__WPL.FileName)
							else
						SetChannelForLogin("random")
						LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)
						end
					elseif getAcc() == 46 then 
						if IsLastChar() then 						
							ChangeChar(1,47) 								
							loadProfile()
							loadPaths(__WPL.FileName)
							else
						SetChannelForLogin("random")
						LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)
						end
					elseif getAcc() == 47 then 
						if IsLastChar() then 
							ChangeChar(7,47) 								
							loadProfile()
							loadPaths("AgileNerze1")
							else
						SetChannelForLogin("random")
						LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)
						end
					elseif getAcc() == 48 then 
						if IsLastChar() then
							ChangeChar(8,48) 								
							loadProfile()
							loadPaths("AgileNerze1")
							else
						SetChannelForLogin("random")
						LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)
						end
					elseif getAcc() == 49 then 
						if IsLastChar() then 
							ChangeChar(1,49) 								
							loadProfile()					
							loadPaths("AgileNerze1")
							else
						sendMacro("LeaveParty();");
						SetChannelForLogin("random")
						LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)
						end
					else
						SetChannelForLogin("random")
						LoginNextChar()
						loadProfile()
						loadPaths(__WPL.FileName)
					end
			end
		end
		</waypoint>
i hope it helps

Re: Please help... wont change characters automaticly..

Posted: Sat Feb 11, 2017 9:12 am
by BlubBlab
Okay then what is happening and what not ?

Re: Please help... wont change characters automaticly..

Posted: Fri Mar 10, 2017 5:39 pm
by Agrozet
http://www.solarstrike.net/phpBB3/viewt ... 043#p48043

viewtopic.php?f=27&t=1245&hilit=Loginxml

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
		__WPL:setWaypointIndex(9)

 	function relog()
	
	SetCharList({
   		{account=4, chars= {2,3}},
		{account=8, chars= {1,2,3,4,5,6,7,8}},
		{account=9, chars= {1,2,3,4,5,6,7,8}},
          })

	
		LoginNextChar()
		loadProfile()
		loadPaths(__WPL.FileName)
        	player:update()
	end
           
        	
		--[[ Objects by ID for multi-language use ]]--
			Blinsik		= GetIdName(112794) 				-- NPC    "Blinsik"
 
		function checkDQCount()
		cprintf(cli.lightblue,"=-=-= "..player.Name.." - "..RoMScript("Daily_count()").." daily quests completed. =-=-=\n")
		if (RoMScript("Daily_count()") == 10) then
		cprintf(cli.lightblue,"Completed max number 10 of daily quests.\n")
				goto_wp("Return")
			end
		end
	</onload>
	<!-- #  1 --><waypoint x="31856" z="4594" y="9" tag="Blinsik">
	player:target_NPC(Blinsik);
	CompleteQuestByName("Helping Them Grow");
  		checkDQCount();   
   	player:target_NPC(Blinsik);
   	AcceptQuestByName("Helping Them Grow");
	</waypoint>
	<!-- #  2 --><waypoint x="31852" z="4647" y="9">	</waypoint>
	<!-- #  3 --><waypoint x="31770" z="5030" y="-10">	</waypoint>
	<!-- #  4 --><waypoint x="31410" z="5717" y="-33">
	-- player:target_Object("Cleansing Crystal")
	player:target_Object(112976,300);
	if queststate == "incomplete" then
        queststate = getQuestStatus("Helping Them Grow");
	__WPL:setWaypointIndex(__WPL:findWaypointTag("crystal"));
	end
	</waypoint>
	<!-- #  5 --><waypoint x="31770" z="5030" y="-10">	</waypoint>
	<!-- #  6 --><waypoint x="31852" z="4647" y="9"> goto_wp("Blinsik")	</waypoint>
	<!-- #  7 --><waypoint x="32012" z="4452" y="19" tag="Return"> 	</waypoint>
	<!-- #  8 --><waypoint x="31834" z="4277" y="37">
	relog()
	</waypoint>
	<!-- #  9 --><waypoint x="32012" z="4452" y="19">	</waypoint>
</waypoints>