Hey everybody,
I'm trying to cast Protection if I don't already have the buff. I copied the Protection script from TM's strip miner script and can't seem to get it to work.
Currently I'm doing
;==================
sub CastProtection
event macro 8 2 ; open status
gosub GumpWait status_gump status_gump
contpos 0 680
wait 20
gosub scanbar
event sysmessage #result
if _protection_ notin #result
{
event sysMessage casting protection...
event macro 15 14
while a in #charstatus
wait 1
wait 5
}
return
sub scanBar
namespace push
namespace local scanBar . #charid
if %whawhawha = #false 2
namespace clear
set %whawhawha #true
set !tempLpc #lpc
set #lpc 10000
if %1 <> n/a && %2 <> n/a && %1 > -10000000 && %1 < 49000000000 2
set !percentOhx %1
set !percentOhy %2
else 2
set !percentOhx n/a
set !percentOhy n/a
if !scanOffset = n/a
gosub setVars %1 %2
set !buttonX . 1 !blueButtonX . 1 + !blueContPosX . 1
set !buttonY . 1 !blueButtonY . 1 + !blueContPosY . 1
if #contname <> buffIcons_Gump || ( #contName = buffIcons_Gump && ( #contposx <> !blueContPosX . 1 || #contposy <> !blueContPosY . 1 ) ) 3
savepix !buttonX . 1 !buttonY . 1 !savePixelNumber
if ( #pixcol < !blueButtonPixCol . 1 - !scanOffset || #pixcol > !blueButtonPixcol . 1 + !scanOffset ) && #pixcol < !high
gosub findBarVars
set %icons . #charid _
set !notFound 0
for !scanIcons 1 !scanBarIconCount
{
set !x !scanX + ( ( !scanIcons - 1 ) * 31 )
savepix !x !scanY !savePixelNumber
;event sysmessage #pixcol scan1
if #pixcol = 0 || #pixcol > 16779215
break
if ! . #pixcol <> n/a && ! . #pixcol <> block && ! . #pixcol <> massCurse && ! . #pixcol <> Curse && ! . #pixcol <> Sleep && ! . #pixcol <> Consecrate && ! . #pixcol <> HeatOfBattle && ! . #pixcol <> SplinteringDebuff && ! . #pixcol <> Feeblemind && ! . #pixcol <> Tribulation && ! . #pixcol <> MedusaStone && ! . #pixcol <> FastSkillGain 4
if _ , ! . #pixcol , _ in %icons . #charid
continue
set %icons . #charid %icons . #charid , ! . #pixcol , _
continue
gosub S1
if !notFound >= 2
break
}
set #result %icons . #charid
set #lpc 10
namespace pop
return #result
; %1 = Gumpname 1
; %2 = Gumpname 2
; #TRUE gump occured before timeout
sub gumpWait
namespace push
namespace local GW
set !timedelay #SCNT
while #SCNT <= !timedelay + 2
{
if #CONTNAME = %1 || #CONTNAME = %2 2
namespace pop
return #TRUE
}
namespace pop
return #FALSE
Thanks