Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 20

;C2's Donate-o-Matic

;Version: 1.3d
;Shard: OSI
;Purpose: Donate wood and ingots to Collections
;Credits: TM Recall Subs, Ultima for vesper rail
;Revisions:
;11/9 added raw fish steaks, dragon scales, fixed bank issue, id on fish updated
;6/23 added rails and leather to system and fixed display container to display
correct item
;6/25 added rail to vesper donated by Ultima!!!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;You Set;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
set %travel RE ; RE for recall SJ for sacred
set %bank #false
set %home #true
set %drag_wood_amount 400 ; this is set for leather too!
set %drag_ingot_amount 3000 ; this is fish and scales too!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gosub SetLocations

Main:
repeat
gosub FindandDonate
gosub Restock
until #charghost = yes
halt

sub FindandDonate
gosub openup
repeat
if %DonateIngots = #true
{
finditem %wood c_ , #backpackid
if #FINDKIND = -1
{
gosub GetMore
if #result = 0 || #result = false
return
}
set %stack #findstack
if #findcol = 2219
gosub click %genx %valy %cont 3 3
if #findcol = 2207
gosub click %genx %very %cont 2 3
if #findcol = 2425
gosub click %genx %agay %cont 2 3
if #findcol = 2213
gosub click %genx %goldy %cont 2 3
if #findcol = 2418
gosub click %genx %brzy %cont 2 3
if #findcol = 2413
gosub click %genx %copy %cont 2 3
if #findcol = 2406
gosub click %genx %shady %cont 1 3
if #findcol = 2419
gosub click %genx %dcy %cont 1 3
if #findcol = 0
gosub click %genx %irony %cont 1 3
}
if %DonateWood = #true
{
finditem TLK c_ , #backpackid
if #FINDKIND = -1
{
gosub GetMore
if #result = #false || #result = 0
return
}
set %stack #findstack
if #findcol = 1151 && %brit = #true
gosub click %genx %bfy %cont 3 3
if #findcol = 1151 && %vesp = #true
gosub click %genx %vfy %cont 2 3
if #findcol = 1194 && %brit = #true
gosub click %genx %bby %cont 3 3
if #findcol = 1194 && %vesp = #true
gosub click %genx %vby %cont 2 3
if #findcol = 1193 && %brit = #true
gosub click %genx %bhy %cont 2 3
if #findcol = 1193 && %vesp = #true
gosub click %genx %vhy %cont 2 3
if #findcol = 1192 && %brit = #true
gosub click %genx %byy %cont 2 3
if #findcol = 1192 && %vesp = #true
gosub click %genx %vyy %cont 2 3
if #findcol = 1191 && %brit = #true
gosub click %genx %bay %cont 2 3
if #findcol = 1191 && %vesp = #true
gosub click %genx %vay %cont 1 3
if #findcol = 2010 && %brit = #true
gosub click %genx %boy %cont 2 3
if #findcol = 2010 && %vesp = #true
gosub click %genx %voy %cont 1 3
if #findcol = 0 && %brit = #true
gosub click %genx %bwy %cont 2 3
if #findcol = 0 && %vesp = #true
gosub click %genx %vwy %cont 1 3
}
if %donatefish = #true
{
finditem HND c_ , #backpackid
if #FINDKIND = -1
{
gosub GetMore
if #result = #false || #result = 0
return
}
set %stack #findstack
gosub click %genx %fishy %cont 2 3
}
if %donatescales = #true
{
finditem STO c_ , #backpackid
if #FINDKIND = -1
{
gosub GetMore
if #result = #false || #result = 0
return
}
set %stack #findstack
gosub click %genx %scalesy %cont 2 3
}
if %donateleather = #true
{
finditem %leather c_ , #backpackid
if #FINDKIND = -1
{
gosub GetMore
if #result = 0 || #result = false
return
}
set %stack #findstack
if #findcol = %scolor
gosub click %genx %spinedy %cont 4 3
if #findcol = %hcolor
gosub click %genx %hornedy %cont 5 3
if #findcol = %bcolor
gosub click %genx %barbedy %cont 5 3
if #findcol = 0
gosub click %genx %regulary %cont 4 3
}
wait 10
until #charghost = yes
halt
return

sub click ;%1 xpos (%genx), %2=ypos, %3= contsize, %4= page, %5=timer
repeat
finditem %containerid g_2
event property #findid
if %containerprop notin #property
ignoreitem #findid
until %containerprop in #property
set %donation #findid
set #lobjectid %donation
event macro 17
wait 20
set %safetytimer #scnt + %5
repeat
until #contsize = %3 || #scnt > %safetytimer
if %4 = 5
{
set %clickx %nx + #contposx
set %clicky %ny + #contposy
click %clickx %clicky
repeat
until #contsize = %3 || #scnt > %safetytimer
wait 10
}
if %4 = 4 || %4 = 5
{
set %clickx %nx + #contposx
set %clicky %ny + #contposy
click %clickx %clicky
repeat
until #contsize = %3 || #scnt > %safetytimer
wait 10
}
if %4 = 3 || %4 = 4 || %4 = 5
set %clickx %nx + #contposx
set %clicky %ny + #contposy
click %clickx %clicky
repeat
until #contsize = %3 || #scnt > %safetytimer
wait 10
}
if %4 = 2 || %4 = 3 || %4 = 4 || %4 = 5
{
set %clickx %nx + #contposx
set %clicky %ny + #contposy
click %clickx %clicky
repeat
until #contsize = %3 || #scnt > %safetytimer
}
wait 10
set %clickx %1 + #contposx
set %clicky %2 + #contposy
click %clickx %clicky
finditem %itemtodonate c_ , #backpackid
wait 20
if #findstack <> 0
msg #findstack $
return

sub GetMore
finditem %itemtodonate c_
if #findkind = -1
return #false
exevent drag #findid %dragamountself
wait 10
exevent dropc #backpackid
wait 20
return #true

sub restock
set %clickx %nx + #contposx
set %clicky %ny + #contposy
click %clickx %clicky r
gosub TM_TravelFromNamedRunebook %travel %secure1 %secure2 %bookname
wait 20
gosub openup
if %home = #true
{
finditem %secure
set #lobjectid #findid
event macro 17
}
if %bank = #true
{
event macro 3 0 bank
set %safetytimer #scnt + 8
repeat
until #contid = %bankbox || #scnt > %safetytimer
set #lobjectid %secure
event macro 17
}
wait 30
finditem %itemtodonate c_ , %secure
if #findkind = -1
{
Display All Done Halting!
halt
}
exevent drag #findid %dragamountself
wait 10
exevent dropc #backpackid
wait 20
finditem %itemtodonate c_ , %secure
exevent drag #findid %dragamountpet
wait 10
exevent dropc %packie
wait 20
gosub TM_TravelFromNamedRunebook %travel %donation1 %donation2 %bookname
if %userail = #true
gosub rail
return

;--------- EasyUO Menu Designer Code Begin ---------


sub showEUOMenu1
menu Clear
menu Window Title Donate-o-Matic
menu Window Color Silver
menu Window Size 243 158
menu Font Transparent #true
menu Font Align Right
menu Font Name Comic Sans MS
menu Font Size 12
menu Font Style b
menu Font Color WindowText
menu Font Transparent #false
menu Font Align Left
menu Font BGColor Silver
menu Text EUOLabel1 28 4 Where:
menu Font Color Black
menu Text EUOLabel2 28 56 What:
menu Font Color WindowText
menu Text EUOLabel3 28 108 Animal
menu Font Size 8
menu Text EUOLabel4 184 44 Spot
menu Text EUOLabel5 216 44 Spot
menu Text EUOLabel6 216 60 Two
menu Text EUOLabel7 184 60 One
menu Text EUOLabel8 128 4 Runebook
menu Text EUOLabel9 188 4 Name:
menu Text EUOLabel10 116 80 Home/Bank:
menu Text vesper 116 100 Donation Loc.:
menu Font Name MS Sans Serif
menu Font Style
menu Font BGColor Window
menu Combo Create where 4 28 105
menu Combo Add where Vesper
menu Combo Add where Britian
menu Font Name MS Sans Serif
menu Font Style
menu Combo Create what 4 80 105
menu Combo Add what Wood
menu Combo Add what Ingots
menu Combo Add what Fish Steaks
menu Combo Add what Dragon Scales
menu Combo Add what Leather
menu Font Name MS Sans Serif
menu Font Style
menu Font BGColor $00FF80FF
menu Button begin 112 48 59 25 Begin
menu Font BGColor Window
menu Combo Create animal 4 128 105
menu Combo Add animal Beetle
menu Combo Add animal Pack Horse
menu Edit runebook 136 20 81 donation
menu Edit homeone 193 80 19 1
menu Edit hometwo 216 80 21 2
menu Edit donationone 192 100 21 3
menu Edit donationtwo 216 100 21 4
menu Font Name Comic Sans MS
menu Font Style b
menu Font BGColor Silver
menu Check rail 128 132 97 17 #false Turn Rail On?
menu Show 421 270
menu HideEUO
set #menubutton N/A
repeat
until #menubutton <> N/A
menu hide ;menu hide -will hide menu
return

;--------- EasyUO Menu Designer Code End ---------

sub SetLocations
;;;;;;;;;;;;;;;;;Brit locations for wood and pages;;;;;;;;;;;;;;;;;;;;;
set %bwy 165 ; 2nd page
set %boy 200 ; 2nd page
set %bay 234 ; 2nd page
set %byy 270 ; 2nd page
set %bhy 301 ; 2nd page
set %bby 165 ; 3rd page
set %bfy 200 ; 3rd page
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;Brit locations for ingots and pages;;;;;;;;;;;;;;;;;;;;;
set %irony 238 ;page one
set %dcy 273 ;page one
set %shady 308 ;page one
set %copy 165 ;page two
set %brzy 200 ;page two
set %goldy 234 ;page two
set %agay 270 ;page two
set %very 305 ;page two
set %valy 166 ;page three
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;Brit Leather Locations;;;;;;;;;;;;;;;;;;;;;
Set %regulary 265 ;page 4
set %spinedy 304 ;page 4
set %scolor 2220
set %hornedy 168 ;page 5
set %hcolor 2117
set %barby 206 ;page 5
set %bcolor 2129
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;Vesper locations for wood and pages;;;;;;;;;;;;;;;
set %vwy 240 ; 2nd page
set %voy 274 ; 2nd page
set %vay 307 ; 2nd page
set %vyy 166 ; 2nd page
set %vhy 201 ; 2nd page
set %vby 235 ; 3rd page
set %vfy 268 ; 3rd page
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
set %fishy 306 ;2nd page
set %scale 196 ;2nd page
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
set %genx 39
set %nx 308
set %ny 344
set %cont 345_359
set %wood TLK
set %ingots ENK
set %leather JJG
gosub showEUOMenu1
menu get rail
if #menures = #true
set %userail #true
menu get runebook
set %bookname #menures
menu get homeone
set %secure1 #menures
menu get hometwo
set %secure2 #menures
menu get donationone
set %donation1 #menures
menu get donationtwo
set %donation2 #menures
gosub openup
menu get what
if #menures = 1
set %donatingthis wood
if #menures = 2
set %donatingthis ingots
if #menures = 3
set %donatingthis fish
if #menures = 4
set %donatingthis scales
if #menures = 5
set %donatingthis leather
menu get where
if #menures = 1 && %donatingthis = ingots || #menures = 1 && %donatingthis = fish
|| #menures = 1 && %donatingthis = leather
{
Display Silly Rabbit... Vesper Doesn't Take These! Restart
halt
}
if #menures = 1
{
set %vesp #true
set %donatewood #true
set %containerid HKF
set %containerprop public
set %dragamountself %drag_wood_amount
set %dragamountpet 1600
set %itemtodonate TLK
}
if #menures = 2
{
set %containerbrit HS
menu get what
if #menures = 1
{
set %itemtogetnow Wood
set %brit #true
set %donatewood #true
set %containerid HS
set %containerprop artist
set %dragamountself %drag_wood_amount
set %dragamountpet 1600
set %itemtodonate TLK
}
if #menures = 2
{
set %itemtogetnow Ingots
set %brit #true
set %donateingots #true
set %containerid HS
set %containerprop trades
set %dragamountself %drag_ingot_amount
set %dragamountpet 16000
set %itemtodonate ENK
}
if #menures = 3
{
set %itemtogetnow Fish
set %brit #true
set %donatefish #true
set %containerid IS
set %containerprop fisher
set %dragamountself %drag_ingot_amount
set %dragamountpet 16000
set %itemtodonate IND
}
if #menures = 4
{
set %itemtogetnow Scales
set %brit #true
set %donatescales #true
set %containerid IS_HS
set %containerprop animal
set %dragamountself %drag_ingot_amount
set %dragamountpet 16000
set %itemtodonate STO
}
if #menures = 5
{
set %itemtogetnow Leather
set %brit #true
set %donateleather #true
set %containerid HS
set %containerprop trades
set %dragamountself %drag_wood_amount
set %dragamountpet 1600
set %itemtodonate JJG
}
}
if %bank = #true
{
event macro 3 0 bank
wait 60
set %bankbox #contid
display Target Your Secure!
wait 1
set #targcurs 1
target
while #targcurs = 1
wait 0
set %secure #ltargetid
set #lobjectid %secure
event macro 17
wait 20
}
if %home = #true
{
display Target Your Secure With the %itemtogetnow in it!
wait 1
set #targcurs 1
target
while #targcurs = 1
wait 0
set %secure #ltargetid
set #lobjectid %secure
event macro 17
wait 20
}
finditem %itemtodonate c_ , %secure
exevent drag #findid %dragamountself
wait 10
exevent dropc #backpackid
wait 20
finditem %itemtodonate c_ , %secure
exevent drag #findid %dragamountpet
wait 10
exevent dropc %packie
wait 20
gosub TM_TravelFromNamedRunebook %travel %donation1 %donation2 %bookname
wait 30
if %userail = #true
gosub rail
return

sub openup
menu get animal
if #menures = 1
{
set #lobjectid #charid
event macro 17
wait 40
event macro 3 0 all follow me
finditem ZGB g_2
set %packie #findid
exevent popup #findid
wait 20
set %clickx #CONTPOSX + 50 ;clicks to open beetle pack
set %clicky #CONTPOSY + 183
click %clickx %clicky f
set %contid #contid
}
if #menures = 2
{
relook:
finditem BO_WN g_2
if #findkind = -1
{
event macro 3 0 all follow me
goto relook
}
set %packie #findid
set #lobjectid #findid
event macro 17
wait 20
set %contid #contid
}
return

;=====================================================================
; %1 = Method (RE, GA, SJ)
; %2 = Object Findid
; returns #TRUE if error, #FALSE for no error

;----------------------TM travel subs--------------------------


;=================================================================
; Script Name: TrailMyx's Runebook/Spellcast Subs
; Author: TrailMyx
; Version: 2.5
; Shard OSI / FS: OSI / FS
; Revision Date: 09/27/2007
; Purpose:
; Runebook subs to manage your runebook travel needs. You need either to know
; the runebook ID or runebook name.
;
; Subroutines:
; TM_NewCastSpell - casts spells with appropriate waits, delays, retrys.
; TM_TravelFromRunebook - Uses specified runbook #FINDID to travel from . If a
location is blocked
; the next location will be tried until success.
; TM_TravelFromNamedRunebook - Same as TM_TravelFromRunebook, but allows you to
specify a runebook name
;
; Examples:
; gosub TM_NewCastSpell 31 !rbook 10 20 20 ; recall
; gosub TM_TravelFromRunebook RE 1 3 %runebookid ; travel (recall) to location
from #FINDID runebook using slots 1-3
; gosub TM_TravelFromNamedRunebook GA 1 2 LUMBERJACKING1 ; gate using
LUMBERJACKING1 runebook starting at rune 1
; gosub TM_RandomRunebookTravel SJ 1 6 %runebookid ; Randomly choose a rune
from 1-6 in runebook
; gosub TM_TravelFromObject RE %runeid ; travels to rune specified by %runeid
;
; Use of these subrountes is allowed, but please give me (TrailMyx) credit
somewhere in your script.
;
; Release History:
; 2.0 - Initial public release
; 2.1 - Bug in TM_FindValidTextNoAdvance, added return value to
TM_TravelFromNamedRunebook
; 2.2 - Bug in TM_NewCastSpell when mana gets too low
; 2.3 - Better spellcasting for chivalry, necro
; Added TM_TravelFromNamedRunebook
; Added TM_RandomRunebookTravel
; 2.4 - Little fix for journal handler
; 2.5 - Hack to allow for transport through a red moongate.
;
; Requirements:
;
; This script requires that you have your character name
; setup in a variable called %charname. Place this bit of code
; in your script initialization somewhere:
;
; gosub TM_AddUnderscore #CHARNAME
; set %charname #RESULT
; %1 = spell number
; %2 = #TARGETID or SELF or NONE
; %3 = retry count (-1 = cast until successful)
; %4 = cast delay
; %5 = recovery delay
sub TM_NewCastSpell
namespace push
namespace local NCS
set !lpc #LPC
set #LPC 100
set !whichspell %1
set !whichtarget %2
set !castretrymax %3
set !waitdelay %4
set !recovery_delay %5

set !castretry 0
set !temp_ltargetid #LTARGETID
set !temp_ltargetkind #LTARGETKIND

NewCastSpell_loop1:
if !castretrymax < 0
goto NewCastSpell_cont1
if !castretry > !castretrymax
goto NewCastSpell_end1
NewCastSpell_cont1:
gosub TM_SyncTextScan
set #LTARGETKIND 1
set #LTARGETID !whichtarget
set !tempmana #MANA
event macro 15 !whichspell ; cast the spell
wait !waitdelay
set !targettimeout #SCNT + 7
NewCastSpell_wait1:
gosub TM_FindValidTextNoAdvance spell_fizzles you_have_not_yet mana
your_spirit more_reagents
if #RESULT = #TRUE || #SCNT > !targettimeout
{
set !casttimeout #SCNT2 + !recovery_delay
repeat
until #SCNT2 > !casttimeout ; finish up cast delay
set !castretry !castretry + 1
goto NewCastSpell_loop1
}
if !whichtarget = NONE
goto NewCastSpell_skip1
if #TARGCURS = 1
goto NewCastSpell_targ1
goto NewCastSpell_wait1 ; wait for target cursor

NewCastSpell_targ1:
if !whichtarget = SELF
event macro 23
else
event macro 22

NewCastSpell_skip1:
wait 5
set !casttimeout #SCNT2 + !recovery_delay
NewCastSpell_skip2:
if !whichspell >= 0 && !whichspell <= 63 ; Magery
{
gosub TM_FindValidTextNoAdvance spell_fizzles there_is_already mana
your_spirit more_reagents
}
else
{
set !cont #FALSE ; Chivalry, Necromancy, etc
finditem !whichtarget *
if !whichtarget in SELF_NONE || #FINDKIND <> -1
set !cont #TRUE

if #MANA >= !tempmana && !cont = #TRUE ; check if target is still there
set #RESULT #TRUE
else
set #RESULT #FALSE
}
repeat
until #SCNT2 > !casttimeout ; finish up cast delay
if #RESULT = #TRUE
{
if !castretrymax > -1
{
set !castretry !castretry + 1 ; %castretrymax of -1 will cast until
successful
if !castretry > !castretrymax
goto NewCastSpell_end1
}
goto NewCastSpell_loop1
}
if #SCNT2 <= !casttimeout ; finish up cast delay
goto NewCastSpell_skip2
NewCastSpell_end1:
set #LTARGETID !temp_ltargetid
set #LTARGETKIND !temp_ltargetkind
set #LPC !lpc
namespace pop
return
;-------------------------------------------------------------------------------
; %1 = Method (RE, GA, SJ)
; %2 = index location within runebook (1-16)
; %3 = index location within runebook (1-16), try up to this point
; %4 = runebook item id
; returns #TRUE if error, #FALSE for no error
sub TM_TravelFromRunebook
namespace push
namespace local RFR
set #LTARGETKIND 1
set !method %1
set !locindex %2
set !locindexend %3
set !rbook %4

finditem !rbook C_ , #BACKPACKID


if !method notin RE_GA_SJ || #FINDKIND = -1
{
namespace pop
return #TRUE
}
if !locindex notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
{
namespace pop
return #TRUE
}
if !locindexend notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
{
namespace pop
return #TRUE
}

TravelFromRunebook_loop1:
set #LOBJECTID !rbook
set #LTARGETKIND 1
event macro 17 0
gosub GumpWait generic_gump generic_gump

set !runeclickx 140 ; page 1, rune 1


set !runeclickx ( #CONTPOSX + !runeclickx + ( 35 * ( ( !locindex - 1 ) /
2 ) ) )
if !locindex > 8
{
set !runeclickx 310 ; page 2, rune 1
set !runeclickx ( #CONTPOSX + !runeclickx + ( 35 * ( ( !locindex - 9 ) /
2 ) ) )
}
set !runeclicky #CONTPOSY + 196
click !runeclickx !runeclicky
wait 5

set !runeclicky #CONTPOSY + 24


set !runeclickx #CONTPOSX + 164 ; page 1 set to default
if !locindex % 2 = 0
{
set !runeclickx #CONTPOSX + 305 ; page 2 set to default
}
click !runeclickx !runeclicky
wait 5
set !oldx #CHARPOSX
set !oldy #CHARPOSY
if !method = RE
gosub TM_NewCastSpell 31 !rbook -1 10 10 ; recall until successful
if !method = GA
{
gosub TM_NewCastSpell 51 !rbook -1 10 20 ; gate until successful
set !temp_cnt #SCNT + 10
repeat
finditem KEF_OTF_JEF G_0
until #FINDKIND <> -1 || #SCNT > !temp_cnt
if #FINDKIND <> -1
{
set #LOBJECTID #FINDID
wait 10
event macro 17 0
wait 20
if #CONTNAME = generic_gump && #CONTSIZE = 420_280
{
gosub TM_SyncTextScan
set !clickx #CONTPOSX + 26
set !clicky #CONTPOSY + 261
click !clickx !clicky ; click ok
}
}
}

if !method = SJ
gosub TM_NewCastSpell 210 !rbook -1 40 60 ; sacred journey until successful
wait 30

set !tempscnt #SCNT + 10


WaitforTravel_loop1:
gosub TM_FindValidTextNoAdvance location_is_blocked something_is_blocking
you_spirit_lacks
if #RESULT = #TRUE
{
gosub TM_SyncTextScan
set !locindex !locindex + 1
if !locindex > !locindexend
{
namespace pop
return #TRUE
}
goto TravelFromRunebook_loop1
}
if ( ( #CHARPOSX = !oldx && #CHARPOSY = !oldy ) && #SCNT < !tempscnt )
goto WaitforTravel_loop1
if #CONTNAME = generic_gump && #CONTSIZE = 452_236 ; RunUO close runebook
{
set !clickx #CONTPOSX + 120
set !clicky #CONTPOSY + 60
click !clickx !clicky mc r
wait 5
}
namespace pop
click 401 254 n
return #FALSE
;------------------------------------------------
; %1 method
; %2 starting index
; %3 ending index
; %4 runebook name
sub TM_TravelFromNamedRunebook
namespace push
namespace local TFNR
set !method %1
set !start_index %2
set !end_index %3
set !runbook_name %4
if !method notin RE_GA_SJ
{
namespace pop
return #TRUE
}
if !start_index notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
{
namespace pop
return #TRUE
}
if !end_index notin 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16
{
namespace pop
return #TRUE
}
locatenamedrunebook:
finditem ZBN C_ , #BACKPACKID
if #FINDKIND <> -1
{
event property #FINDID
if !runbook_name in #PROPERTY
{
gosub TM_TravelFromRunebook !method !start_index !end_index #FINDID ;
recall to location
}
else
{
ignoreitem #FINDID rbook
goto locatenamedrunebook
}
}
else
{
display ok Cannot locate specified runebook named , #SPC , !runbook_name
stop
}
ignoreitem reset rbook
namespace pop
return
;-------------------------------------------------------------------------------
sub TM_RandomRunebookTravel
namespace push
namespace local RRT
set !travelmethod %1
set !rune1 %2
set !rune2 %3
set !runebook %4
if !rune1 > !rune2
{
set !temp !rune2
set !rune2 !rune1
set !rune1 !temp
}
RunebookTravel_loop1:
set !random #RANDOM
set !rune ( ( !random % ( !rune2 - !rune1 + 1 ) ) + !rune1 )
gosub TM_TravelFromRunebook !travelmethod !rune !rune !runebook
if #RESULT = #TRUE
goto RunebookTravel_loop1
namespace pop
return
;-------------------------------------------------------------------------------
; %1 = Method (RE, GA, SJ)
; %2 = Object Findid
; returns #TRUE if error, #FALSE for no error
sub TM_TravelFromObject
namespace push
namespace local RFR
set !method %1
set !object %2

finditem !object C_ , #BACKPACKID


if !method notin RE_GA_SJ || #FINDKIND = -1
{
namespace pop
return #TRUE
}

set !oldx #CHARPOSX


set !oldy #CHARPOSY
TravelFromObject_loop1:
if !method = RE
gosub TM_NewCastSpell 31 !object -1 10 10 ; recall until successful
if !method = GA
{
gosub TM_NewCastSpell 51 !object -1 10 20 ; gate until successful
set !temp_cnt #SCNT + 10
repeat
finditem KEF_OTF_JEF G_0
until #FINDKIND <> -1 || #SCNT > !temp_cnt
if #FINDKIND <> -1
{
set #LOBJECTID #FINDID
wait 10
event macro 17 0
wait 20
if #CONTNAME = generic_gump && #CONTSIZE = 420_280
{
gosub TM_SyncTextScan
set !clickx #CONTPOSX + 26
set !clicky #CONTPOSY + 261
click !clickx !clicky ; click ok
}
}
}

if !method = SJ
gosub TM_NewCastSpell 210 !object -1 10 30 ; sacred journey until successful
wait 30

set !tempscnt #SCNT + 10


WaitforTravel2_loop1:
gosub TM_FindValidTextNoAdvance location_is_blocked something_is_blocking
your_spirit_lacks
if #RESULT = #TRUE
{
gosub TM_SyncTextScan
set !locindex !locindex + 1
if !locindex > !locindexend
{
namespace pop
return #TRUE
}
goto TravelFromObject_loop1
}

if ( ( #CHARPOSX = !oldx && #CHARPOSY = !oldy ) && #SCNT < !tempscnt )


goto WaitforTravel2_loop1
namespace pop
return #FALSE
;-------------------------------------------------------------------------------
; Brings !_jindex up to the most recent #journal entry
sub TM_SyncTextScan
namespace push
namespace local text
set !_jindex #jindex + 1
namespace pop
return
;-------------------------------------------------------------------------------
; %1, %2, %3, etc strings to match
; returns #TRUE for match, #FALSE for no match
; Will not advance !_jindex pointer to allow for scanning journal history for more
than one search.
; Also searches for : , #SPC in journal entry to be sure someone isn't spamming
the text
sub TM_FindValidTextNoAdvance
namespace push
namespace local text
set !temp_lpc #LPC
set #LPC 1000
set !num_args %0
set !first_arg 1
if !_jindex = N/A
set !_jindex #jindex
set !index !first_arg
repeat
set !temp_jindex !_jindex
set !text % . !index
while !temp_jindex <= #jindex
{
scanjournal !temp_jindex
str pos #JOURNAL %charname 1
set !namepos #STRRES
str count #JOURNAL %charname
set !namecnt #STRRES
str pos #JOURNAL :_ 1
set !smcpos #STRRES
str pos #JOURNAL !text 1
set !textpos #STRRES
if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL
set !pass #TRUE
else
set !pass #FALSE
if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
{
set !temp_jindex !temp_jindex + 1
set #LPC !temp_lpc
namespace pop
return #TRUE
}
set !temp_jindex !temp_jindex + 1
}
set !index !index + 1
until !index - !first_arg >= !num_args
set #LPC !temp_lpc
namespace pop
return #FALSE
;-------------------------------------------------------------------------------
; %1 - string to mung
sub TM_AddUnderscore
namespace push
namespace local AU
set !tempstring %1
AddUnderscore_loop1:
str pos !tempstring #SPC
if #STRRES <> 0
{
set !val #STRRES - 1
str left !tempstring !val
set !left #STRRES
set !val !val + 1
str del !tempstring 1 !val
set !tempstring !left , _ , #STRRES
goto AddUnderscore_loop1
}
set #RESULT !tempstring
namespace pop
return #RESULT
;-------------------------------------------------------------------------------
; %1 = Gumpname 1
; %2 = Gumpname 2
; #TRUE gump occured before timeout
sub GumpWait
namespace push
namespace local GW
wait 10
set !timedelay #SCNT
while #SCNT <= !timedelay + 7
{
if #CONTNAME = %1 || #CONTNAME = %2
{
namespace pop
return #TRUE
}
}
namespace pop
return #FALSE

sub rail
if %vesp = #true
{
repeat
event pathfind 2923 968
until #charposx = 2923 && #charposy = 968
repeat
event pathfind 2926 969
until #charposx = 2926 && #charposy = 969
repeat
event pathfind 2925 974
until #charposx = 2925 && #charposy = 974
return
}
repeat
event pathfind 1419 1597
until #charposx = 1419 && #charposy = 1597
if %donateingots = #true
{
repeat
event pathfind 1410 1599
until #charposx = 1410 && #charposy = 1599
repeat
event pathfind 1411 1602
until #charposx = 1411 && #charposy = 1602
repeat
event pathfind 1415 1604
until #charposx = 1415 && #charposy = 1604
return
}
repeat
event pathfind 1416 1594
until #charposx = 1416 && #charposy = 1594
repeat
event pathfind 1411 1592
until #charposx = 1411 && #charposy = 1592
repeat
event pathfind 1414 1589
until #charposx = 1414 && #charposy = 1589
if %containerprop = trades
return
repeat
event pathfind 1409 1589
until #charposx = 1409 && #charposy = 1589
repeat
event pathfind 1409 1593
until #charposx = 1409 && #charposy = 1593
repeat
event pathfind 1413 1594
until #charposx = 1413 && #charposy = 1594
if %containerprop = animal
return
repeat
event pathfind 1413 1605
until #charposx = 1413 && #charposy = 1605
repeat
event pathfind 1411 1607
until #charposx = 1411 && #charposy = 1607
return

You might also like