为 WoW 制作一个文本框架(Lua)

我正在为在魔兽世界(私服)上工作的一款软件写一个档案。你需要检查游戏世界,并输出消息。问题是消息要么被显示而且档案关闭了,要么根本不显示。

检查游戏世界的函数:

data.SirusCheck = function()
    local result = false
    if (GetRealmName() == "Scourge x2 - 3.3.5a+"
     or GetRealmName() == "Neltharion x3 - 3.3.5a+"
     or GetRealmName() == "Sirus x10 - 3.3.5a+"
     or GetRealmName() == "Algalon x4 - 3.3.5a") then
        result = true
    end
    return result
end

这是档案的一部分:

if build == 30300 and data and toolkit and data.SirusCheck() then

---- Whole code here

    ni.bootstrap.profile("Retri_DarhangeR", queue, abilities, OnLoad, OnUnLoad);
else
    local queue = {
        "Error",
    }
    local abilities = {
        ["Error"] = function()
            ni.vars.profiles.enabled = false;
            if build > 30300 then
              ni.frames.floatingtext:message("This profile is meant for WotLK 3.3.5a! Sorry!")
            elseif data == nil then
              ni.frames.floatingtext:message("Data file is missing or corrupted!");
            elseif toolkit == nil then
              ni.frames.floatingtext:message("Toolkit file is missing or corrupted!")
            end
        end,
    }
    ni.bootstrap.profile("Retri_DarhangeR", queue, abilities);
end

想法是这样的:

if data.SirusCheck() then
    ni.frames.floatingtext:message("u here!")
end

在游戏中它看起来像这样:

https://i.stack.imgur.com/nY6e7.png

点赞