rock5's "fastLogin Revisited"

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: rock5's "fastLogin Revisited"

#461 Post by lisa » Fri Apr 19, 2013 7:11 pm

LogID ~= "nil"
if you have the "" then it is looking for a string when what you really want is to look for nil itself.

Code: Select all

LogID ~= nil
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

TopaZ
Posts: 17
Joined: Mon Jan 25, 2010 5:29 pm

Re: rock5's "fastLogin Revisited"

#462 Post by TopaZ » Fri Apr 26, 2013 11:01 am

Hello. When i clicking on acc login button, he stuck on server select screen. What can be wrong?
My conf:

Code: Select all

Account1 = {	UserName = "x",	Password = "x", Server = "Siochain",	},
Same problem with a bat file:

Code: Select all

@echo off
SET folder="F:\Games\Runes of Magic\micromacro\scripts\rom"
START micromacro.exe %folder%\login acc:1 char:1 client:Bot path:WPFile
Mb i miss something..
Thx

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#463 Post by rock5 » Fri Apr 26, 2013 11:09 am

Try selecting the server and clicking the tick box to remember the server. I think it's on the bottom left corner.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

TopaZ
Posts: 17
Joined: Mon Jan 25, 2010 5:29 pm

Re: rock5's "fastLogin Revisited"

#464 Post by TopaZ » Fri Apr 26, 2013 11:17 am

I thought that fastlogin must choose server by yourself. Why need "Server" variable in accountlogin.lua then? =/

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#465 Post by rock5 » Fri Apr 26, 2013 11:26 am

It does, but you have to initially select "Record Server". You should only need to do it once.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

TopaZ
Posts: 17
Joined: Mon Jan 25, 2010 5:29 pm

Re: rock5's "fastLogin Revisited"

#466 Post by TopaZ » Fri Apr 26, 2013 11:31 am

Can i check it forever in interface functions? Coz sometimes i manualy click Cancel when character comes to login server and Record server box becomes unchecked.. Thx

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#467 Post by rock5 » Fri Apr 26, 2013 11:36 am

Interesting idea. I'll look into it but I don't think it will work because you would have to select the server first. If you cancel you will just have to reselect the server. Cancelling isn't something you would do often so it shouldn't be much of a problem.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#468 Post by rock5 » Fri Apr 26, 2013 12:00 pm

Nope, I couldn't do it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

TopaZ
Posts: 17
Joined: Mon Jan 25, 2010 5:29 pm

Re: rock5's "fastLogin Revisited"

#469 Post by TopaZ » Fri Apr 26, 2013 12:19 pm

Looks like server side function..(

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: rock5's "fastLogin Revisited"

#470 Post by kenzu38 » Wed May 01, 2013 4:42 am

lisa wrote:
LogID ~= "nil"
if you have the "" then it is looking for a string when what you really want is to look for nil itself.

Code: Select all

LogID ~= nil
Sorry for the late reply. My net was really faulty these past couple of weeks. Yeah, I totally missed that, thanks for pointing it out.

Anyway:

Code: Select all

function Logout()
if LogID ~= nil then
DisconnectFromServer()
else
-- what should I put here so it does the normal logout function. Anyone know?
end
Thanks.

dx876234
Posts: 188
Joined: Sat Jul 24, 2010 6:13 am

Re: rock5's "fastLogin Revisited"

#471 Post by dx876234 » Wed May 08, 2013 1:46 am

For those who need even more account buttons, here is a 108 button version with the nessesary changes done to the userfunction_login as well.

-dx
Attachments
userfunction_login.lua
(9.3 KiB) Downloaded 113 times
Loginxml.zip
(26.08 KiB) Downloaded 137 times

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#472 Post by rock5 » Wed May 08, 2013 2:35 am

Nice.

I know there are people out there that want more buttons so they will be thankful to you. I could never be bothered because I think 65 is plenty but seeing as you have done it for me, I have no problems with rolling your version to the official version on the first post. You even renamed the version to 3.2 for me so I literally have to do nothing to it. :D

Edit: Ok, I know now you didn't update the version numbers. :oops:
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#473 Post by rock5 » Wed May 08, 2013 2:51 am

Forgot to talk about the userfunction. I think I'd like it to support both 65 and 108 button versions just so people don't have to update the loginxml if they don't want to. So I might have to add a version variable to fastlogin.

Edit: On second thought, I can't access the version variable when at the login screen so I'll leave the userfunction as it is. I might keep the changes I made to fastLogin though because it makes it easier to update the version number.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#474 Post by rock5 » Thu May 09, 2013 12:10 am

Updated to version 3.3 based on dx876234s version.

- Now there is 108 login buttons. Thx dx876234
- Added tooltips to the buttons you can Shift-Click.


@dx876234: Note, your version had a typo in accountlogin.xml for button 31 so the button wasn't visible. "240" should be "-240".
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Niko
Posts: 30
Joined: Sat Jul 28, 2012 8:23 am

Re: rock5's "fastLogin Revisited"

#475 Post by Niko » Thu May 09, 2013 7:11 pm

Hi, how could i set a character change in a chain of waypoints file?
I mean... i'm trying to do minigames, so i change from one waypoint file to another... The thing is, when and how could i do the character change? if i set a character list on the first file, how i do the change after the last file?

I thought i could do all minigames scripts in one file but... that's impossible... too many "onload" functions...

Any idea?

Sorry for my bad english!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#476 Post by rock5 » Fri May 10, 2013 4:56 am

Use the survivalnext.xml file.
http://www.solarstrike.net/phpBB3/viewt ... 714#p29714

Just set up the settings in it and call it last.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

newton666
Posts: 81
Joined: Fri Oct 22, 2010 3:16 pm

Re: rock5's "fastLogin Revisited"

#477 Post by newton666 » Fri May 10, 2013 6:05 pm

hi rock this is the first time i've tried this fastlogin and account change.
i've download all the latest files .
Everything works fine but i've got a small problem. When i use the "cot_tele" waypoint and when the 1st charcter finished. It logs out back into the character select screen and then in stead of changing to another account it just moves down to the next character on that same account and logs back in, does the way point and logs back out again.
It keeps on doing this till it gets to the last charcter on the account and then just stops on the character screen.
would be greatfull if you can spot what i have done wrong i've spent hours trying to work it out.
These are all the file which i have changed:-
This is my Loginxml:-

Code: Select all

FASTLOGIN_VERSION = 3.3

--===============================================================================
--============================ login screen settings ============================
--===============================================================================
-- >>>>>>>>>>>>>>>>>>>> CHOOSE WHETHER TO AUTO LOGIN OR NOT <<<<<<<<<<<<<<<<<<<<<
fastLoginAutoLogin = false
-- >>>>>>>>>>>>>>> ENTER YOUR USERNAME BETWEEN THE QUOTES BELOW <<<<<<<<<<<<<<<<<
fastLoginUser = ""
-- >>>>>>>>>>>>>>> ENTER YOUR PASSWORD BETWEEN THE QUOTES BELOW <<<<<<<<<<<<<<<<<
local fastLoginPass = ""
--===============================================================================
--========================== character select settings ==========================
--===============================================================================
-- >>>>> CHOOSE WHETHER TO AUTO ENTER THE GAME WORLD WITH THAT CHAR OR NOT <<<<<<
fastLoginAutoEnter = false
-- >>>>>>> ENTER THE NUMBER OF THE CHARACTER YOU WANT TO BE AUTO SELECTED <<<<<<<
fastLoginChrSel = 1
-- >>>>>>>> ENTER THE NUMBER OF THE CHANNEL YOU WANT TO BE AUTO SELECTED <<<<<<<<
fastLoginRegSel = 1
-- >>>>>>>>> SHOULD WE RELOG IN AFTER RETURNING TO CHARACTER SELECTION <<<<<<<<<<
fastLoginRelog = false
-- >>>>>>> CHOOSE WHETHER TO REMOVE THE ZOOM FROM THE CHAR SELECT OR NOT <<<<<<<<
fastLoginNoZoom = false
-- >>> CHOOSE WHAT IS ON LOGIN BUTTONS "Account", "Server" or "AccountServer" <<<
-- >> YOU CAN ALSO CHANGE THE DISPLAY BY SHIFT/LEFT MOUSE CLICKING THE BUTTONS <<
fastLoginButtonDisplay = "AccountServer"
-- >>>>> SET RACE NUMBER FOR DEFAULT RACE SELECTION WHEN CREATING CHARACTERS <<<<
fastLoginDefaultRace = nil;	-- 1-HUMAN, 2-ELF, 3-DWARF or nil for random Race.
-- >>>>>>>> SET CLASS NUMBER FOR DEFAULT CLASS WHEN CREATING CHARACTERS <<<<<<<<<
fastLoginDefaultClass = nil;	-- From 1 to 6 or nil for random Class.
-- >>>>> SET TO FALSE TO NOT SKIP THE CHARACTER DELETE CONFIRMATION DIALOG <<<<<<
fastLoginFastCharacterDelete = true
This my userfunction_LoginNextChar file which ive only changed the SetCharList

Code: Select all

--==<<           Rock5's LoginNextChar Functions              >>==--
--==<<             By Rock5        Version 1.50               >>==--
--==<<                                                        >>==--
--==<<       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)
		SetCharList({
			{account=1, chars= {3}},
			{account=2, chars= {2}},
			{account=3, chars= {3}},
			{account=4, chars= {1}},
			{account=5, chars= {1}},
			{account=6, chars= {1}},
			{account=7, chars= {1}},
			{account=9, chars= {1}},
			{account=10, chars= {1}},


		})


	-- 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
	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

	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

	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()
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 = getChar()
	end

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

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

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

	if client == nil then
		client = current_client_lnk_in_use
	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
And this is the "cot_tele" way point which i downloaded :-

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL" >
<!-- Rock5's Course of Terror waypoint file with teleport -->
<!--   version 1.81 . Thanks to lisa for original script  -->
<onload><![CDATA[
	--=== User Options ===--

	When_Finished         = "relog"
		-- "end" to end script, "relog" to log next character and "waypointfilename" to load that waypointfile.
	ExitBeforeNextFile    = false	-- If you want it to exit game before loading next "waypointfilename".

	CharList = {
			{account=1, chars= {3}},
			{account=2, chars= {2}},
			{account=3, chars= {3}},
			{account=4, chars= {1}},
			{account=5, chars= {1}},
			{account=6, chars= {1}},
			{account=7, chars= {1}},
			{account=9, chars= {1}},
			{account=10, chars= {1}},



		}
	--====================--


	--====================--

	function checkRelog()
		-- Log result
		local filename = getExecutionPath() .. "/logs/cot.log";
		local file, err = io.open(filename, "a+");
		if file then
			file:write("Acc: "..RoMScript("GetAccountName()").."\tName: " ..string.format("%-10s",player.Name ).." \tDate: " .. os.date() ..
			" \tShells gained/total: "..inventory:getItemCount(240181) - numshells.."/".. inventory:getItemCount(240181).. "\t" ..logentry .. "\n")
			file:close();
		end

		if When_Finished == "relog" then
			sendMacro("}LoginNextToon=true;a={")
			sendMacro("Logout();");
			waitForLoadingScreen();
			loadPaths(__WPL.FileName);
		elseif When_Finished == "charlist" then
			SetCharList(CharList)
			LoginNextChar()
			loadPaths(__WPL.FileName);
		elseif When_Finished == "end" then
			error("Ending script",2)
		else
			-- Leave before loading next waypoint file.
			if ExitBeforeNextFile == true then
				local Malatina = 113120
				local IWantToLeave = RoMScript("TEXT(\"SC_111813_YU_42\")")
				local Confirm = RoMScript("TEXT(\"SC_OKAY\")")

				-- Exit COT if still in COT
				if getZoneId() == 353 and player:target_NPC(Malatina) then
					ChoiceOptionByName(IWantToLeave)
					ChoiceOptionByName(Confirm)
					waitForLoadingScreen()
					yrest(3000)
				end
			end

			if not string.find(When_Finished,".", 1, true) then
				When_Finished = When_Finished .. ".xml"
			end
			local filename = getExecutionPath() .. "/waypoints/" .. When_Finished
			local file, err = io.open(filename, "r");
			if file then
				file:close();
				loadPaths(When_Finished)
			else
				error("'When_Finished' option is invalid",0)
			end
		end
	end

	function checkaggro()
		repeat
			player:update()
			if player.Battling then
				local clown = player:findEnemy(true)
				player.X = clown.X player.Z = clown.Z -- Temporarily change player coords so we can find nearest seal to mob
				local seal = player:findNearestNameOrId(102384)
				player:target(seal) -- kills the summoning portal and not the ghost clown.
				player:fight()
				yrest(2000) -- give a couple of seconds for the clown to disappear.
				player:update()
			end
		until not player.Battling
	end

	function getallkeys()
		local lastSealAddress = 0
		repeat
			player:update()
			local seal = player:findNearestNameOrId(113112, lastSealAddress)
			if seal then
				-- goto seal
				teleport(nil,nil,75)            -- go up to height if 75
				teleport(seal.X, seal.Z, 75)	-- teleport to above seal
				teleport(seal.X + 1, seal.Z, 57)	-- teleport in range to click seal

				-- click seal
				repeat
					checkaggro()
					player:target(seal)
					yrest(100)
					Attack()
					yrest(1000)
					player:update()
				until player:findNearestNameOrId(113106) -- until a key appears

				-- Remember last seal
				lastSealAddress = seal.Address

				-- Collect key
				local keys = inventory:itemTotalCount(203027)

				repeat
					checkaggro()
					player:target_Object(113106,nil,nil,true) -- harvests key
				until inventory:itemTotalCount(203027) == keys + 1
				yrest(500)

			end
		until gotAllKeys()
	end

	function gotogate()
		teleport(nil,nil,75) 			-- go up to height if 75
		teleport(4080,3948.5,75) 		-- teleport to above portal
		teleport(4080,3974,30) 		-- teleport into portal
		player:faceDirection(3.14/2) -- Face forward
		keyboardPress( settings.hotkeys.MOVE_FORWARD.key );

		repeat
			player:update()
			dist = distance(player.X, player.Z, 4081, 3335)
			yrest(700)
		until 100 > dist
		yrest(500)
		player:update()
		if 18 > player.Y then
			print("\a")
			local y = player.Y
			for i = 1,20 do teleport(nil,nil,y+i) player:turnDirection(1) yrest(50) end
			keyboardPress( settings.hotkeys.MOVE_FORWARD.key ); yrest(500)
			player:update()
			if 18 > player.Y then
				print("\a\aplayer is stuck")
				player:sleep()
			end
		end

		printf("Distance checked and continuing.\n")
	end

	function gotAllKeys()
		local room = currentRoom()
		local keys = inventory:itemTotalCount(203027)
		local keyGoal = (room == 1 and 1) or (room == 2 and 3) or (room == 3 and 6) or (room == 4 and 10)
		return keys >= keyGoal
	end

	function currentRoom()
		return memoryReadRepeat("int",getProc(), player.Address + 0x1cc)
	end



	if teleport_GetVersion == nil or  teleport_GetVersion() < 2.0 then
		cprintf(cli.yellow,"This waypoint file requires the userfunction \"teleport\" version 2.0 or newer.\n")
		error("You can download it from this address. http://www.solarstrike.net/phpBB3/viewtopic.php?f=27&t=2721",0)
	end

	numshells = inventory:getItemCount(240181)
	logentry = nil
	Malatina = GetIdName(111813)

	table.insert(settings.profile.friends, "102382") -- adds the barrier to friend so doesn't try to kill it.
	changeProfileOption("HARVEST_DISTANCE", 450);

	local zoneid = RoMScript("GetZoneID()")
	if zoneid ~= 353 then -- not in Course of Terror
		RoMScript("TimeKeeperFrame:Hide()") -- Just in case it's still open from another minigame (bug)
		if 50 > player.Level and (player.Level2 >= 50 or player.Level3 >= 50) then
			-- Wait for user to change class
			cprintf(cli.yellow,"If you want to earn Phirius Shells, change to your 50+ class before continuing.\n")
			player:sleep()
		end
		if inventory:itemTotalCount(240181) > 950 then
			-- Wait for user to use some shells.
			cprintf(cli.yellow,"Reaching the maximum number of Phirius Shells (1000). Please spend some before continuing.\n")
			player:sleep()
			numshells = inventory:getItemCount(240181)
		end
		local empties = inventory:itemTotalCount(0)
		if 10 > empties then
			-- Wait for user to make some space in inventory.
			cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
			player:sleep()
		end
		if 30 > inventory:itemTotalCount(203038) then
			print("Not enough Phirius Token Coins.")
			logentry = "Not enough Phirius Token Coins."
			checkRelog()
			return
		end

		-- Try to find Malatina and teleport in
		if player:target_NPC(Malatina) then
			yrest(1000)

			if 2 > RoMScript("GetNumSpeakOption()") then -- try again
				player:target_NPC(Malatina) yrest(1000)
			end

			sendMacro("ChoiceOption(2);");
			yrest(2000)

			if RoMScript("GetNumSpeakOption()") > 0 then -- enter game
				sendMacro("ChoiceOption(1);");
				if not waitForLoadingScreen(30) then
					print("Failed to teleport into Course of Terror")
					logentry = "Failed to teleport into Course of Terror."
					checkRelog()
				end
				yrest(1000)
				__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z))
			else
				print("This character already did Course of Terror.")
				logentry = "Already did Course of Terror."
				checkRelog()
			end
		else
			print("You are too far from Malatina")
			logentry = "Too far from Malatina."
			checkRelog()
		end
	end

]]></onload>

<!-- AT THE START POINT -->
	<!-- # 1 --><waypoint x="4081" z="3340" y="18" tag="START">
		if currentRoom() == 1 then -- Just arrived
			if not RoMScript("TimeKeeperFrame:IsVisible()") then
				player:target_NPC(Malatina);
				yrest(2000)
				sendMacro("ChoiceOption(2);");
				yrest(2000)
				sendMacro("ChoiceOption(1);");
				repeat yrest(1000) until RoMScript("TimeKeeperFrame:IsVisible()")
			end
		elseif currentRoom() > 4 then -- Finished. Open chests
			--=== Create table for chests ===--
			chests = {left = {}, right = {}}

			local objectList = CObjectList();
			objectList:update();
			local objSize = objectList:size()

			for i = 0,objSize do
				local obj = objectList:getObject(i);
				if obj.Id == 113137 then
					if obj.X > 4081 then -- right side
						table.insert(chests.right, table.copy(obj))
					else -- left side
						table.insert(chests.left, table.copy(obj))
					end
				end
			end

			-- Sort chests
			table.sort(chests.left, function(a,b) return b.Z > a.Z end)
			table.sort(chests.right, function(a,b) return a.Z > b.Z end)

			-- Get left side
			for k,v in pairs(chests.left) do
				player:target(v.Address);
				Attack()
				yrest(2000)
				Attack()
				if k == 1 then yrest(2000) Attack() end
				repeat
					yrest(2000)
					player:update()
				until not player.Casting
				repeat yrest(500) player:update() until player.Stance== 0
			end

			-- Get right side
			for k,v in pairs(chests.right) do
				player:target(v.Address);
				Attack()
				yrest(2000)
				Attack()
				if k == 1 then yrest(2000) Attack() end
				repeat
					yrest(2000)
					player:update()
				until not player.Casting
				repeat yrest(500) player:update() until player.Stance== 0
			end

			player:moveTo(CWaypoint(4081,3335))

			local secondsleft = RoMScript("TimeKeeperFrame.startTime-GetTime()")
			local mm = string.format("%2s", math.floor(secondsleft/ 60))
			local ss = string.format("%02s", math.floor(math.mod(secondsleft, 60)))
			printf("Succeeded with %s:%s remaining.\n",mm,ss)
			logentry = string.format("Succeeded with %s:%s remaining.",mm,ss)
			checkRelog()
		end
	</waypoint>
<!-- JUST BEFORE THE DOOR -->
	<!-- # 2 --><waypoint x="4081" z="3499" y="18" >	</waypoint>
<!-- JUST AFTER THE DOOR -->
	<!-- # 3 --><waypoint x="4081" z="3600" y="28" >
		logentry = "Ran out of time." -- default
		yrest(3000)
		fly()
		getallkeys()
		gotogate()
		flyoff()
		__WPL:setWaypointIndex(__WPL:findWaypointTag("START"));
	</waypoint>
</waypoints>
Thanks rock

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: rock5's "fastLogin Revisited"

#478 Post by rock5 » Sat May 11, 2013 12:16 am

Sorry, the option is there but it's not listed in the comment. What you want to use is

Code: Select all

When_Finished         = "charlist"
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

newton666
Posts: 81
Joined: Fri Oct 22, 2010 3:16 pm

Re: rock5's "fastLogin Revisited"

#479 Post by newton666 » Sat May 11, 2013 1:52 am

thanks rock for quick reply but what you are saying that i should change all the "

Code: Select all

When_Finished         = "relog" to When_Finished         = "charlist"
in the "cot-ter" script like this

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL" >
<!-- Rock5's Course of Terror waypoint file with teleport -->
<!--   version 1.81 . Thanks to lisa for original script  -->
<onload><![CDATA[
   --=== User Options ===--

   When_Finished         = "Charlist"
      -- "end" to end script, "relog" to log next character and "waypointfilename" to load that waypointfile.
   ExitBeforeNextFile    = false   -- If you want it to exit game before loading next "waypointfilename".

   CharList = {
         {account=1, chars= {3}},
         {account=2, chars= {2}},
         {account=3, chars= {3}},
         {account=4, chars= {1}},
         {account=5, chars= {1}},
         {account=6, chars= {1}},
         {account=7, chars= {1}},
         {account=9, chars= {1}},
         {account=10, chars= {1}},



      }
or do need to change it somewere else or have i mised a userfunction to download?
i know im stupid but i'm learning
thx rock

newton666
Posts: 81
Joined: Fri Oct 22, 2010 3:16 pm

Re: rock5's "fastLogin Revisited"

#480 Post by newton666 » Sat May 11, 2013 2:08 am

ok rock didnt work when i changed the cot-tel script from "When_Finished = "relog" to When_Finished = "charlist"
getting a error
lib\lib\.lua:472: stack over flow
when the 1st chacter finish and stops
you must think im really stupid now.
This my userfunction_LoginNextChar file which ive only changed the SetCharList

Code: Select all

--==<<           Rock5's LoginNextChar Functions              >>==--
--==<<             By Rock5        Version 1.50               >>==--
--==<<                                                        >>==--
--==<<       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)
		SetCharList({
			{account=1, chars= {3}},
			{account=2, chars= {2}},
			{account=3, chars= {3}},
			{account=4, chars= {1}},
			{account=5, chars= {1}},
			{account=6, chars= {1}},
			{account=7, chars= {1}},
			{account=9, chars= {1}},
			{account=10, chars= {1}},


		})



	-- 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
	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

	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

	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()
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 = getChar()
	end

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

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

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

	if client == nil then
		client = current_client_lnk_in_use
	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
And this is the "cot_tele" way point which i downloaded and When_Finished = "charlist" and charcter listing :-

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL" >
<!-- Rock5's Course of Terror waypoint file with teleport -->
<!--   version 1.81 . Thanks to lisa for original script  -->
<onload><![CDATA[
	--=== User Options ===--

	When_Finished         = "charlist"
		-- "end" to end script, "relog" to log next character and "waypointfilename" to load that waypointfile.
	ExitBeforeNextFile    = false	-- If you want it to exit game before loading next "waypointfilename".

	CharList = {
			{account=1, chars= {3}},
			{account=2, chars= {2}},
			{account=3, chars= {3}},
			{account=4, chars= {1}},
			{account=5, chars= {1}},
			{account=6, chars= {1}},
			{account=7, chars= {1}},
			{account=9, chars= {1}},
			{account=10, chars= {1}},



		}
	--====================--


	--====================--

	function checkRelog()
		-- Log result
		local filename = getExecutionPath() .. "/logs/cot.log";
		local file, err = io.open(filename, "a+");
		if file then
			file:write("Acc: "..RoMScript("GetAccountName()").."\tName: " ..string.format("%-10s",player.Name ).." \tDate: " .. os.date() ..
			" \tShells gained/total: "..inventory:getItemCount(240181) - numshells.."/".. inventory:getItemCount(240181).. "\t" ..logentry .. "\n")
			file:close();
		end

		if When_Finished == "relog" then
			sendMacro("}LoginNextToon=true;a={")
			sendMacro("Logout();");
			waitForLoadingScreen();
			loadPaths(__WPL.FileName);
		elseif When_Finished == "charlist" then
			SetCharList(CharList)
			LoginNextChar()
			loadPaths(__WPL.FileName);
		elseif When_Finished == "end" then
			error("Ending script",2)
		else
			-- Leave before loading next waypoint file.
			if ExitBeforeNextFile == true then
				local Malatina = 113120
				local IWantToLeave = RoMScript("TEXT(\"SC_111813_YU_42\")")
				local Confirm = RoMScript("TEXT(\"SC_OKAY\")")

				-- Exit COT if still in COT
				if getZoneId() == 353 and player:target_NPC(Malatina) then
					ChoiceOptionByName(IWantToLeave)
					ChoiceOptionByName(Confirm)
					waitForLoadingScreen()
					yrest(3000)
				end
			end

			if not string.find(When_Finished,".", 1, true) then
				When_Finished = When_Finished .. ".xml"
			end
			local filename = getExecutionPath() .. "/waypoints/" .. When_Finished
			local file, err = io.open(filename, "r");
			if file then
				file:close();
				loadPaths(When_Finished)
			else
				error("'When_Finished' option is invalid",0)
			end
		end
	end

	function checkaggro()
		repeat
			player:update()
			if player.Battling then
				local clown = player:findEnemy(true)
				player.X = clown.X player.Z = clown.Z -- Temporarily change player coords so we can find nearest seal to mob
				local seal = player:findNearestNameOrId(102384)
				player:target(seal) -- kills the summoning portal and not the ghost clown.
				player:fight()
				yrest(2000) -- give a couple of seconds for the clown to disappear.
				player:update()
			end
		until not player.Battling
	end

	function getallkeys()
		local lastSealAddress = 0
		repeat
			player:update()
			local seal = player:findNearestNameOrId(113112, lastSealAddress)
			if seal then
				-- goto seal
				teleport(nil,nil,75)            -- go up to height if 75
				teleport(seal.X, seal.Z, 75)	-- teleport to above seal
				teleport(seal.X + 1, seal.Z, 57)	-- teleport in range to click seal

				-- click seal
				repeat
					checkaggro()
					player:target(seal)
					yrest(100)
					Attack()
					yrest(1000)
					player:update()
				until player:findNearestNameOrId(113106) -- until a key appears

				-- Remember last seal
				lastSealAddress = seal.Address

				-- Collect key
				local keys = inventory:itemTotalCount(203027)

				repeat
					checkaggro()
					player:target_Object(113106,nil,nil,true) -- harvests key
				until inventory:itemTotalCount(203027) == keys + 1
				yrest(500)

			end
		until gotAllKeys()
	end

	function gotogate()
		teleport(nil,nil,75) 			-- go up to height if 75
		teleport(4080,3948.5,75) 		-- teleport to above portal
		teleport(4080,3974,30) 		-- teleport into portal
		player:faceDirection(3.14/2) -- Face forward
		keyboardPress( settings.hotkeys.MOVE_FORWARD.key );

		repeat
			player:update()
			dist = distance(player.X, player.Z, 4081, 3335)
			yrest(700)
		until 100 > dist
		yrest(500)
		player:update()
		if 18 > player.Y then
			print("\a")
			local y = player.Y
			for i = 1,20 do teleport(nil,nil,y+i) player:turnDirection(1) yrest(50) end
			keyboardPress( settings.hotkeys.MOVE_FORWARD.key ); yrest(500)
			player:update()
			if 18 > player.Y then
				print("\a\aplayer is stuck")
				player:sleep()
			end
		end

		printf("Distance checked and continuing.\n")
	end

	function gotAllKeys()
		local room = currentRoom()
		local keys = inventory:itemTotalCount(203027)
		local keyGoal = (room == 1 and 1) or (room == 2 and 3) or (room == 3 and 6) or (room == 4 and 10)
		return keys >= keyGoal
	end

	function currentRoom()
		return memoryReadRepeat("int",getProc(), player.Address + 0x1cc)
	end



	if teleport_GetVersion == nil or  teleport_GetVersion() < 2.0 then
		cprintf(cli.yellow,"This waypoint file requires the userfunction \"teleport\" version 2.0 or newer.\n")
		error("You can download it from this address. http://www.solarstrike.net/phpBB3/viewtopic.php?f=27&t=2721",0)
	end

	numshells = inventory:getItemCount(240181)
	logentry = nil
	Malatina = GetIdName(111813)

	table.insert(settings.profile.friends, "102382") -- adds the barrier to friend so doesn't try to kill it.
	changeProfileOption("HARVEST_DISTANCE", 450);

	local zoneid = RoMScript("GetZoneID()")
	if zoneid ~= 353 then -- not in Course of Terror
		RoMScript("TimeKeeperFrame:Hide()") -- Just in case it's still open from another minigame (bug)
		if 50 > player.Level and (player.Level2 >= 50 or player.Level3 >= 50) then
			-- Wait for user to change class
			cprintf(cli.yellow,"If you want to earn Phirius Shells, change to your 50+ class before continuing.\n")
			player:sleep()
		end
		if inventory:itemTotalCount(240181) > 950 then
			-- Wait for user to use some shells.
			cprintf(cli.yellow,"Reaching the maximum number of Phirius Shells (1000). Please spend some before continuing.\n")
			player:sleep()
			numshells = inventory:getItemCount(240181)
		end
		local empties = inventory:itemTotalCount(0)
		if 10 > empties then
			-- Wait for user to make some space in inventory.
			cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
			player:sleep()
		end
		if 30 > inventory:itemTotalCount(203038) then
			print("Not enough Phirius Token Coins.")
			logentry = "Not enough Phirius Token Coins."
			checkRelog()
			return
		end

		-- Try to find Malatina and teleport in
		if player:target_NPC(Malatina) then
			yrest(1000)

			if 2 > RoMScript("GetNumSpeakOption()") then -- try again
				player:target_NPC(Malatina) yrest(1000)
			end

			sendMacro("ChoiceOption(2);");
			yrest(2000)

			if RoMScript("GetNumSpeakOption()") > 0 then -- enter game
				sendMacro("ChoiceOption(1);");
				if not waitForLoadingScreen(30) then
					print("Failed to teleport into Course of Terror")
					logentry = "Failed to teleport into Course of Terror."
					checkRelog()
				end
				yrest(1000)
				__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z))
			else
				print("This character already did Course of Terror.")
				logentry = "Already did Course of Terror."
				checkRelog()
			end
		else
			print("You are too far from Malatina")
			logentry = "Too far from Malatina."
			checkRelog()
		end
	end

]]></onload>

<!-- AT THE START POINT -->
	<!-- # 1 --><waypoint x="4081" z="3340" y="18" tag="START">
		if currentRoom() == 1 then -- Just arrived
			if not RoMScript("TimeKeeperFrame:IsVisible()") then
				player:target_NPC(Malatina);
				yrest(2000)
				sendMacro("ChoiceOption(2);");
				yrest(2000)
				sendMacro("ChoiceOption(1);");
				repeat yrest(1000) until RoMScript("TimeKeeperFrame:IsVisible()")
			end
		elseif currentRoom() > 4 then -- Finished. Open chests
			--=== Create table for chests ===--
			chests = {left = {}, right = {}}

			local objectList = CObjectList();
			objectList:update();
			local objSize = objectList:size()

			for i = 0,objSize do
				local obj = objectList:getObject(i);
				if obj.Id == 113137 then
					if obj.X > 4081 then -- right side
						table.insert(chests.right, table.copy(obj))
					else -- left side
						table.insert(chests.left, table.copy(obj))
					end
				end
			end

			-- Sort chests
			table.sort(chests.left, function(a,b) return b.Z > a.Z end)
			table.sort(chests.right, function(a,b) return a.Z > b.Z end)

			-- Get left side
			for k,v in pairs(chests.left) do
				player:target(v.Address);
				Attack()
				yrest(2000)
				Attack()
				if k == 1 then yrest(2000) Attack() end
				repeat
					yrest(2000)
					player:update()
				until not player.Casting
				repeat yrest(500) player:update() until player.Stance== 0
			end

			-- Get right side
			for k,v in pairs(chests.right) do
				player:target(v.Address);
				Attack()
				yrest(2000)
				Attack()
				if k == 1 then yrest(2000) Attack() end
				repeat
					yrest(2000)
					player:update()
				until not player.Casting
				repeat yrest(500) player:update() until player.Stance== 0
			end

			player:moveTo(CWaypoint(4081,3335))

			local secondsleft = RoMScript("TimeKeeperFrame.startTime-GetTime()")
			local mm = string.format("%2s", math.floor(secondsleft/ 60))
			local ss = string.format("%02s", math.floor(math.mod(secondsleft, 60)))
			printf("Succeeded with %s:%s remaining.\n",mm,ss)
			logentry = string.format("Succeeded with %s:%s remaining.",mm,ss)
			checkRelog()
		end
	</waypoint>
<!-- JUST BEFORE THE DOOR -->
	<!-- # 2 --><waypoint x="4081" z="3499" y="18" >	</waypoint>
<!-- JUST AFTER THE DOOR -->
	<!-- # 3 --><waypoint x="4081" z="3600" y="28" >
		logentry = "Ran out of time." -- default
		yrest(3000)
		fly()
		getallkeys()
		gotogate()
		flyoff()
		__WPL:setWaypointIndex(__WPL:findWaypointTag("START"));
	</waypoint>
</waypoints>

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests