Macros
From Iris2
Contents |
quickstart
since iris doesn't have a nice editor dialog for hotkeys and macros yet, they have to be set up by editing config/mymacros.lua
a few examples :
SetMacro("f6", function() MacroCmd_Item_UseByName("bandage") MacroCmd_TargetSelf() end)
SetMacro("ctrl+h", function() MacroCmd_Spell("Heal") end)
SetMacro("shift+alt+s", function() MacroCmd_Skill("Spirit Speak") end)
about
there is macro support in iris, but it is a bit different from the uo macro system.
there is no ingame editor dialog for it, you have to edit a textfile : config/mymacros.lua
you can use the macro system to assign hotkeys to toggle dialogs
(paperdoll,backpack..) , assign hotkeys for skills, spells and items, and several other actions as well.
macros can be mapped to all sorts of keys, including numbers and function keys
you can specify modifyers, but currently if you use more than one, they have to be in that order : shift+alt+ctrl+f
you can assign macros like this :
example
SetMacro("ctrl+s",function() MacroCmd_Open("Status") end) -- Open Status window
SetMacro("alt+c",function() MacroCmd_ToggleWarmode() end) -- Toggle between War/Peace modes
SetMacro("alt+p",function() MacroCmd_Open("Paperdoll") end) -- Open Character Window
SetMacro("alt+k",function() MacroCmd_Open("Skill") end) -- Open Skills
SetMacro("alt+j",function() MacroCmd_Open("Journal") end) -- Open Journal
SetMacro("alt+i",function() MacroCmd_Open("Backpack") end) -- Open Backpack
SetMacro("alt+x",function() MacroCmd_Quit() end) -- Quit game
SetMacro("alt+b",function() MacroCmd_Say("*bow*") end) -- Bow
SetMacro("alt+s",function() MacroCmd_Say("*salute*") end) -- Salute
keynames
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, 0,1,2,3,4,5,6,7,8,9, f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15, mouse1,mouse2,mouse3,mouse4,mouse5,wheelup,wheeldown, backspace,tab,stopclear,return,np_enter,pause,capslock,escape,space, pgup,pgdn,end,home,left,up,right,down,screen,ins,del, lwin,rwin,menu, np0,np1,np2,np3,np4,np5,np6,np7,np8,np9,npmult,npadd,npsub,npkomma,npdiv, numlock,scroll,ue,plus,komma,minus,point,grid,oe,bslash,console,accent,ae,greater, NOT RECOMMENDED, but might work too: lshift,lcontrol,lalt,rshift,rcontrol,ralt
commands
MacroCmd_Say (text) -- chat-text, example : MacroCmd_Say("hi all")
MacroCmd_Quit () -- quits the game
MacroCmd_NextCamMode () -- change cam mode
MacroCmd_RepeatLastChat () -- repeat last chat-text
MacroCmd_RepeatLastDoubleClick () -- repeat double click on last object
MacroCmd_SelectNearestMobile () --
MacroCmd_SelectNextMobile () -- cycle through mobiles
MacroCmd_AttackSelectedMobile () -- (26.11.2007 : currently broken, only runs to target, but doesn't attack)
MacroCmd_ToggleWarmode () -- switch between war and peace mode
MacroCmd_Open (dialogtype) -- open dialog,
-- dialogtype can be one of Status,Skill,Journal,Backpack,Paperdoll,Compass
-- example : MacroCmd_Open("Journal")
MacroCmd_Skill (skillname) -- aktivate skill, see below for list
MacroCmd_Spell (spellname) -- casts a spell, see below for list
MacroCmd_ZoomCompass (zoomfactor)
MacroCmd_ActivateNextRenderer () -- switch between 2d and 3d renderer... currently broken
MacroCmd_CamChangeZoom (zoomadd)
MacroCmd_Screenshot ()
MacroCmd_GridScreenshot () -- make high-resolution screenshot (multiple times the screensize)
MacroCmd_WalkToMouse () -- currently broken
MacroCmd_ShowFallBackTool () -- dev tool for fallback-gfx
MacroCmd_ShowDevTool () -- dev tool
MacroCmd_ItemSlot_Set (slotnumber) -- marks the item under the mouse for later usage
MacroCmd_ItemSlot_Use (slotnumber) -- use item in slot
MacroCmd_TargetLast () -- wait for target cursor and target the same thing that was targetted last time
MacroCmd_TargetSelf () -- targets self
MacroCmd_Item_UseByName (itemnamepart) -- uses the first item in the backpack that contains "itemnamepart" in it's name (useful for bandages and potions)
spell- and skill-hotkeys
SetMacro("ctrl+h", function() MacroCmd_Spell("Heal") end)
SetMacro("shift+alt+s", function() MacroCmd_Skill("Spirit Speak") end)
skillnames
Inscription, Veterinary, Animal Taming, Detecting Hidden, Fencing, Hiding, Animal Lore, Mace Fighting, Carpentry, Tailoring, Swordsmanship, Fishing, Spellweaving, Lumberjacking, Bushido, Chivalry, Provocation, Focus, Musicianship, Necromancy, Stealth, Bowcraft/Fletching, Poisoning, Remove Trap, Tactics, Spirit Speak, Mining, Ninjitsu, Wrestling, Snooping, Magery, Cooking, Cartography, Forensic Evaluation, Stealing, Tracking, Tinkering, Taste Identification, Meditation, Evaluate Intelligence, Blacksmithing, Discordance, Herding, Alchemy, Healing, Parrying, Camping, Resisting Spells, Anatomy, Peacemaking, Begging, Archery, Arms Lore, Lockpicking, Item Identification
spellnames
Holy Light, Summ.Creature, Reveal, Curse, Polymorph, Arch Protection, Noble Sacrifice, Wall of Stone, Paralyze Field, Strength, Energy Bolt, Cunning, Mana Vampire, Mark, Chain Lightning, Corpse Skin, Protection, Resurrection, Energy Vortex, Dispel, Mana Drain, Mass Dispel, Strangle, Mind Rot, Recall, Mass Curse, FlameStrike, Arch Cure, Poison Field, Cure, Bless, Invisibility, Magic Trap, Summon Daemon, Harm, Agility, Summon Familiar, Blade Spirit, Sacred Journey, Meteor Swarm, Remove Curse, Energy Field, Enemy of one, Fire Field, Night Sight, Dispel Evil, Cleanse By Fire, Clumsy, Close Wounds, Consecrate Weapon, Reactive Armor, Magic Untrap, WraithForm, Lich Form, Wither, Vengeful Spirit, Air Elemental, Spell Reflection, Lightning, Explosion, Teleport, Animate Dead, Curse Weapon, Magic Lock, Unlock, Blood Oath, Mind Blast, Dispel Field, Evil Omen, Earth Elemental, Create Food, Water Elemental, Telekinesis, Weaken, Fire Elemental, Divine Fury, Vampiric Embrace, Pain Spike, FeebleMind, Earthquake, Paralyze, Magic Arrow, Horrific Beast, Heal, Poison, Gate, Poison Strike, Fire Ball, Incognito, Greater Heal
item hotkeys
- press ctrl+f1 - ctrl+f4 to mark items under the cursor for later usage,
- press f1 - f4 to use them
you can define additional keys or use different keys like this :
SetMacro("ctrl+f5", function() MacroCmd_ItemSlot_Set(5) end)
SetMacro("f5", function() MacroCmd_ItemSlot_Use(5) end)
you can make a bandage self macro like this :
SetMacro("f6", function() MacroCmd_Item_UseByName("bandage") MacroCmd_TargetSelf() end)
scripting
You can do complex scripting here, e.g. you can add conditions or similar. a guide to the lua scripting language is here : [1] and a languag-reference is here : [2]
you can also make conditional macros like this
if (MacroRead_PlayerStat("curHits") < 0.5*MacroRead_PlayerStat("maxHits")) then MacroCmd_Say("i'm half-dead !") end
(will trigger if the player health is below 50%)
functions
currently available read functions for that :
MacroRead_PlayerStat(statname) -- read player stats, statname can be one of curHits,maxHits,curMana,maxMana,curStamina,maxStamina MacroRead_TargetStat(statname) -- read stats of selected target, statname can be one of curHits,maxHits
journal
gMyJournal = {}
RegisterListenerOnce("Hook_Text",function (name,plaintext,serial,data) table.insert(gMyJournal,plaintext) ,"My_Hook_Text")
lastid = #gMyJournal
lastline = gMyJournal[#gMyJournal]
notes
if you want to make a script that runs longer or waits for something, you need to start it as a job/coroutine:
job.create(function()
-- place your code here
DoSomething()
job.wait(1000) -- waits 1sec
DoAnotherThing()
job.wait(1000)
AddFadeLines("script finished")
end)
not all commands from uo are implemented yet, please tell us which ones you consider most important of the missing ones.
for a list of all available functions see http://zwischenwelt.org/trac/iris/browser/trunk/lua/lib.macrolist.lua
for complex script see Scripting
easyuo ids :
if (item.artid == easy2open("POF")) then ... end
helpful to reload your macros on hotkey :
SetMacro("ctrl+f9",function() dofile(gMacroPathFile) MacroCmd_RiseText(1,1,0,"reload") end)
example : bandage-loop
SetMacro("f3", function() gMyBandageLoopActive = not gMyBandageLoopActive end)
job.create(function()
while (true) do
if (gMyBandageLoopActive) then MacroCmd_BandageSelf() end
job.wait(3*1000)
end
end)
