Moderator: MacroQuest Developers
Code: Select all
SUB Main(modeSelect)
/declare macroVersion string outer 5.1.36 (r8)
/declare i int local
/call e3_Setup "${modeSelect}"
:MainLoop
/if (${Debug}) /echo |- MainLoop ==>
| If my class is not set, I must not be in game, end the macro.
/if (!${Bool[${Me.Class}]}) {
/endmacro
} else {
| ************************************************************************************ |
| ******************************* Background Functions ******************************* |
| ************************************************************************************ |
/if (${ActionTaken}) /varset ActionTaken FALSE
/if (${currentZone} != ${Zone.ID}) /call check_Zone
/if (${Following} && !${Assisting}) /call check_Follow
/call check_Active
/call check_Combat
/call check_Idle
/call check_autoTribute
| If I'm not holding an item, check Life Support and Instant Buffs.
/if (!${Bool[${Cursor}]}) {
| Check if I'm casting
/if (!${Me.Casting.ID} || ${Me.Casting.ID} && ${Me.Class.ShortName.Equal[BRD]}) {
| Check LifeSupport
/if (${lifeSupport.Size} && ${Me.PctHPs} < 100) /call check_lifeSupport
| Check Instant buffs
/if (${BuffCheck} && ${InstantBuffs.Size} && ${Me.FreeBuffSlots} > ${MaxBuffs}) /call buffInstants
}
}
/call Background_Events
/doevents
| If I'm not active, call mainFunctions
/if (!${activeTimer}) {
| check for a pending item exchange
/if (${swapItemBack} && !${itemExchange_Timer}) /call completePendingExchange
| ****************************************************************************** |
| ******************************* Main Functions ******************************* |
| ****************************************************************************** |
/for i 1 to ${mainLoop_Array.Size}
/if (${Bool[${mainLoop_Array[${i}]}]}) /call ${mainLoop_Array[${i}]}
/if (!${ActionTaken}) /next i
| ********************************************************************************** |
| ******************************* Tertiary Functions ******************************* |
| ********************************************************************************** |
| MedBreak
/if (${medBreak}) /call check_MedBreak
| Maintain macro timers
/if (${timerArray.Size}) /call check_macroTimers
}
}
/if (${Debug}) {
/echo <== MainLoop -|
/delay 5
}
/goto :MainLoop
/RETURN Code: Select all
SUB Main(modeSelect)
/declare macroVersion string outer 5.2.35 (r8)
/echo Initializing...
|
| Declare file paths ======================================================================================================
|
/declare botIni_Folder string outer e3 Bot Inis\
/declare altBotIni_Folder string outer e3 Bot Inis\Alternate Bot Inis\
/declare macroIni_Folder string outer e3 Macro Inis\
/declare MacroData_Ini string outer ${macroIni_Folder}Macro Data.ini
/declare genSettings_Ini string outer ${macroIni_Folder}General Settings.ini
/declare advSettings_Ini string outer ${macroIni_Folder}Advanced Settings.ini
/declare Character_Ini string outer ${botIni_Folder}${MacroQuest.Server}-${Me.CleanName}.ini
|
| Check Debug =============================================================================================================
|
/declare Debug bool outer ${Ini[${advSettings_Ini},Debug,Debug All]}
/declare Debug_Core bool outer ${Ini[${advSettings_Ini},Debug,Debug Core]}
/declare Debug_Setup bool outer ${Ini[${advSettings_Ini},Debug,Debug Setup]}
/declare Debug_Utilities bool outer ${Ini[${advSettings_Ini},Debug,Debug Utilities]}
|
| Check for Debug calls at startup
|
/if (${modeSelect.Find[/Debug|]} || ${modeSelect.Find[/Debug All|]}) {
/varset Debug TRUE
} else /if (${modeSelect.Find[/Debug Core|]}) {
/varset Debug_Core TRUE
} else /if (${modeSelect.Find[/Debug Setup|]}) {
/varset Debug_Setup TRUE
} else /if (${modeSelect.Find[/Debug Utilities|]}) {
/varset Debug_Utilities TRUE
}
|
/if (${Debug} || ${Debug_Setup}) /echo |- e3_Setup ==>
| Check Plugins
/if (!${pluginsVerified-${Me.CleanName}} || !${EQBC.Connected}) /call check_Plugins
| Create or Update Ini files ==============================================================================================
|
| Check for first time setup.
/if (!${Ini[${MacroData_Ini}].Length}) {
/echo Welcome to e3! Preforming first time setup...
} else /if (!${Ini[${MacroData_Ini},e3 Build,Version].Equal[${macroVersion}]}) {
/echo New version of e3 detected. Hold on to your nuggets!
}
| Macro Setting Inis
/if (!${Ini[${MacroData_Ini},e3 Build,Version].Equal[${macroVersion}]} || !${Bool[${Ini[${genSettings_Ini}]}]}) /call EVENT_make_MacroSettingsIni
| Character_Ini
/if (!${Ini[${MacroData_Ini},${MacroQuest.Server}-${Me.CleanName},Bot_Ini version].Equal[${macroVersion}]} || !${Bool[${Ini[${Character_Ini}]}]}) /call EVENT_make_CharacterSettingsIni
| Aliases
/if (!${Ini[${MacroData_Ini},e3 Build,Version].Equal[${macroVersion}]}) /call EVENT_updateAliases
| Update Macro Version if a new build is detected
/if (!${Ini[${MacroData_Ini},e3 Build,Version].Equal[${macroVersion}]}) /call WriteToIni "${MacroData_Ini},e3 Build,Version" "${macroVersion}" 1
|
| Declare Core Variables and Import Settings ==============================================================================
/declare ActionTaken bool outer FALSE
/declare ChatToggle string outer ${If[${Ini[${genSettings_Ini},General,Macro Output Channel].Length},${Ini[${genSettings_Ini},General,Macro Output Channel]},/bc]}
/declare currentZone int outer 0
/declare Old_cursorID int outer 0
|
/declare activeTimer timer outer
/declare combatTimer timer outer
/declare cursorTimer timer outer
/declare rebuffTimer timer outer
/declare spamTimer timer outer
|
/declare combatDelay int outer ${If[${Ini[${genSettings_Ini},General,Out of Combat Timer (Sec)].Length},${Ini[${genSettings_Ini},General,Out of Combat Timer (Sec)]},10]}
/declare inventoryTimer int outer ${If[${Ini[${genSettings_Ini},General,Auto-Inventory Timer (Sec)].Length},${Ini[${genSettings_Ini},General,Auto-Inventory Timer (Sec)]},30]}
/declare rebuffDelay int outer ${If[${Ini[${genSettings_Ini},General,Rebuff Delay Timer (Sec)].Length},${Ini[${genSettings_Ini},General,Rebuff Delay Timer (Sec)]},10]}
|
/if (!${Defined[idle]}) /declare idle bool global
/if (!${Defined[idleTimer]}) /declare idleTimer timer global
/declare idleInterval int outer ${If[${Ini[${genSettings_Ini},General,Idle Time Out (Min)].Length},${Ini[${genSettings_Ini},General,Idle Time Out (Min)]},10]}
|
| Setup Includes
|**
add code to run include setups
**|
| Complete a pending exchange =============================================================================================
/if (${Ini[${MacroData_Ini},${MacroQuest.Server}-${Me.CleanName},Pending Exchange].Length} && ${Ini[${MacroData_Ini},${MacroQuest.Server}-${Me.CleanName},Pending Exchange].NotEqual[NONE]} && !${itemExchange_Timer}) /call completePendingExchange
| Startup echos ===========================================================================================================
/echo e3 v${macroVersion} loaded.
/echo
/echo ** For updates, issues, suggestions, or donations, visit 'http://code.google.com/p/e3-macro-builds/'.
/echo ** For help using e3, use /e3help to learn about different basic functions and /comannds.
/if (${NetBots.Client.Find[Tackleberry]}) /echo Though you may find this message a bit 'extreme' so is bitching about a few lines of text which can easily be ignored.
/echo
/if (${Debug} || ${Debug_Setup}) {
/echo botIni_Folder=${botIni_Folder}
/echo altBotIni_Folder=${altBotIni_Folder}
/echo macroIni_Folder=${macroIni_Folder}
/echo MacroData_Ini=${MacroData_Ini}
/echo genSettings_Ini=${genSettings_Ini}
/echo advSettings_Ini=${advSettings_Ini}
/echo Character_Ini=${Character_Ini}
/echo Debug=${Debug}
/echo Debug_Core=${Debug_Core}
/echo Debug_Setup=${Debug_Setup}
/echo Debug_Utilities=${Debug_Utilities}
/echo ChatToggle=${ChatToggle}
/echo combatDelay=${combatDelay}
/echo rebuffDelay=${rebuffDelay}
/echo inventoryTimer=${inventoryTimer}
/echo idleInterval=${idleInterval}
/echo
/echo *** Debug_Mode ON ***
/echo The macro has paused so you can review setup information, type /mqpause to continue.
/echo
/mqpause
}
/if (${Debug} || ${Debug_Setup}) /echo <== e3_Setup -|
|**
:MainLoop
**|
:MainLoop
/if (${Debug} || ${Debug_Core}) /echo |- MainLoop ==>
| If my class is not set. I must not be in game, end the macro.
/if (${ActionTaken}) /varset ActionTaken FALSE
/if (!${Bool[${Me.Class}]}) {
/endmacro
} else {
| Check Background functions =================================================================================
| Update zone ID
/if (${currentZone} != ${Zone.ID}) /call check_Zone
| Check Follow
/if (${Following} && !${Assisting}) /call check_Follow
| Check Zoning
/if (!${SpawnCount[pc ${Me}]}) {
/varset activeTimer 15
/varset rebuffTimer 0
}
| Check Movement
/if (${Me.Moving} || ${Corpse.Open}) {
/varset activeTimer 5
/varset rebuffTimer ${rebuffDelay}
}
| Check Cursor
/if (${Cursor.ID}) {
| Destroy badItems.
/if (${Defined[badItems]}) {
/if (${Select[${Cursor},${badItems}]} || ${Select[${Cursor.ID},${badItems}]}) {
/echo Destroying ${Cursor}...
/destroy
}
}
| Check to see if I'm waiting to drop this item, or if I've picked up something new
/if (${Old_cursorID} != ${Cursor.ID}) {
/varset cursorTimer ${Math.Calc[${inventoryTimer} * 10].Int}
/varset Old_cursorID ${Cursor.ID}
} else {
/if (!${cursorTimer}) /call clearCursor
}
/varset activeTimer 5
/if (${rebuffTimer} < 30) /varset rebuffTimer 30
} else {
/if (${Old_cursorID}) {
/varset cursorTimer 0
/varset Old_cursorID 0
}
}
| Check AutoAttack
/if (${Me.Combat}) {
/if (!${Target.ID} || ${Target.Type.Equal[corpse]} && !${Assisting}|| ${Spawn[${Target.ID}].Type.Equal[PC]} && !${Toggle-PvP}) /attack off
}
| Check Casting
/if (${Me.Class.ShortName.NotEqual[BRD]} && ${Me.Casting.ID}) {
/if (${e3Casting}) /call e3_CastingChecks
/varset activeTimer 5
/varset rebuffTimer ${rebuffDelay}
}
| Check windows
/if (${Window[BigBankWnd].Open} || ${Window[MerchantWnd].Open} || ${Window[TradeWnd].Open} || ${Window[GuildBankWnd].Open} || ${Window[MerchantWnd].Open}) {
/varset activeTimer 30
/varset rebuffTimer ${rebuffDelay}
/doevents flush
}
| Check Feigning
/if (${Me.Feigning}) {
/if (!${Select[${Me.Class.ShortName},NEC,SHD,MNK]}) {
/stand
/if (${Assisting} && ${StickOn}) /attack on
} else {
/if (!${Defined[feign_Timer]}) {
/docommand ${ChatToggle} I AM FEIGNED.
/declare feign_Timer timer outer 15s
}
}
/varset activeTimer 30
/varset rebuffTimer ${rebuffDelay}
} else {
/if (${Defined[feign_Timer]}) /deletevar feign_Timer
}
| Check Combat
/call check_Combat
| Check to see if I have been active recently. If so, set Idle false, and update the idleTimer
/if (${activeTimer} || ${combatTimer}) {
/varset idleTimer ${idleInterval}m
/if (${idle}) /varset idle FALSE
} else {
| If I haven't been active, and the idleTimer is spent, set idle TRUE.
/if (!${idle} && !${idleTimer}) /varset idle TRUE
}
| If I'm not holding an item, check Life Support and Instant Buffs.
/if (!${Bool[${Cursor}]}) {
| Check if I'm casting
/if (!${Me.Casting.ID} || ${Me.Casting.ID} && ${Me.Class.ShortName.Equal[BRD]}) {
| Check LifeSupport
/if (${lifeSupport.Size} && ${Me.PctHPs} < 100) /call check_lifeSupport
| Check Instant buffs
/if (${BuffCheck} && ${InstantBuffs.Size} && ${Me.FreeBuffSlots} > ${MaxBuffs}) /call buffInstants
}
}
/if (${autoTribute}) /call check_autoTribute
/call Background_Events
/doevents
| If I'm not active, check mainLoop_Array functions
/if (!${activeTimer}) {
| check for a pending item exchange
/if (${swapItemBack} && !${itemExchange_Timer}) /call completePendingExchange
| ****************************************************************************** |
| ******************************* Main Functions ******************************* |
| ****************************************************************************** |
|**
This may need to be redesigned,
/for i 1 to ${mainLoop_Array.Size}
/if (${Bool[${mainLoop_Array[${i}]}]}) /call ${mainLoop_Array[${i}]}
/if (!${ActionTaken}) /next i
**|
| ********************************************************************************** |
| ******************************* Tertiary Functions ******************************* |
| ********************************************************************************** |
| MedBreak
/if (${medBreak}) /call check_MedBreak
| Maintain macro timers
/if (${timerArray.Size}) /call check_macroTimers
}
}
/if (${Debug} || ${Debug_Core}) {
/echo <== MainLoop -|
/delay 5
}
/goto :MainLoop
/RETURN


Code: Select all
grep -ir "\#event" | wc -l
567
Killians. I'm not. EVERY line of text on the client is being checked against 567 events. EVERY LINE OF TEXT.ikill wrote:The macro has a few dozen events, most of which are macro commands set up through /bc, not triggered by the game. Since /bc is not a chat channel event Chat doesn't pick them up, and is why I have so many events. Demonstar is mostly just talking out of his butt =P
Code: Select all
#Event IRC "<#1#> #2#"
#Event IRC "[#1#(msg)] #2#"
Sub Event_IRC(IRCSay,IRCSender,IRCCommand)
/call Event_Chat "irc" "${IRCSender}" "${IRCCommand}"
/return
If a line of text matches #chat say, that line will be passed to the Sub Event_Chat. Then you do your processing there. If it doesn't match the chat line it then gets checked against every other #event you defined. You define your group messages as #events, that means every time you get say a spell worn off message, that gets checked against all your #event group stuff. At the end of the day, we still need to do text processing in Event_Chat, but there is no reason your buff fade message needs to be checked against 10s of group messages that should of been pushed to Event_Chat.warlock45 wrote:Honestly just trying to work out the reasoning here. On the surface it would seem the same amount of work for the macro/pc no matter where the even ended up. So at a guess, moving the command related events to a chat event will reduce the amount of checking I am assuming? (only triggered when something is sent in chat)
Code: Select all
SUB check_Active
/if (${Debug} || ${Debug_Background}) /echo |- check_Active ==>
/if (!${SpawnCount[pc ${Me}]}) /call check_Zoning
/if (${Me.Moving} || ${Corpse.Open}) /call check_Movement
/if (${Me.Combat}) /call check_AutoAttack
/if (${Me.Class.ShortName.NotEqual[BRD]} && ${Me.Casting.ID}) /call check_Casting
/if (${Window[BigBankWnd].Open} || ${Window[MerchantWnd].Open} || ${Window[TradeWnd].Open} || ${Window[GuildBankWnd].Open} || ${Window[MerchantWnd].Open}) /call check_MerchantWnd
/if (${Debug} || ${Debug_Background}) /echo <== check_Active -|
/RETURN
SUB check_Zoning
/varset activeTimer 15
/varset rebuffTimer 0
/RETURN
SUB check_Movement
/varset activeTimer 5
/varset rebuffTimer ${rebuffDelay}
/RETURN
SUB check_AutoAttack
/if (!${Target.ID} || ${Target.Type.Equal[corpse]} && !${Assisting}|| ${Spawn[${Target.ID}].Type.Equal[PC]} && !${Toggle-PvP}) /attack off
/RETURN
SUB check_Casting
/call e3_CastingChecks
/varset activeTimer 5
/varset rebuffTimer ${rebuffDelay}
/RETURN
SUB check_MerchantWnd
/varset activeTimer 30
/varset rebuffTimer ${rebuffDelay}
/doevents flush
/RETURN
Code: Select all
SUB check_Active
/if (${Debug} || ${Debug_Background}) /echo |- check_Active ==>
| Check Zoning
/if (!${SpawnCount[pc ${Me}]}) {
/varset activeTimer 15
/varset rebuffTimer 0
}
| Check Movement
/if (${Me.Moving} || ${Corpse.Open}) {
/varset activeTimer 5
/varset rebuffTimer ${rebuffDelay}
}
| Check AutoAttack
/if (${Me.Combat}) {
/if (!${Target.ID} || ${Target.Type.Equal[corpse]} && !${Assisting}|| ${Spawn[${Target.ID}].Type.Equal[PC]} && !${Toggle-PvP}) /attack off
}
| Check Casting
/if (${Me.Class.ShortName.NotEqual[BRD]} && ${Me.Casting.ID}) {
/if (${e3Casting}) /call e3_CastingChecks
/varset activeTimer 5
/varset rebuffTimer ${rebuffDelay}
}
| Check windows
/if (${Window[BigBankWnd].Open} || ${Window[MerchantWnd].Open} || ${Window[TradeWnd].Open} || ${Window[GuildBankWnd].Open} || ${Window[MerchantWnd].Open}) {
/varset activeTimer 30
/varset rebuffTimer ${rebuffDelay}
/doevents flush
}
/if (${Debug} || ${Debug_Background}) /echo <== check_Active -|
/RETURN