====== Windower Scripting ======
===== About =====
Windower scripting is composed of executing a series of commands to windower to perform a useful task. The main use of scripting has been to create infinite line macros in order to swap out every piece of gear you have.
However, doing this for an entire series of macro's can be quite cumbersome and requires a LOT of files, so [[:plugins:SpellCast|SpellCast]] was designed to help reduce the need for using scripting for macros. However, scripting still proves to be convenient for other tasks.
Keep in mind, Windower scripting is deliberately lacking some 'features' in order to help keep users from creating malicious botting scripts. Windower Scripting will not let you make the ultimate claim bot, sorry!
===== Commands =====
While there are many commands for windower, this wiki entry will list the ones that are most relevant to scripting.
Please view the [[:commands:|Command List]] for full syntax on each command.
* __**input**__ - Sends a command directly to FFXI to be handled. This is the main command used in scripting.
* __**alias**__ - Let's you alias multiple commands to a common psuedo windower command. This lets you perform repeated actions much easier, such as GearSet's or the ability to type this alias name as %%//%%command.
* __**exec**__ - This command will execute another script file in the scripts directory and parses all of those commands, too. Very useful for setting up scripts where multiple scripts need to run the exact same functions, reduces the usage of duplicate data.
* __**bind**__ - Allows you to bind a key on your keyboard that tells windower to run commands when that key is pressed. See [[:readme:keymaps|Key Mapping]] for a list of available keys.
* __**echo**__ - Echoes text into the windower console in case you do not want it printing into your in-game chat window/panel.
* __**wait**__ - Waits the specified time in seconds before proceeding to the next command.
===== Examples =====
- A basic command with binding to alt 1:
bind !1 input /ma "Thunder IV"
- A command using aliases. This file would be executed once to define the aliases, then called by %%//%%thun4 in the game chat or by macro:
alias equipgear input /equip body "Igqira Weskit";input /equip main "Jupiter's Staff";
alias thun4 equipgear;input /ma "Thunder IV"
As you can see, you call the thun4 alias which then calls the equipgear alias before executing the input.
- Why would I do that instead of putting the weskit onto the same alias? Well, what if you wanted same gear for multiple things:
alias equipgear input /equip body "Igqira Weskit";input /equip head "Wizard's Petaso";input /equip waist "Penitents Rope";
alias tstaff input /equip main "Jupiter's Staff";
alias istaff input /equip main "Aquilo's Staff";
alias thun4 equipgear;tstaff;input /ma "Thunder IV"
alias thun3 equipgear;tstaff;input /ma "Thunder III"
alias bliz4 equipgear;istaff;input /ma "Blizzard IV"
alias bliz3 equipgear;istaff;input /ma "Blizzard III"
Now you can replace the gear just in 1 spot and it changes them all.
- Looping code:Filename: loop.txt
echo "hi";
wait 120; //wait 2 minutes
exec loop.txt
Now this is highly unrecommended, because you can't stop it! You will never be able to stop this loop.
- How do I make a loop thats stoppable? Simple, do it by aliases. Method 1:
alias runme exec loop.txt;
alias stopme alias runme /;
echo "hi";
wait 120;
runme;
See what stopme's doing? It's redefining runme again, but with a blank command! So runme does nothing when it is hit. Typing %%//%%stopme will stop the loop after those 2 minutes pass.
- As said above, [[:plugins:SpellCast/index|SpellCast]] is making scripting macros obsolete, so I gave you these examples just to give you an idea how scripting can work. However, even with spellcast, many people prefer binding spells over using the FFXI macros because it is faster. You could still then use scripts to write the binds you want
bind !1 ma Thunder4
bind !2 ma Blizzard3
bind !3 ja Elemental Seal
bind !4 ma Cure3 for example, and execute this everytime you switch to the job.
- What if I don't want to use it for macros, what else can I do? You can use it to load plugins and such too!
load tparty
load spellcast
load silence
load distance then you can type //exec filename.txt to load your plugins at once manually if you do not want them to autoload.
===== User Contributed Resources =====
Here is a listing of User Contributed Resources.
Please take note of the [[http://creativecommons.org/licenses/by-nc-sa/2.0/|Create Commons License]] before submitting a script or guide, and understand that other users are able to edit, and/or copy your work under certain circumstances!
[[:guides:adding_content|• How to add to the Resources!]]
==== Guides ====
{{indexmenu>:scripting:guides#1|js#Simple+ajax}}
==== Scripts ====
{{indexmenu>:scripting:userscripts#1|js#Simple+ajax}}