• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - How to keep a LUA script running when I zone?

Joined
Jan 26, 2023
RedCents
1,247¢
How do I keep this (or any) Lua script running when I zone?
Thanks, in advance, for your help.

[CODE lang="Lua" title="Travel to LS"]---@type Mq
mq = require('mq')

function Main()
local use_gh = {
['Guild Lobby'] = true,
['The Bazaar'] = true,
['The Plane of Knowledge'] = true,
}
local current_zone = mq.TLO.Zone.Name()
print(current_zone)
if use_gh[current_zone] ~= nil then
mq.cmd('/travelto guildhalllrg')
while mq.TLO.Navigation.Active() do
mq.doevents()
mq.delay(100)
end
mq.delay(100)
end
if mq.TLO.Zone.Name() == "Palatial Guild Hall" then
mq.cmd('/Lua run guildclicky')
mq.delay(1000)
mq.cmd('/gc laurion')
end
end

Main()[/CODE]
 
you need a loop to say "hey keep this running"
in the above, it is "staying alive" in your while loop, but as soon as that while loop ends you're going to fall out of the bottom
Lua:
---@type Mq
mq = require('mq')
local run = true
local function GetMyZone()
    return mq.TLO.Zone.Name()
end

 local use_gh = {
        ['Guild Lobby'] = true,
        ['The Bazaar'] = true,
        ['The Plane of Knowledge'] = true,
    }

local function Main()
    print(GetMyZone())
    if use_gh[GetMyZone()] ~= nil then
        mq.cmd('/travelto guildhalllrg')
        while mq.TLO.Navigation.Active() do
            mq.doevents()
            mq.delay(100)
        end
        mq.delay(100)
    end
    if GetMyZone == "Palatial Guild Hall" then
        mq.cmd('/lua run guildclicky')
        mq.delay(1000)
        mq.cmd('/gc laurion')
    end
    if GetMyZone == "Laurion Inn" then
        print('I have arrived in laurion inn!')
        run = false
    end
end

while run do
    Main()
    mq.delay(500)
end

maybe something like that?
 
ok, i get it. mq.TLO.Navigation.Active() stops returning true during zoning
so put it in a loop with end condition of arrival at my destination
Thank you So Deep 😉
 
Thanks to Sic, here is my completed code doodle.
It just extends the guild clicky reach to the world, just remember you will go to the guild hall and you will use guild clicky. Even if you are already in the zone you want to go to. 🤣
Lua:
--[[
    Created by Pricklygoat723
    with thanks to Sic for teaching me not to trust outside variables to much
--]]
---@type Mq
mq = require('mq')

local args = {...}
local guild_clicky_name = args[1]
local travelto_set = false

local function PrintCmd(cmd)
    print(cmd)
    mq.cmd(cmd)
end

local function Main()
    local zone = mq.TLO.Zone.Name()
    if zone == 'Palatial Guild Hall' then
        print(zone)
        PrintCmd('/lua run guildclicky')
        mq.delay(1000)
        PrintCmd('/gc ' .. guild_clicky_name)
        return false
    elseif not travelto_set then
        print(zone)
        PrintCmd('/travelto guildhalllrg')
        travelto_set = true
    end
    return true
end

if guild_clicky_name ~= nil then
    while Main() do
        mq.delay(500)
    end
else
    print('Please pass a Guild Clicky name.')
end
 
Question - How to keep a LUA script running when I zone?

Users who are viewing this thread

Back
Top
Cart