溪流 WarKey

脚本示例

鼠标连点

return {
    Application      = "xlWarKey",
    Version          = "3.4",

    ExtensionName    = "鼠标连点",
    ExtensionVersion = "1.1",
    Author           = "溪流",
    Description      = "在红警2中一次性造多个单位。",

    Configuration    =
    {
        Count = {
            Type = "number",
            Desc = "连点次数",
        },
    },

    Entrance         = function(config)
        local count = config.Count;

        for i = 1, count, 1
        do
            PressMouseButton(Mouse.LBUTTON);
            ReleaseMouseButton(Mouse.LBUTTON);
        end

        return true;
    end
};

放下所有物品

return {
    Application      = "xlWarKey",
    Version          = "3.4",

    ExtensionName    = "放下所有物品",
    ExtensionVersion = "1.1",
    Author           = "溪流",
    Description      = "在魔兽争霸中一次性放下将物品栏所有东西。",

    Configuration    = {
    },

    Entrance         = function(config)
        --六个物品栏的相对位置
        local coef = {
            { x = 0.664, y = 0.846 }, { x = 0.713, y = 0.846 },
            { x = 0.664, y = 0.911 }, { x = 0.713, y = 0.911 },
            { x = 0.664, y = 0.977 }, { x = 0.713, y = 0.977 },
        };

        local x, y = GetCursorPosition(); --取得当前鼠标位置
        local w, h = GetClientSize();     --取得魔兽窗口大小

        PressKey(Keys.VK_SHIFT);          --按下 Shift,开始插旗子
        for i = 1, 6 do                   --循环 6 个格子
            --将鼠标移动到格子位置
            MoveMouse(w * coef[i].x, h * coef[i].y);
            Delay(50);
            --单击右键
            PressMouseButton(Mouse.RBUTTON);
            Delay(10);
            ReleaseMouseButton(Mouse.RBUTTON);
            Delay(50);
            --将鼠标移到起始位置
            MoveMouse(x, y);
            Delay(50);
            --单击左键
            PressMouseButton(Mouse.LBUTTON);
            Delay(10);
            ReleaseMouseButton(Mouse.LBUTTON);
            Delay(50);
        end
        ReleaseKey(Keys.VK_SHIFT); --放开 Shift,结束插旗子

        --为避免刚才按鼠标的时候选中了其他东西,按 F1 选中当前英雄
        PressKey(Keys.VK_F1);
        ReleaseKey(Keys.VK_F1);

        return true;
    end
};

喊话

return {
    Application      = "xlWarKey",
    Version          = "3.4",

    ExtensionName    = "喊话",
    ExtensionVersion = "1.1",
    Author           = "溪流",
    Description      = "在魔兽争霸中喊话。",

    Configuration    =
    {
        Target  = {
            Type = "number",
            Desc = "喊话对象,0 表示默认对象,1 表示向盟友,2 表示向所有人。",
        },
        Content = {
            Type = "string",
            Desc = "喊话内容",
        },
    },

    Entrance         = function(config)
        local ctrl = false;
        local shift = false;

        if config.Target == 1 then     --如果像盟友喊话,使用 Ctrl+回车
            ctrl = true;
        elseif config.Target == 2 then --如果像所有人喊话,使用 Shift+回车
            shift = true;
        end;

        --按回车调出聊天框
        PressKey(Keys.VK_RETURN, ctrl, shift);
        ReleaseKey(Keys.VK_RETURN, ctrl, shift);
        --将聊天内容设置到剪贴板
        SetClipboard(config.Content);
        --按 Ctrl+V 粘贴
        PressKey(Keys.VK_V, true);
        ReleaseKey(Keys.VK_V, true);
        --按回车发送
        PressKey(Keys.VK_RETURN);
        ReleaseKey(Keys.VK_RETURN);

        return true;
    end
};

©2004-2025 溪流网站 保留所有权利