Macros

From Iris2

Jump to: navigation, search
(Created page with '<p>there is macro support in iris, but it is a bit different from the uo macro system. </p><p>there is no ingame editor dialog for it, you have to edit a textfile : <b>data/…')
 
Line 1: Line 1:
 +
=== 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 ===
 +
<p>there is macro support in iris, but it is a bit different from the uo macro system.
<p>there is macro support in iris, but it is a bit different from the uo macro system.
-
</p><p>there is no ingame editor dialog for it, you have to edit a textfile&nbsp;: <b>data/mymacros.lua</b>
+
</p><p>there is no ingame editor dialog for it, you have to edit a textfile&nbsp;: <b>config/mymacros.lua</b>
</p><p>you can use the macro system to assign hotkeys to toggle dialogs
</p><p>you can use the macro system to assign hotkeys to toggle dialogs
(paperdoll,backpack..) , assign hotkeys for skills, spells and items,
(paperdoll,backpack..) , assign hotkeys for skills, spells and items,
Line 136: Line 147:
MacroRead_TargetStat(statname) -- read stats of selected target, statname can be one of curHits,maxHits
MacroRead_TargetStat(statname) -- read stats of selected target, statname can be one of curHits,maxHits
</pre>
</pre>
-
<h2> <span class="mw-headline"> notes </span></h2>
+
 
 +
=== journal ===
 +
 
 +
 
 +
  gMyJournal = {}
 +
  RegisterListenerOnce("Hook_Text",function (name,plaintext,serial,data) table.insert(gMyJournal,plaintext) ,"My_Hook_Text")
 +
  lastid = #gMyJournal
 +
  lastline = gMyJournal[#gMyJournal]
 +
 
 +
 
 +
=== notes ===
<p>if you want to make a script that runs longer or waits for something, you need to start it as a job/coroutine:
<p>if you want to make a script that runs longer or waits for something, you need to start it as a job/coroutine:
Line 151: Line 172:
<p>not all commands from uo are implemented yet, please tell us which ones you consider most important of the missing ones.
<p>not all commands from uo are implemented yet, please tell us which ones you consider most important of the missing ones.
</p><p><br>
</p><p><br>
 +
 +
for a list of all available functions see http://zwischenwelt.org/trac/iris/browser/trunk/lua/lib.macrolist.lua
 +
for complex script see [[Scripting]]
for complex script see [[Scripting]]
 +
 +
 +
easyuo ids : 
 +
if (item.artid == easy2open("POF")) then ... end
 +
 +
 +
helpful to reload your macros on hotkey :
 +
<pre>SetMacro("ctrl+f9",function() dofile(gMacroPathFile)  MacroCmd_RiseText(1,1,0,"reload") end)</pre>
 +
 +
=== example : bandage-loop ===
 +
 +
<pre>
 +
 +
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)
 +
 +
</pre>
 +
 +
== more ==
 +
 +
please visit [[Scripting_TippsAndTricks]]

Current revision as of 14:58, 29 November 2011

Personal tools