///////////////////////////////////////////////////////////////////////////////
//Town Sit v1.11
//This macro will keep an AFK user alive at the bank and periodically gate to a series of runes.
//
//Requirements:
//1. Cure, heal, and strength potions in the main storage area of the bank box.
//2. Black pearl, garlic, ginseng, mandrake root, spiders' silk, and sulfurous ash in main storage area of the bank box.
//3. Disable the trade window in General > Filter Options. If this is not done, trade windows can prevent the macro from restocking.
//
//Notes:
//1. Though you will be prompted to set a gate rune when starting the macro, it is not necessary to do so if you are simply banksitting.
//2. You can set any number of runes to gate from. Press 'Escape' when finished setting runes.
//3. If you wish to display a periodic message while AFK or a message when gating, edit the empty space between the apostrophes on lines 25 and 26. The text color can be changed on line 27.
///////////////////////////////////////////////////////////////////////////////
@clearignorelist
@clearjournal
@unsetalias 'gateRune'
@createlist 'gateMessage'
@clearlist 'gateMessage'
@createlist 'afkMessage'
@clearlist 'afkMessage'
@createlist 'messageColor'
@clearlist 'messageColor'
//Edit these lines to add or change your gate/AFK message and color.
pushlist 'gateMessage' ''
pushlist 'afkMessage' ''
pushlist 'messageColor' '96'
////////////////////////////////////////////////////////////////////
@createlist 'runeList'
@clearlist 'runeList'
@createtimer 'gateTimer'
settimer 'gateTimer' 35000
@createtimer 'reflectTimer'
settimer 'reflectTimer' 35000
@createlist 'redCount'
@clearlist 'redCount'
msg 'bank' 60
headmsg 'Note: Setting a gate rune is not necessary.' 70
promptalias 'gateRune'
if @findobject 'gateRune'
pushlist 'runeList' 'gateRune'
endif
while @findobject 'gateRune'
@unsetalias 'gateRune'
promptalias 'gateRune'
if @findobject 'gateRune'
pushlist 'runeList' 'gateRune'
endif
endwhile
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
cast 'magic reflection'
pause 2500
while not @findobject 'Infinite Loop'
for 0 to 'runeList'
if @gumpexists 0xb04c9a31
replygump 0xb04c9a31 1
msg 'bank' 60
endif
if str < 100
usetype 0xf09 'any' 'bank'
pause 600
endif
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
@getenemy 'murderer'
if murderer 'last' or criminal 'last'
if not dead 'last'
@pushlist! 'redCount' 'last'
endif
endif
if list 'redCount' >= 1
for 0 to 'redCount'
if not murderer redCount[] and not criminal redCount[]
@poplist 'redCount' redCount[]
endif
endfor
for 0 to 'redCount'
if not @findobject redCount[]
@poplist 'redCount' redCount[]
endif
endfor
endif
if list 'redCount' >= 3
cast 'greater heal'
usetype '0xf09' 'any' 'bank'
pause 600
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 900
if hits < maxhits
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
pause 850
cast 'greater heal'
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 1500
endif
while targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
if diffhits > 35
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
if targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
endif
endif
endwhile
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
if hits < maxhits
msg 'guards' 50
usetype '0xf0c' 'any' 'bank'
pause 100
if mana >= 11 and hits < maxhits
cast 'Greater Heal'
pause 500
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 900
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
pause 850
endif
endif
if mana <= 70 and not dead
useskill 'meditation'
while mana != maxmana
if dead
break
endif
if str < 100
usetype 0xf09 'any' 'bank'
pause 600
endif
@getenemy 'murderer'
if murderer 'last' or criminal 'last'
if not dead 'last'
@pushlist! 'redCount' 'last'
endif
endif
if list 'redCount' >= 1
for 0 to 'redCount'
if not murderer redCount[] and not criminal redCount[]
@poplist 'redCount' redCount[]
endif
endfor
for 0 to 'redCount'
if not @findobject redCount[]
@poplist 'redCount' redCount[]
endif
endfor
endif
if list 'redCount' >= 3
cast 'greater heal'
usetype '0xf09' 'any' 'bank'
pause 600
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 900
if hits < maxhits
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
pause 850
cast 'greater heal'
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 1500
endif
while targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
if diffhits > 35
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
if targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
endif
endif
endwhile
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
if hits < maxhits
msg 'guards' 50
usetype '0xf0c' 'any' 'bank'
pause 100
if mana >= 11 and hits < maxhits
cast 'Greater Heal'
pause 500
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
waitfortarget 900
if @targetexists
@Target 'self'
pause 1400
endif
endif
endif
if @injournal 'you stop meditating' 'system'
@clearjournal
useskill 'meditation'
endif
pause 100
if @injournal 'you must wait a few moments' 'system'
@clearjournal
pause 100
useskill 'meditation'
endif
endwhile
endif
if timer 'gateTimer' > 35000 and @findobject 'runeList[]'
settimer 'gateTimer' 0
// Gate to rune
cast 'gate travel'
waitfortarget 2500
@clearjournal
if @targetexists
@Target 'runeList[]'
pause 1400
endif
waitforjournal 'the spell fizzles' 100
while @injournal 'the spell fizzles'
@clearjournal
cast 'gate travel'
waitfortarget 2500
if @targetexists
@Target 'runeList[]'
pause 1400
endif
waitforjournal 'the spell fizzles' 100
endwhile
for 0 to gateMessage
for 0 to messageColor
msg gateMessage[] messageColor[]
endfor
endfor
if mana != maxmana
useskill 'meditation'
while mana != maxmana
if dead
break
endif
if str < 100
usetype 0xf09 'any' 'bank'
pause 600
endif
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
@getenemy 'murderer'
if murderer 'last' or criminal 'last'
if not dead 'last'
@pushlist! 'redCount' 'last'
endif
endif
if list 'redCount' >= 1
for 0 to 'redCount'
if not murderer redCount[] and not criminal redCount[]
@poplist 'redCount' redCount[]
endif
endfor
for 0 to 'redCount'
if not @findobject redCount[]
@poplist 'redCount' redCount[]
endif
endfor
endif
if list 'redCount' >= 3
cast 'greater heal'
usetype '0xf09' 'any' 'bank'
pause 600
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 900
if hits < maxhits
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
pause 850
cast 'greater heal'
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
waitfortarget 1500
endif
while targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
if diffhits > 35
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
600
endif
if targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
target 'self'
endif
endif
endwhile
endif
if poisoned
msg 'guards' 50
usetype '0xf07' 'any' 'bank'
pause 600
endif
if hits < maxhits
msg 'guards' 50
usetype '0xf0c' 'any' 'bank'
pause 100
if mana >= 11 and hits < maxhits
cast 'Greater Heal'
pause 500
msg 'guards' 50
if poisoned
usetype '0xf07' 'any' 'bank'
pause 600
endif
waitfortarget 900
if @targetexists
if counttype '0xf7a' 'any' 'backpack' < 6
@movetype '0xf7a' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf84' 'any' 'backpack' < 1
@movetype '0xf84' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf85' 'any' 'backpack' < 2
@movetype '0xf85' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf86' 'any' 'backpack' < 3
@movetype '0xf86' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8d' 'any' 'backpack' < 4
@movetype '0xf8d' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
if counttype '0xf8c' 'any' 'backpack' < 5
@movetype '0xf8c' 'bank' 'self' 0 0 0 'any' 15
pause 600
endif
@Target 'self'
pause 1400
endif
endif
endif
if @injournal 'you stop meditating' 'system'
@clearjournal
useskill 'meditation'
endif
pause 100
if @injournal 'you must wait a few moments' 'system'
@clearjournal
pause 100
useskill 'meditation'
endif
endwhile
endif
endif
if timer 'reflectTimer' > 32175
cast 'magic reflection'
for 0 to afkMessage
for 0 to messageColor
msg afkMessage[] messageColor[]
endfor
endfor
settimer 'reflectTimer' 0
endif
pause 50
endfor
endwhile