脚本示例

放下所有物品

 1Extension =
 2{
 3    Application   = "xlWarKey",
 4    Version       = "3.0",
 5    NameSpace     = "http://www.streamlet.org/Software/xlWarKey/",
 6
 7    ExtensionName = "放下所有物品",                               --脚本名称
 8    Author        = "溪流",                                       --脚本作者
 9    Description   = "该脚本可以用来一次性放下将物品栏所有东西。", --脚本描述
10
11    --这个脚本不需要参数配置
12    Configuration =
13    {
14    },
15
16    --入口函数
17    Entrance      = function (id)   --参数 id 仅仅是保留着以便将来使用,目前请忽略
18
19        --六个物品栏的相对位置
20        local coef =
21        {
22            {
23                x = 0.664,  --窗口宽度 * 0.664 是第一个格子中心的 x 坐标
24                y = 0.846   --窗口高度 * 0.664 是第一个格子中心的 y 坐标,下同
25            },
26            {
27                x = 0.713,
28                y = 0.846
29            },
30            {
31                x = 0.664,
32                y = 0.911
33            },
34            {
35                x = 0.713,
36                y = 0.911
37            },
38            {
39                x = 0.664,
40                y = 0.977
41            },
42            {
43                x = 0.713,
44                y = 0.977
45            },
46        };
47
48        local x, y = GetCursorPosition();   --取得当前鼠标位置
49        local w, h = GetClientSize();       --取得魔兽窗口大小
50
51        PressKey(Keys.VK_SHIFT);    --按下 Shift,开始插旗子
52        for i = 1, 6 do     -- 6 格子,循环 6 次
53            --将鼠标移动到格子位置
54            MoveMouse(w * coef[i].x, h * coef[i].y);
55            Delay(50);
56            --单击右键
57            PressMouseButton(Mouse.RBUTTON);
58            Delay(10);
59            ReleaseMouseButton(Mouse.RBUTTON);
60            Delay(50);
61            --将鼠标移到起始位置
62            MoveMouse(x, y);
63            Delay(50);
64            --单击左键
65            PressMouseButton(Mouse.LBUTTON);
66            Delay(10);
67            ReleaseMouseButton(Mouse.LBUTTON);
68            Delay(50);
69        end
70        ReleaseKey(Keys.VK_SHIFT);  --放开 Shift,结束插旗子
71
72        --为避免刚才按鼠标的时候选中了其他东西,按 F1 选中当前英雄
73        PressKey(Keys.VK_F1);
74        ReleaseKey(Keys.VK_F1);
75
76        return true;    --返回值也保留,将来使用,请 return true。
77    end
78};
79

喊话

 1Extension =
 2{
 3    Application   = "xlWarKey",
 4    Version       = "3.0",
 5    NameSpace     = "http://www.streamlet.org/Software/xlWarKey/",
 6
 7    ExtensionName = "喊话",         --脚本名称
 8    Author        = "溪流",         --脚本作者
 9    Description   = "该脚本可以用来在游戏中喊话。", --脚本描述
10
11    --下面这个是参数配置信息,可以将一个脚本用于多种场景
12    --比如喊话,可以让同一个脚本用于不同的喊话内容和喊话对象
13    Configuration =
14    {
15        --第一个参数,喊话对象
16        Target    =
17        {
18            Type  = "number",
19            Desc = "喊话对象,0 表示默认对象,1 表示向盟友,2 表示向所有人。"
20        },
21        --第二个参数,函数内容
22        Content   =
23        {
24            Type  = "string",
25            Desc = "喊话内容"
26        }
27    },
28
29    --入口函数
30    Entrance      = function(id) --参数 id 仅仅是保留着以便将来使用,目前请忽略
31
32        local config = Extension.Configuration;
33
34        --上面这一行是载入参数配置,接下来使用的话,
35        --config.Target 就是用户在软件界面上设置的喊话对象
36        --config.Content 就是用户在软件界面上设置的喊话内容
37
38        --接下来要模拟按回车调出聊天框
39        --根据不同的喊话对象使用直接回车、Ctrl+回车或者 Shift+回车
40
41        local ctrl = false;
42        local shift = false;
43
44        if config.Target == 1 then     --如果像盟友喊话,使用 Ctrl+回车
45            ctrl = true;
46        elseif config.Target == 2 then --如果像所有人喊话,使用 Shift+回车
47            shift = true;
48        end;
49
50        --按回车调出聊天框
51        PressKey(Keys.VK_RETURN, ctrl, shift);
52        ReleaseKey(Keys.VK_RETURN, ctrl, shift);
53        --将聊天内容设置到剪贴板
54        SetClipboard(config.Content);
55        --按 Ctrl+V 粘贴
56        PressKey(Keys.VK_V, true);
57        ReleaseKey(Keys.VK_V, true);
58        --按回车发送
59        PressKey(Keys.VK_RETURN);
60        ReleaseKey(Keys.VK_RETURN);
61
62        return true; --返回值也保留,将来使用,请 return true。
63    end
64};

鼠标连点

 1Extension =
 2{
 3    Application   = "xlWarKey",
 4    Version       = "3.0",
 5    NameSpace     = "http://www.streamlet.org/Software/xlWarKey/",
 6
 7    ExtensionName = "鼠标连点",                       --脚本名称
 8    Author        = "溪流",                           --脚本作者
 9    Description   = "该脚本可以用来在红警2中一次性造多个单位。",   --脚本描述
10
11    --下面这个是参数配置信息,可以将一个脚本用于多种场景
12    Configuration =
13    {
14        --第一个参数,连点次数
15        Count    =
16        {
17            Type  = "number",
18            Desc  = "连点次数"
19        }
20    },
21
22    --入口函数
23    Entrance      = function (id)   --参数 id 仅仅是保留着以便将来使用,目前请忽略
24
25        local config = Extension.Configuration;
26
27        --上面这一行是载入参数配置,接下来使用的话,
28        --config.Count 就是用户在软件界面上设置的连点次数
29
30        for i = 1,config.Count,1
31        do 
32            PressMouseButton(Mouse.LBUTTON);
33            ReleaseMouseButton(Mouse.LBUTTON);
34        end
35
36        return true;    --返回值也保留,将来使用,请 return true。
37    end
38};