To Use:
Code: Select all
/macro switch.mac <keyname1>;<2>;<3>;<4>;.....
/macro switch.mac <SetName>#
Notes:
1) The new <SetName># parameter needs a # ending it. This is how I tell you want to do a set of switches, not just one.
04/24/04: Last update I'm making on this. Turned it into an include for my druid's macro. maybe sometime I'll post that.
Added a few fixes here and there. Now makes switches as fast as possible. Runs very smooth.
04/23/04: Yay Lax, slotnames now should be fixed
04/22/04: Added SwitchSets to make it easier to work with.
Added some defined checks, this should fix a few param errors
Now it checks to make sure a pack isn't already open.
Code: Select all
| Switch.mac Version 3 <<By: Preocts>> Updated 04-23-2004 |
|-------------------------------------------------------------
|**
Using an ini file this macro will switch any item in inventory
with an equiped item. INI options allow for a one-way switch
or a toggle switch.
This include file is set to use druid.ini by default.
Usage: /macro Switch switch.mac <Switch1Name>;[Switch2Name];[Switch3Name]....
Usage: /macro Switch <SwitchSetName># <--The # after the name is really important
INI Structure:
[ItemSwitch]
<SwitchName>=<SlotName>;<ItemName>;[ItemName]
ArmDot=arm;Elder Spiritist's Vambraces;Elysian Armplates
NormalNeck=neck;Broken Shore Shell Necklace
+ If two items are given the macro will toggle between the two
+ If one item is given the macro will equip that item.
+Example One: /macro Switch ArmDot --Toggle Switch my ARM slot
[ItemSwitch]
ArmDot=arms;Elder Spiritist's Vambraces;Elysian Armplates
+Example Two: /macro Switch SeeIvis --Equips given item to my neck slot.
[ItemSwitch]
SeeInvis=neck;Qeynos Badge of Honor
+Example Three: /macro Switch ArmDot;SeeInvis -- Does both one and two
[ItemSwitch]
ArmDot=arms;Elder Spiritist's Vambraces;Elysian Armplates
SeeInvis=neck;Qeynos Badge of Honor
[SwitchSets]
<SwitchSetName>=<SwitchName1>;[SwitchName2];[SwitchName3];.......
+ This let's you do the multiple switch thing with only one param.
+ In theory this would let you switch every equipment slot with one param.
**YOU CANNOT SEND MULTIPLE SWITCHSETS!**
+Example One: /macro Switch simple# -- Does both one and two
[SwitchSets]
simple=ArmDot;SeeInvis
[ItemSwitch]
ArmDot=arms;Elder Spiritist's Vambraces;Elysian Armplates
SeeInvis=neck;Qeynos Badge of Honor
**|
|**
SLOT NAMES GODDAMNIT!!
mainhand, offhand, range, charm, leftear, rightear, leftwrist, rightwrist, arm, head
neck, face, shoulder, chest, legs, waist, rightfinger, leftfinger, feet, ammo, back
**|
Sub Main
/if (!${Defined[Param0]}) /return
/declare InputParam local
/declare IniInput local
/declare InvState local
/declare ItemOne local
/declare SlotName local
/declare ItemTwo local
/declare PackNum local
/declare SlotNum local
/declare WorkWith local
/declare CursorCheck local
/declare Switches array
/declare ArrayCount local
/varset ArrayCount 1
|Open the inventory window if not already open.
/if (${Window[InventoryWindow].Open}) {
/varset InvState 0
} else {
/keypress inventory
/varset InvState -1
}
/if (${String[@Param0].Find["#"]}) {
/if (!${Ini[druid.ini,SwitchSets,${String["@Param0"].Arg[1,#]}].Length}) {
/echo NOT FOUND: @Param0
/goto :EndSwitch
}
/varset InputParam ${Ini[druid.ini,SwitchSets,${String["@Param0"].Arg[1,#]}]}
} else {
/varset InputParam @Param0
}
:FillArray
/varset Switches(@ArrayCount) ${String["@InputParam"].Arg[@ArrayCount,;]}
/if (!${Ini[druid.ini,ItemSwitch,${String["@Switches(@ArrayCount)"]}].Length}) {
/echo NOT FOUND: @Switches(@ArrayCount)
/goto :EndSwitch
}
/varadd ArrayCount 1
/if (!${String["@InputParam"].Arg[@ArrayCount,;].Length}) {
/call HandlePacks 1
/varset ArrayCount 1
/goto :StartSwitch
}
/goto :FillArray
:StartSwitch
/if (${String[@Switches(@ArrayCount)].Equal["UNDEFINED-ARRAY-ELEMENT"]}) /goto :EndSwitch
/varset IniInput "${Ini[druid.ini,ItemSwitch,${String["@Switches(@ArrayCount)"]}]}"
/varset SlotName "${String["@IniInput"].Arg[1,;]}"
/varset ItemOne "${String["@IniInput"].Arg[2,;]}"
/varset ItemTwo "${String["@IniInput"].Arg[3,;]}"
| Crap that is being straightened out with the new MQData. Thanks Devs for all the work!
/if (${String[@SlotName].Equal["arm"]}) /varset SlotName "arms"
/if (${String[@SlotName].Equal["mainhand"]}) /varset SlotName "primary"
/if (${String[@SlotName].Equal["offhand"]}) /varset SlotName "secondary"
/if (${String[@SlotName].Equal["range"]}) /varset SlotName "ranged"
| Check for single arg given in ini
/if (${String[@ItemTwo].Equal["NULL"]}) {
|Make sure the item we want in the slot isnt already there. If it is no work is needed.
/if (${Me.Inventory["@SlotName"].Name.Equal["@ItemOne"]}) {
/goto :NextSwitch
}
|Make sure the item is present in inventory
/if (!${FindItem["@ItemOne"].ID}) {
/goto :NextSwitch
}
} else {
|Two items to toggle. Make sure at least one is in the given slot.
/if (${Me.Inventory["@SlotName"].Name.NotEqual["@ItemOne"]} && ${Me.Inventory["@SlotName"].Name.NotEqual["@ItemTwo"]}) {
/goto :NextSwitch
}
|Make sure both items are present in inventory
/if (!${FindItem["@ItemOne"].ID} || !${FindItem["@ItemTwo"].ID}) {
/goto :NextSwitch
}
}
|Now we can assume a switch is needed, a switch is possible, and one or both items are present.
|Find out where the hell the item not equiped is.
/if (!${Me.Inventory["@SlotName"].Name.Equal["@ItemOne"]}) {
| no not redunant, just checking which item is in inventory and which is equiped (in case of toggle)
/varset WorkWith "@ItemOne"
} else {
/varset WorkWith "@ItemTwo"
}
|Work with is the item in the inventory. For single switch we'd start with this one anyway
|but for toggle switching we must start with the one of two items in the inventory.
| Crap that is being straightened out with the new MQData. Thanks Devs for all the work!
/if (${String[@SlotName].Equal["arms"]}) /varset SlotName "arm"
/if (${String[@SlotName].Equal["primary"]}) /varset SlotName "mainhand"
/if (${String[@SlotName].Equal["secondary"]}) /varset SlotName "offhand"
/if (${String[@SlotName].Equal["ranged"]}) /varset SlotName "range"
/varset CursorCheck ${Cursor.ID}
/if (${InvSlot[${FindItem["@WorkWith"].InvSlot.ID}].Pack}) {
|It's in a pack.
/varset PackNum ${InvSlot[${FindItem["@WorkWith"].InvSlot.ID}].Pack}
/varset SlotNum ${Math.Calc[${FindItem["@WorkWith"].InvSlot.Slot}+1]}
/if (!${Window[${InvSlot[@PackNum].Name}].Open}) {
/itemnotify @PackNum rightmouseup
:Wait1
/if (!${Window[${InvSlot[@PackNum].Name}].Open}) /goto :Wait1
}
/itemnotify in ${InvSlot[@PackNum].Name} @SlotNum leftmouseup
/call WaitForIt @CursorCheck
/varset CursorCheck ${Cursor.ID}
/itemnotify @SlotName leftmouseup
/call WaitForIt @CursorCheck
/varset CursorCheck ${Cursor.ID}
/itemnotify in ${InvSlot[@PackNum].Name} @SlotNum leftmouseup
/call WaitForIt @CursorCheck
/varset CursorCheck ${Cursor.ID}
| /delay 5
| /itemnotify @PackNum rightmouseup
} else {
|It's in the main inventory. Same as above, just simpler
/varset SlotNum ${FindItem["@WorkWith"].InvSlot.ID}
/itemnotify @SlotNum leftmouseup
/call WaitForIt @CursorCheck
/varset CursorCheck ${Cursor.ID}
/itemnotify @SlotName leftmouseup
/call WaitForIt @CursorCheck
/varset CursorCheck ${Cursor.ID}
/itemnotify @SlotNum leftmouseup
/call WaitForIt @CursorCheck
/varset CursorCheck ${Cursor.ID}
}
:NextSwitch
/varadd ArrayCount 1
/goto :StartSwitch
:EndSwitch
/call HandlePacks 0
/if (@InvState) /keypress inventory
/zapvars
/return
Sub WaitForIt
/if (!${Defined[Param0]}) /return
:WaitForitLoop
/if (${Cursor.ID}==@Param0) /goto :WaitForitLoop
/return
Sub HandlePacks
/if (!${Defined[Param0]}) /return
| 1 to open 0 to close
/declare TempLoop local
/for TempLoop 22 to 29
/if (${FindItem[${InvSlot[@TempLoop].Item}].Container}) {
/if (@Param0) {
/if (!${Window[${InvSlot[@TempLoop].Name}].Open}) /itemnotify @TempLoop rightmouseup
} else {
/if (${Window[${InvSlot[@TempLoop].Name}].Open}) /itemnotify @TempLoop rightmouseup
}
/delay 1
}
/next TempLoop
/returnExample INI (switch.ini)
Code: Select all
[SwitchSets]
Fight=FightNeck;FightPrim;FightSec;FightRange
Normal=NormalPrim;NormalSec;NormalRange;NormalNeck
Shop=ShopPrim;ShopSec;ShopRange
[ItemSwitch]
ArmDot=arms;Elder Spiritist's Vambraces;Elysian Armplates
HasteNeck=neck;Initiate Symbol of Tunare
ShopPrim=mainhand;Opal Encrusted Stein
ShopSec=offhand;Opal Encrusted Stein
ShopRange=range;Grandmaster Baker's Spoon
FightNeck=neck;Broken Shore Shell Necklace
FightPrim=mainhand;Scimitar of the Emerald Dawn
FightSec=offhand;Tactician's Bulwark
FightRange=range;Bloodstained Memoirs
NormalNeck=neck;Qeynos Badge of Honor
NormalPrim=mainhand;Foraging Machette
NormalSec=offhand;Grandmaster Baker's Spoon
NormalRange=range;Bloodstained Memoirs
Code: Select all
/macro switch ArmDotCode: Select all
/macro switch SeeInvisCode: Select all
/macro switch ArmDot;SeeInvisCode: Select all
/macro switch Fight#Code: Select all
/macro switch FightNeck;FightPrim;FightSec;FightRange
