Trouble with --> Func GetEffectTimeRemaining

04/01/2023 09:02 xnx#1
Code:
;~ Description: Returns time remaining before an effect expires, in milliseconds.
Func GetEffectTimeRemaining($aEffect)
	If Not IsDllStruct($aEffect) Then $aEffect = GetEffect($aEffect)
	If IsArray($aEffect) Then Return 0
	Return DllStructGetData($aEffect, 'Duration') * 1000
;~ 	Return DllStructGetData($aEffect, 'Duration') * 1000 - (GetSkillTimer() - DllStructGetData($aEffect, 'TimeStamp'))
EndFunc   ;==>GetEffectTimeRemaining
Having trouble with this little piece of GWA2 not returning what it should return. Just returning 0 always.

Any suggestions for solving this problem?
04/01/2023 23:02 sadusten#2
Quote:
Originally Posted by xnx View Post
Code:
;~ Description: Returns time remaining before an effect expires, in milliseconds.
Func GetEffectTimeRemaining($aEffect)
	If Not IsDllStruct($aEffect) Then $aEffect = GetEffect($aEffect)
	If IsArray($aEffect) Then Return 0
	Return DllStructGetData($aEffect, 'Duration') * 1000
;~ 	Return DllStructGetData($aEffect, 'Duration') * 1000 - (GetSkillTimer() - DllStructGetData($aEffect, 'TimeStamp'))
EndFunc   ;==>GetEffectTimeRemaining
Having trouble with this little piece of GWA2 not returning what it should return. Just returning 0 always.

Any suggestions for solving this problem?
Are you inputting the actuall skillid of the skill and not your "number" on your bar?

Should be like this example:
Code:
Global $100b_effect = 381 "actual skillID of 100b skill"
Global $100b = 4 "Slot 4 on my bar"
Code:
If geteffecttimeremaining($100b_effect) = 0 Then
  If isrecharged($100b) And getenergy(-2) >= 5 Then
	useskill($100b, 0)
	Sleep(getping() + 100)
  EndIf
EndIf