Use Lua scripting language to create the World of Warcraft wow plug-in

Source: Internet
Author: User
Tags blizzard

1 wow internal Programming Method
First: Open the built-in macro editing window of wow --> input/script or wow API to directly create a simple macro

(1) kneel down and propose macro
/Kneel
/Say if you don't marry me, I will never get up

(2) switch the window and full screen mode of the wow Program
/Script setcvar ("gxwindow", 1-getcvar ("gxwindow "));
/Console gxrestart

(3) Open All packages
/Script openallbags ()
/Script closebag (x) (X = 4 ~ 0)

(4) Alt key switchover
Use ALT to switch the big ice arrow
/Cast [modifier: alt] cold ice arrow (level 1); cold ice arrow (Level 11)
Switch AOE fire/snow with ALT
/Cast [modifier: alt] Flame storm (Level 6); blizzard (Level 6)
Use ALT to switch the magic blast
/Use moamam eye
/Cast [modifier: alt] Magic blast (level 1); blizzard (MAGIC blast 6)

(5) ornaments + skills (multiple ornaments + stopcasting)
/Use Zanda to pull the hero amulet
/Cast fireball (Level 12)

(6) flashing macro (after one flash, you need to press it again to adjust the direction)
/Stopcasting
/Cast flash
/Script flipcamerayaw (180 );

(7) Recruit BB and immediately attack the target (two times for connection)
/Cast [nopet] Summon Water Elements
/Stopmacro [target = pettarget, exists]
/Petattack

Type 2: Open the built-in macro editing window of wow --> Use wow API + Lua to create a complex macro (less than 255 words)
GOAL: To put all the soul fragments of the first four packages in the last package
/Script
Bag = 0 CW = 1 SC = 1 -- defines the variable. Bag is the number of the package. CW indicates the slot of the package. SC points to the slot in the last package.
For bag =, 1 do -- starts from package 0, ends with package 3, and does not search for the last package.
For CW =, 1 do -- assume that all packages have 16 slots. If there are not so many slots, the packages can also be used.
If getcontaineritemlink (bag, Cw )~ = Nil -- determines whether the slot is null. If it is null, it will jump directly to the next slot.
Then
If string. Find (getcontaineriteminfo (bag, Cw), "Gem") -- determines whether the slot contains soul fragments.
Then
While string. Find (getcontaineriteminfo (4, SC), "Gem") Do SC = SC + 1 end
-- Determine whether there are soul fragments in the last package. If yes, point to the next slot of the package.
Pickupcontaineritem (bag, Cw)
Pickupcontaineritem (4, SC)
Pickupcontaineritem (bag, Cw) -- these three statements control the exchange of soul fragments and objects in the last package
SC = SC + 1 -- point the slot pointer of the last packet to the next slot after each shard is placed.
End -- (then end)
End -- (then end)
End -- (for end)
End -- (for end loop ends)

Because the macro limit is 255 characters, you need to simplify the process, starting with the function with the longest content. Create the following macros:
/Script function p (c, d) pickupcontaineritem (c, d) End
/Script Function I (E, F)
If getcontaineriteminfo (e, f) then return string. Find (getcontaineriteminfo (E, F), "Gem") else return nil end
End
The original macro is changed:
/Script
Bag = 0 CW = 1 SC = 1
For bag = 0, 3, 1 do
For CW = 1, 16, 1 do
If G (bag, Cw )~ = Nil
Then
If I (bag, Cw)
Then
While I (4, SC) Do SC = SC + 1 end
P (bag, Cw)
P (4, SC)
P (bag, Cw)
SC = SC + 1
End
End
End
End
The definition of unnecessary variables and variables that are too long can be changed:
/Script
S = 1
For G = 0, 3 do
For W = 1, 16 do
If G (G, W)
Then
If I (G, W)
Then
While I (4, S) Do S = S + 1 end
P (G, W)
P (4, S)
P (G, W)
S = S + 1
End
End
End
End
In this way, the goal of using wow API + Lua to create macros is achieved.

Third: interface/Addons build plug-in folder --> write. TOC index +. xml framework +. Lua script --> wow start the load plug-in
Addons (add-ons), commonly known as plug-ins, is an additional file that is placed in the interface folder under the player wow game directory. The plug-in uses the Lua and XML Code provided by Blizzard (the official API function interface) to expand the user functions that players can use and explain and execute through the blizzard wow compiler.
Focus on learning and implementing the third class-Lua/XML + lib + wow API writing plug-ins.

2 plug-in classification
Classified by system: independent single plug-ins (such as trinketmenu jewelry manager, SCT Combat Information plug-in); ace plug-ins (fubar series, Bigwig Team Assistant ); D series plug-ins (DAB, DUF, dart)
By function: interface Background plug-ins (xart, dart, and oskin), combat auxiliary plug-ins (Dex, SCT, naturenemycastbar), and routine auxiliary plug-ins (Auctioneer auction assistant ct_mailmod Mail Assistant)
Categories by plug-ins: No-configuration plug-ins (MCP plug-in control box, ct_mailmod Mail Assistant); GUI setting plug-ins (naturenemycastbar, D series plug-ins); input command setting plug-ins (statusbars, OCB)
The standalone plug-in by system refers to the plug-in that can be directly put into the World of Warcraft/interface/Addons folder after download. Ace plug-ins: include built-in library types and public library types. You only need to add the built-in library to Addons. For a public library type, you must have a public library under Addons !!! Libs. D-series plug-ins: currently the most common plug-ins are 3, dab action bar plug-ins, DUF Avatar interface plug-ins, Dart interface Background plug-ins. Like the Ace class, a dedicated discordlibrary for Series D is required.
Focus on learning the auxiliary class of Combat Information + setting the plug-in a simple graphic interface.

2 currently learned and implemented
(1) Welcome plug-in function: supports "/" commands; displays text welcome information when the area is changed in WoW; supports two types of text display locations-chat box/center of the screen; you can customize the welcome information in WoW. The format of the welcome message is: Custom welcome information + system place name.
Plug-in file: Welcome. TOC + welcome. Lua + Locale-enUs.lua; note: this plug-in has no interface, so there is no XML file.
Core code segment:
Welcomehome = acelibrary ("AceAddon-2.0"): New ("AceConsole-2.0", "AceEvent-2.0", "AceDB-2.0") -- use the Lib Library
Welcome: registerchatcommand (L ["slash-commands"], opts) -- Support for "/" commands
SELF: registerevent ("zone_changed") -- register the region change event
SELF: Print (self. DB. profile. Message) -- the chat box is displayed.
Uierrorsframe: addmessage (self. DB. profile. Message, 1.0, 1.0, 1.0, 5.0) -- display in the center of the screen
SELF: Print ("XXX" + getsubzonetext () -- display custom format + system Place Name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.