Howto to Standby the macro when zone to prevent crash.
Posted: Sun May 13, 2018 3:33 pm
To add a standby in macro, you can probably add a /delay 5s in an macro event :
Use doevents in your code
And if that's not enough, create also an function to check if the ID and INSTANCE as changed
in the beginning of the main loop :
////------------------------------////
More hard do a standby without timer brake, and extract of my code : (sure is a brut code need to declare var and make some adjust)
At the begin of the main loop
Code: Select all
#Event Zonein "You have entered#*#"
Use doevents in your code
Code: Select all
/doevents
Code: Select all
Sub Event_Zonein
/echo Macro in standby for 5s
/delay 5s
/return
And if that's not enough, create also an function to check if the ID and INSTANCE as changed
in the beginning of the main loop :
Code: Select all
/call ZoningCheck
Code: Select all
Sub ZoningCheck
/if (!${Defined[ZoneID]}) /declare ZoneID int outer ${Zone.ID}
/if (!${Defined[InstanceID]}) /declare InstanceID int outer ${NetBots[${Me.CleanName}].Instance}
/if (${Zone.ID}!=${ZoneID} || ${NetBots[${Me.CleanName}].Instance}!=${InstanceID}) {
/echo Macro in standby for 5s
/delay 5s
}
/return
////------------------------------////
More hard do a standby without timer brake, and extract of my code : (sure is a brut code need to declare var and make some adjust)
Code: Select all
#Event Zonein "You have entered#*#"
At the begin of the main loop
Code: Select all
|** ZONING LOOP - PREVENT ZONING DESYNC **|
/call ZoningCheck
/doevents Zonein
/if (${MacroStartTimer} || ${RefreshTime}==${MacroQuest.Running}) /goto :loop
|---------------------------------------------------------------------------^^^^^
Code: Select all
Sub ZoningCheck
/if (${Zone.ID} && ${NetBots[${Me.CleanName}].Zone}) {
/if (${Zone.ID}!=${ZoneID} || ${NetBots[${Me.CleanName}].Instance}!=${InstanceID}) {
/varset MacroStartTimer 5s
/call Reset |---> some reset function, turn off
/call ZoneStat |---> my zoning stat function
}
} else {
/varset MacroStartTimer 5s
/call Reset |---> some reset function, turn off
}
/varset ZoneID ${Zone.ID}
/varset InstanceID ${NetBots[${Me.CleanName}].Instance}
/if (${MacroStartTimer}) {
/varset ZoningDone 1
} else /if (!${MacroStartTimer} && ${ZoningDone}) {
/varset ZoningDone 0
/varset ZoningOfftankFilter 1
/docommand /${echo} -Zoning ${Cg}done${Cx} - Macro ${Cg}ON${Cx}
/call ZoneDesyncCheck |---> my Desync Zoning check function
}
/return
Code: Select all
Sub Event_Zonein
/varset ZoneID ${Zone.ID}
/varset InstanceID ${NetBots[${Me.CleanName}].Instance}
/varset MacroStartTimer 5s
/call Reset |---> some reset function, turn off
/return