EvenLessSpam
Active member
- Joined
- Oct 31, 2005
- RedCents
- 91¢
Name:
BuyAA.inc
by EvenLessSpam
Credits:
nijhal
JoeK
jimjohnson
digitalpixel
Description:
The purpose of this include is to easily add AA buying capabilities to XP macros.
It can be used in two ways; either to just buy a single AA from a specific AA tab using the BuyAA subroutine, or to buy from an INI based list using the BuyAAFromINI subroutine.
Syntax/Example:
Syntax: /call BuyAA "AA Tab" "Alternate Ability"
Example: /call BuyAA "PoP Advance" "Planar Power"
In the example Planar Power will be bought, from the PoP Advance tab.
Both the "AA Tab" and the "Alternate Ability" parameters are required. The "AA Tab" is the tab in the AA Window which the wanted Alternate Ability is found on. See the currently available tabs below. The "Alternate Ability" is the name of the Alternate Ability that should be bought from the selected AA tab.
Syntax: /call BuyAAFromINI "INI File" "INI Section"
Example: /call BuyAAFromINI
Example: /call BuyAAFromINI "MyAA.ini"
Example: /call BuyAAFromINI "RogueAA.ini" "DPS"
In example 1 it will just use default values, that is buy the AA's defined in the section "server_Character", from the file "BuyAA.ini".
In example 2 it will buy the AA's defined in the section "server_Character" from the file "MyAA.ini".
In example 3 it will buy the AA's defined in the section "DPS" from the file "RogueAA.ini".
Both the "INI File" and the "INI Section" parameters are optional, although the "INI File" is required if the "INI Section" should be set. If "INI File" isn't specified it will default to "BuyAA.ini", and if the "INI Section" isn't specified it will default to "server_Character", where ofcourse server is the server of the character you wish to buy for, and (duh) Character is the character you wish to buy for.
Changes:
2006-08-05
2006-08-06
2006-08-10
2007-01-09
2007-01-10
Known issues:
None
BuyAA.inc
Example macro
Example AA.ini
BuyAA.inc
by EvenLessSpam
Credits:
nijhal
JoeK
jimjohnson
digitalpixel
Description:
The purpose of this include is to easily add AA buying capabilities to XP macros.
It can be used in two ways; either to just buy a single AA from a specific AA tab using the BuyAA subroutine, or to buy from an INI based list using the BuyAAFromINI subroutine.
Syntax/Example:
Syntax: /call BuyAA "AA Tab" "Alternate Ability"
Example: /call BuyAA "PoP Advance" "Planar Power"
In the example Planar Power will be bought, from the PoP Advance tab.
Both the "AA Tab" and the "Alternate Ability" parameters are required. The "AA Tab" is the tab in the AA Window which the wanted Alternate Ability is found on. See the currently available tabs below. The "Alternate Ability" is the name of the Alternate Ability that should be bought from the selected AA tab.
Syntax: /call BuyAAFromINI "INI File" "INI Section"
Example: /call BuyAAFromINI
Example: /call BuyAAFromINI "MyAA.ini"
Example: /call BuyAAFromINI "RogueAA.ini" "DPS"
In example 1 it will just use default values, that is buy the AA's defined in the section "server_Character", from the file "BuyAA.ini".
In example 2 it will buy the AA's defined in the section "server_Character" from the file "MyAA.ini".
In example 3 it will buy the AA's defined in the section "DPS" from the file "RogueAA.ini".
Both the "INI File" and the "INI Section" parameters are optional, although the "INI File" is required if the "INI Section" should be set. If "INI File" isn't specified it will default to "BuyAA.ini", and if the "INI Section" isn't specified it will default to "server_Character", where ofcourse server is the server of the character you wish to buy for, and (duh) Character is the character you wish to buy for.
Changes:
2006-08-05
- Changed the /keypress to open AA Window from "V" to "TOGGLE_ALTADVWIN".
Should make it more compatible between clients with different key setups. - Removed the /keypress that closed the AA window after each purchase.
If buying 20 AAs the Window would open and close 20 times. No need for that
2006-08-06
- Modified the BuyAA.inc to return TRUE if it successfully bought an AA and FALSE if not.
Thanks JoeK for the idea
- Updated the Example macro with JoeK's ideas.
- Made a dirty hack using MQ2MMouseTo to open tabs.
- Added version comment.
2006-08-10
- Updated the Example macro and INI.
Macro no longer tries to check whether or not the AA actually can be bought (enough points, rank etc.)
Macro now uses the actual AA name as the key, so no more naming them "AA1", "AA2" etc.
INI updated with comments and to work with the new syntax.
2007-01-09
- Removed (commented out) the events but left in the buying loop. The check is done by comparing the amount of saved AA before the buy, and then doing a loop that checks if the amount goes down (10 second timeout). If it goes down it's assumed that the purchace was successful.
- Removed the SetupSomeVars sub. Using the existing Timeout variable and the AA amount check to see if it's bought. Still using Timeout loop by JoeK.
- Removed the use of MQ2MMouseTo in favor of the newly built-in tabselect function by "yetanotheruser" on MacroQuest2 forums. Pointed out to me by jimjohnson and digitalpixel on MMOBugs.
- Updated for The Serpents Spine.
2007-01-10
- Added the sub BuyAAFromINI, which is basically what was previously the example macro.
Known issues:
None
BuyAA.inc
Rich (BB code):
|**
* BuyAA.inc - Automated AA buying.
* by EvenLessSpam (see Credits)
*
* Version: 1.1.0
*
*
* Description:
* -----------------------------------------------------------------------------
* The purpose of this include is to easily add AA buying capabilities to XP
* macros.
*
* It can be used in two ways; either to just buy a single AA from a specific
* AA tab using the BuyAA subroutine, or to buy from an INI based list using
* the BuyAAFromINI subroutine.
*
*
* Syntax/Example:
* -----------------------
* Syntax: /call BuyAA "AA Tab" "Alternate Ability"
* Example: /call BuyAA "PoP Advance" "Planar Power"
*
* In the example Planar Power will be bought, from the PoP Advance tab.
*
* Both the "AA Tab" and the "Alternate Ability" parameters are required. The
* "AA Tab" is the tab in the AA Window which the wanted Alternate Ability is
* found on. See the currently available tabs below. The "Alternate Ability" is
* the name of the Alternate Ability that should be bought from the selected
* AA tab.
*
*
* Syntax: /call BuyAAFromINI "INI File" "INI Section"
* Example: /call BuyAAFromINI
* Example: /call BuyAAFromINI "MyAA.ini"
* Example: /call BuyAAFromINI "RogueAA.ini" "DPS"
*
* In example 1 it will just use default values, that is buy the AA's defined
* in the section "server_Character", from the file "BuyAA.ini".
* In example 2 it will buy the AA's defined in the section "server_Character"
* from the file "MyAA.ini".
* In example 3 it will buy the AA's defined in the section "DPS" from the file
* "RogueAA.ini".
*
* Both the "INI File" and the "INI Section" parameters are optional, although
* the "INI File" is required if the "INI Section" should be set.
* If "INI File" isn't specified it will default to "BuyAA.ini", and if the
* "INI Section" isn't specified it will default to "server_Character", where
* ofcourse server is the server of the character you wish to buy for, and
* (duh) Character is the character you wish to buy for.
*
*
* Available AA Tabs are:
* -----------------------
* General
* Archetype
* Class
* PoP Advance
* PoP Ability
* Gates
* Omens
* Veteran
* Monster Innates
* Monster Abilities
* Darkhollow
* Serpent
*
*
* Credits:
* -----------------------------------------------------------------------------
* JoeK
* - Lot of tweaks, additions and suggestions.
*
* nijhal
* - For pointing out that listselect required a leftmouse and leftmouseup
* after the listselect to actually select the AA for purchase.
*
* jimjohnson
* - For pointing out that tabselect is now part of the MQ2 base.
*
* digitalpixel
* - For pointing out the tabselect command.
*
*
* Changes:
* -----------------------------------------------------------------------------
* 1.0.0
* - Initial release.
*
* 1.0.1
* - Changed /keypress from "V" to "TOGGLE_ALTADVWIN"
* - Removed /keypress that would normally close AAWindow
*
* 1.0.2
* - BuyAA will now return TRUE on success, FALSE on failure (thanks JoeK)
* - Added the "leftmouse" notification before the "leftmouseup" when selecting
* the AA in the AA list. (thanks JoeK)
*
* 1.0.3
* - Now uses MQ2MMouseTo to handle the AA Tabs. Don't place other windows on
* top of the AAWindow.
*
* 1.0.3J - by JoeK
* - added Events to detect successful purchases and a SetupSomeVars sub to be
* called by the macro that uses this include file.
*
* 1.0.4
* - Removed (commented out) the events but left in the buying loop. The check
* is done by comparing the amount of saved AA before the buy, and then
* doing a loop that checks if the amount goes down (10 second timeout). If
* it goes down it's assumed that the purchace was successful.
* - Removed the SetupSomeVars sub. Using the existing Timeout variable and the
* AA amount check to see if it's bought. Still using Timeout loop by JoeK.
* - Removed the use of MQ2MMouseTo in favor of the newly built-in tabselect
* function by "yetanotheruser" on MacroQuest2 forums. Pointed out to me by
* jimjohnson and digitalpixel on MMOBugs.
* - Updated for The Serpents Spine.
*
* 1.1.0
* - Added the sub BuyAAFromINI, which is basically what was previously the
* example macro.
**|
|#Event AAGained "You have gained the ability #1# at a cost of #2# ability points."
|#Event AAImproved "You have improved #1# at a cost of #2# ability points."
Sub BuyAAFromINI(string INIFile, string Section)
/if (!${Defined[INIFile]}) {
/declare INIFile string local BuyAA.ini
}
/if (!${Defined[Section]}) {
/declare Section string local ${MacroQuest.Server}_${Me.Name}
}
/declare Keys string local
/declare i int local
/declare AA string local
/declare Tab string local
/if (${Ini[${INIFile}, ${Section}].Equal[NULL]}) /return
/varset Keys ${Ini[${INIFile}, ${Section}]}
:TrimKeys
/if (${Keys.Right[1].Equal[|]}) /varset Keys ${Keys.Left[${Math.Calc[${Keys.Length}-1]}]}
/if (${Keys.Right[1].Equal[|]}) /goto :TrimKeys
/for i 1 to ${Math.Calc[${Keys.Count[|]}+1]}
/varset AA ${Keys.Arg[${i},|]}
/varset Tab ${Ini[${INIFile},${Section},${AA}]}
:Buy
/if (${AltAbility[${AA}].AARankRequired} < ${AltAbility[${AA}].MaxRank} && ${AltAbility[${AA}].Cost} <= ${Me.AAPoints}) {
/echo [${Time.Time24}] BuyAA:: Attempting to buy "${AA}" from ${Tab}...
/call BuyAA "${Tab}" "${AA}"
/if (${Macro.Return}) /goto :Buy
/echo [${Time.Time24}] BuyAA:: Failed to buy "${AA}" from ${Tab}...
}
/next i
/return
Sub BuyAA(string Tab, string AA)
/if (!${Defined[Tab]} || !${Defined[AA]}) /return FALSE
/declare i int local
/declare AAPts int local ${Me.AAPoints}
/declare Timeout timer local 10s
/declare TabIndex int local
|--------------------------------------------------------------------------|
|------------------------ Create the AA Tabs array ------------------------|
|--------------------------------------------------------------------------|
/declare Tabs[12,4] string local
/varset Tabs[1,1] General
/varset Tabs[1,2] AAW_GeneralPage
/varset Tabs[1,3] AAW_GeneralList
/varset Tabs[2,1] Archetype
/varset Tabs[2,2] AAW_ArchetypePage
/varset Tabs[2,3] AAW_ArchList
/varset Tabs[3,1] Class
/varset Tabs[3,2] AAW_ClassPage
/varset Tabs[3,3] AAW_ClassList
/varset Tabs[4,1] PoP Advance
/varset Tabs[4,2] AAW_Page4
/varset Tabs[4,3] AAW_List4
/varset Tabs[5,1] PoP Ability
/varset Tabs[5,2] AAW_Page5
/varset Tabs[5,3] AAW_List5
/varset Tabs[6,1] Gates
/varset Tabs[6,2] AAW_Page6
/varset Tabs[6,3] AAW_List6
/varset Tabs[7,1] Omens
/varset Tabs[7,2] AAW_Page7
/varset Tabs[7,3] AAW_List7
/varset Tabs[8,1] Veteran
/varset Tabs[8,2] AAW_Page8
/varset Tabs[8,3] AAW_List8
/varset Tabs[9,1] Monster Innates
/varset Tabs[9,2] AAW_Page9
/varset Tabs[9,3] AAW_List9
/varset Tabs[10,1] Monster Abilities
/varset Tabs[10,2] AAW_Page10
/varset Tabs[10,3] AAW_List10
/varset Tabs[11,1] Darkhollow
/varset Tabs[11,2] AAW_Page11
/varset Tabs[11,3] AAW_List11
/varset Tabs[12,1] Serpent
/varset Tabs[12,2] AAW_Page12
/varset Tabs[12,3] AAW_List12
|--------------------------------------------------------------------------|
|-- Walk through the AA Tabs array till we find the Tab we're looking for -|
|--------------------------------------------------------------------------|
/for i 1 to ${Tabs.Size}
/if (${Tabs[${i},1].Equal[${Tab}]}) /goto :GotTab
/next i
|--------------------------------------------------------------------------|
|---------------------- No Tabs matched the one given ---------------------|
|--------------------------------------------------------------------------|
/echo The tab "${Tab}" isn't valid. These are the tabs available:
/for i 1 to ${Tabs.Size}
/echo ${Tabs[${i},1]}
/next i
/return FALSE
|--------------------------------------------------------------------------|
|-------------- Found the right AA Tab, time to buy some AA's -------------|
|--------------------------------------------------------------------------|
:GotTab
/varset TabIndex ${i}
/if (!${Window[AAWindow].Open}) /keypress TOGGLE_ALTADVWIN
/delay 5 (${Window[AAWindow].Open})
/if (!${Window[AAWindow].Open}) /goto :GotTab
|--------------------------------------------------------------------------|
|---------------------- Trying to select the right tab --------------------|
|--------------------------------------------------------------------------|
/for i 1 to ${Tabs.Size}
/notify AAWindow AAW_Subwindows tabselect ${i}
/delay 1s (${Window[AAWindow].Child[AAW_Subwindows].Child[${Tabs[${TabIndex},2]}].Open})
/if (${Window[AAWindow].Child[AAW_Subwindows].Child[${Tabs[${TabIndex},2]}].Open}) /goto :TabOpen
/next i
|--------------------------------------------------------------------------|
|-------- It seems that this character doesn't have the wanted tab --------|
|--------------------------------------------------------------------------|
/echo The tab "${TabIndex},1]}" wasn't found!
/echo Maybe you're lacking the expansion for that AA tab? Maybe you're in shroud form, or trying to access a monster tab?
/return FALSE
:TabOpen
/notify AAWindow ${Tabs[${TabIndex},3]} listselect ${Window[AAWindow].Child[AAW_Subwindows].Child[${Tabs[${TabIndex},2]}].Child[${Tabs[${TabIndex},3]}].List[${AA},1]}
/delay 5
/notify AAWindow ${Tabs[${TabIndex},3]} leftmouse ${Window[AAWindow].Child[AAW_Subwindows].Child[${Tabs[${TabIndex},2]}].Child[${Tabs[${TabIndex},3]}].List[${AA},1]}
/delay 5
/notify AAWindow ${Tabs[${TabIndex},3]} leftmouseup ${Window[AAWindow].Child[AAW_Subwindows].Child[${Tabs[${TabIndex},2]}].Child[${Tabs[${TabIndex},3]}].List[${AA},1]}
/delay 1s (${Window[AAWindow].Child[AAW_TrainButton].Enabled})
/if (${Window[AAWindow].Child[AAW_TrainButton].Enabled}) {
/notify AAWindow AAW_TrainButton leftmouseup
/varset Timeout ${Timeout.OriginalValue}
:Buying
/delay 5
/if ((${Me.AAPoints} >= ${AAPts}) && (${Timeout})) /goto :Buying
}
/if (${Me.AAPoints} >= ${AAPts}) /return FALSE
/return TRUE
|#Event AAGained "You have gained the ability #1# at a cost of #2# ability points."
Sub Event_AAGained(string Line, string AA, int AACost)
/echo ${AA.Replace[",]} Bought (Cost ${AACost})
/return
|#Event AAImproved "You have improved #1# at a cost of #2# ability points."
Sub Event_AAImproved(string Line, string AA, int AACost)
/echo ${AA} Improved (Cost ${AACost})
/return
Example macro
Rich (BB code):
#include BuyAA.inc
Sub Main
| This would start buying AA's defined in the default INI file if you have
| saved up 30 AA's
/if (${Me.AAPoints} > 29) /call BuyAAFromINI
/return
Example AA.ini
Rich (BB code):
; Syntax:
; [server_Character]
; Wanted AA=The AA Tab
;
; Available AA Tabs (depends on the expansions owned etc):
; General
; Archetype
; Class
; PoP Advance
; PoP Ability
; Gates
; Omens
; Veteran
; Monster Innates
; Monster Abilities
; Darkhollow
; Serpent
;
; Example:
[server_Character]
Innate See Invis=Darkhollow
Last edited:


