if you have the "" then it is looking for a string when what you really want is to look for nil itself.LogID ~= "nil"
Code: Select all
LogID ~= nil
if you have the "" then it is looking for a string when what you really want is to look for nil itself.LogID ~= "nil"
Code: Select all
LogID ~= nil
Code: Select all
Account1 = { UserName = "x", Password = "x", Server = "Siochain", },
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
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.lisa wrote:if you have the "" then it is looking for a string when what you really want is to look for nil itself.LogID ~= "nil"
Code: Select all
LogID ~= nil
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
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
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
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>
Code: Select all
When_Finished = "charlist"
Code: Select all
When_Finished = "relog" to When_Finished = "charlist"
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}},
}
when the 1st chacter finish and stopslib\lib\.lua:472: stack over flow
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
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>
Users browsing this forum: No registered users and 0 guests