nostalrius吧 关注:135,450贴子:882,102

回归wow香草。作为一个程序员,给大家一些分享。抛砖引玉

只看楼主收藏回复

闲来无事,给一些有简单写宏经验的朋友们一些福利吧。
介绍一下wow macro 1.0. 该版本的宏api比较原始,语法那就是lua语法了,对于没有编程经验的朋友写比较复杂的宏还是难以理解。但是优点就是大量的接口方法都没有被封,所以在60年代利用宏提升操作的幅度还是非常大的。
以下是wow UI Lua API available to user Macros and AddOns的在线文档,无需翻墙。该文档对于编写宏和开发插件的朋友们的帮助是非常大的。
http://wowwiki.wikia.com/wiki/World_of_Warcraft_API
接下来推荐两个必备插件。
BUFF&Debuff判断函数: Q猫对这个有详细的介绍,我用来简化我的代码。用来做判断目标或本人或宠物身上的buff和debuff.
http://60addons.com/topic/1266-1
SuperMacro 超级宏:这个就不解释了, 大家都懂
http://60addons.com/topic/229-1
陆续我会持续更新我自己本人编写的宏。。。。。。。。。
规范: 宏的编写,我认为要依照职业的战斗流程去编写, 即宏的执行过程是合理的,而不是实现了自动化脚本一样的复杂判断逻辑, 那样不利于宏的可读。
1. 实现多技能整合,简化UI界面技能摆放
2. 减少人脑的判断过程,对于多种情况,按一个按钮即可
陆续我会持续更新我自己本人编写的宏。。。。。。。。。
目前本人在玩小德,因为只有这个职业可以把宏的强大发挥到最大限度。


1楼2018-03-01 10:25回复
    不明觉厉


    IP属地:湖北来自Android客户端2楼2018-03-01 10:30
    回复
      通用版: 整合多个生活技能到一个技能格。
      按住alt释放,就唤出烹饪面板。反之就唤出急救面板。此宏我增加定义了其他按键方法,可以扩展。
      /script local c,s,con,a=CastSpellByName,IsShiftKeyDown(),IsControlKeyDown(),IsAltKeyDown();if a then c("烹饪");else c("急救");


      3楼2018-03-01 10:38
      收起回复
        想问问有没有鼠标指向治疗的宏比如鼠标指像目标不用点可以治疗~


        IP属地:江苏4楼2018-03-01 10:46
        收起回复
          demo2: 整合生活技能和战斗技能。如在战斗中就施放脚踢,没在战斗中召唤坐骑(备注:坐骑作为一个物品,在这里放在了动作条第36格栏位)
          /script local c,a,u=CastSpellByName,UnitAffectingCombat("player"),UseAction;if a then c("脚踢");else u(36);end;
          以下是动作格列表,我就不翻译了。很简单的英语
          ActionBar page 1: slots 1 to 12 -- Note exceptions below for other classes
          ActionBar page 2: slots 13 to 24
          ActionBar page 3 (Right ActionBar): slots 25 to 36
          ActionBar page 4 (Right ActionBar 2): slots 37 to 48
          ActionBar page 5 (Bottom Right ActionBar): slots 49 to 60
          ActionBar page 6 (Bottom Left ActionBar): slots 61 to 72
          Warrior Bonus Action Bars
          ActionBar page 1 Battle Stance: slots 73 to 84
          ActionBar page 1 Defensive Stance: slots 85 to 96
          ActionBar page 1 Berserker Stance: slots 97 to 108
          Druid Bonus Action Bars
          ActionBar page 1 Cat Form: slots 73 to 84
          ActionBar page 1 Prowl: slots 85 to 96
          ActionBar page 1 Bear Form: slots 97 to 108
          ActionBar page 1 Moonkin Form: slots 109 to 120
          Rogue Bonus Action Bars
          ActionBar page 1 Stealth: slots 73 to 84
          Priest Bonus Action Bars
          ActionBar page 1 Shadowform: slots 73 to 84
          Target Possessed Action Bar
          ActionBar page 1 Possess: slots 121-132


          5楼2018-03-01 10:57
          回复
            表示完全看不懂


            IP属地:浙江6楼2018-03-01 11:04
            回复
              大神,这个版本能不能实现萨满一键放四个图腾?


              来自iPhone客户端7楼2018-03-01 11:08
              收起回复
                demo3:鼠标指向救人的宏,(临时编写,尚未测试)
                /script local if UnitExists("mouseover") then ClearTarget();else CastSpellByName("复活术");SpellTargetUnit("mouseover");end;TargetLastTarget();


                8楼2018-03-01 11:47
                收起回复
                  典型的技术宅救世界


                  IP属地:浙江9楼2018-03-01 11:52
                  回复
                    这个更好点,如果鼠标悬浮存在,就清除当前目标,对鼠标指向施法复活术;不存在对目标施法复活术;连目标都不存在,就对本身施法该法术(当然复活术不能被施法,,,,)


                    11楼2018-03-01 11:58
                    回复
                      /script local u,c=UnitExists,CastSpellByName("复活术");if u("mouseover") then ClearTarget();c;SpellTargetUnit("mouseover");TargetLastTarget();else if u("target") then c;else c;SpellTargetUnit("player");end;


                      12楼2018-03-01 11:59
                      回复
                        一脸蒙蔽的进来,一脸蒙逼的出去。。。。。


                        14楼2018-03-01 12:23
                        回复
                          尝试写一下萨满一键4图腾。原理很简单,用多重条件语句判断四中图腾buff有没有作用于玩家本身。
                          在这里需要首先下载BUFF&Debuff判断函数插件:http://60addons.com/topic/1266-1
                          /script local u,c=IsBuffActive,CastSpellByName;t{"大地之力图腾","根基图腾","石肤图腾","治疗之泉图腾"};if not u(t[0],"player") then c(t[0]);elseif not u(t[1],"player") then c(t[1]);elseif not u(t[2],"player") then c(t[2]);else not u(t[3],"player") then c(t[3]);end;
                          大家只需要修改数组t中的四个图腾名字, 就可以对应插这4个图腾了。 由于代码没有测试,可能有问题。请及时反馈


                          15楼2018-03-01 12:56
                          回复