Hm, hey again all. Trying to finish last minute stuff in this script and I'm running into a weird problem intermittently. Basically this section of my code has a Journal Scan that's supposed to acquire the target's destination. The problem is though, sometime's the escorts response is completely missed, and the destination isn't set. I have it scanning for a full second after the speech command (have tried 1.5 seconds too...) is given and it's not missed all the time, just some of it, causing the script to hang up.
There is no other spam most of the time causing it to be not in Jindex or Jindex + 1 either... this is why it's got me baffled.
Am I doing something wrong, anyone have any ideas? (This particular part takes place in sub get Escort, AFTER stealing their gold. It seems to work fine before stealing their gold. So, after returning from sub stealGold and trying to get the destination is where the problem arises.)
Thanks guys. The script:
set #lpc 50
ignoreitem #charid
set %bankerID LSAO
set %loopScript #true
if #charname = [removed for security]
{
set %rbDepot YMIMJOD
set %rbDestination1 VOJMJOD
set %rbDestination2 NJKMJOD
set %rbMisc XMJMJOD
set %baseLocation escortDepot1
}
if #charname = [removed for security]
{
set %rbDepot KTJMJOD
set %rbDestination1 FXJMJOD
set %rbDestination2 DWJMJOD
set %rbMisc DEJMJOD
set %baseLocation escortDepot5
}
if #charname = [removed for security]
{
set %rbDepot OXHMJOD
set %rbDestination1 VRJMJOD
set %rbDestination2 FVIMJOD
set %rbMisc BFKMJOD
set %baseLocation escortDepot9
}
if #charname = [removed for security]
{
set %rbDepot TLIMJOD
set %rbDestination1 MYIMJOD
set %rbDestination2 ZKJMJOD
set %rbMisc DAJMJOD
set %baseLocation escortDepot13
}
while %loopScript = #true
{
gosub weightCheck
gosub recallAround
gosub getEscort
}
sub alertCheck
{
set %wrongText #false
set %wrongTextException #false
set %textFlag none
set %jStart #jindex + 5
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if you_see:_admin in #journal || you_see:_counselor in #journal || you_see:_game in #journal || you_see:_gm in #journal || you_see:_staff in #journal
set %wrongTextException #true
if %wrongTextException = #false && ( ,_ , #charname , ! in #journal || #charname , :_ in #journal || afrodite in #journal || botan in #journal || bottle in #journal || can_page_for_vendor in #journal || [removed for security]:_guards in #journal || [removed for security]:_kal in #journal || [removed for security]:_vas in #journal || guildmaster in #journal || i_seem_to_have_lost_my_master in #journal || [removed for security]:_guards in #journal || [removed for security]:_kal in #journal || [removed for security]:_vas in #journal || samantha in #journal || samirah in #journal || samson in #journal || samuel in #journal || spell_fizzles in #journal || staff_message_from_gm in #journal || steal in #journal || you_see: in #journal )
set %wrongText #true
if %wrongText = #false && ( #charname in #journal || admin in #journal || afk in #journal || answer in #journal || bot in #journal || counselor in #journal || [removed for security] in #journal || game in #journal || gm in #journal || greetings in #journal || hello in #journal || hey in #journal || master in #journal || page in #journal || [removed for security] in #journal || respond in #journal || script in #journal || speak in #journal || talk in #journal )
{
if #charname in #journal
set %textFlag #charname
if admin in #journal
set %textFlag admin
if afk in #journal
set %textFlag afk
if answer in #journal
set %textFlag answer
if bot in #journal
set %textFlag bot
if counselor in #journal
set %textFlag counselor
if [removed for security] in #journal
set %textFlag fro
if game in #journal
set %textFlag game
if gm in #journal
set %textFlag gm
if greetings in #journal
set %textFlag greetings
if hello in #journal
set %textFlag hello
if hey in #journal
set %textFlag hey
if master in #journal
set %textFlag master
if page in journal
set %textFlag page
if [removed for security] in #journal
set %textFlag pip
if respond in #journal
set %textFlag respond
if script in #journal
set %textFlag script
if speak in #journal
set %textFlag speak
if talk in #journal
set %textFlag talk
wait 40
[removed for security]
event macro 13 21
display ok Alert: #charname being watched! Flag: %textFlag - Script halted!$
halt
}
}
if is_attacking_you in #journal
{
wait 20
event macro 1 0 [removed for security]
wait 20
event macro 13 21
display ok Alert: #charname being attacked! Script halted!$
halt
}
if more_reagents_are_needed_for_this_spell in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname is out of reagents! Script halted!$
halt
}
if i_see_you_already_have_an_escort in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname has an escort stuck! Script halted!$
halt
}
if world_will_save in #journal
{
wait 20
event macro 13 21
event exmsg #charid 0 175 World saving; pausing script for 1 minute.
wait 1200
}
}
if #charghost = yes
{
display ok Alert: #charname died! Script halted!$
halt
}
return
}
sub weightCheck
{
if #gold > 4500 || #weight > 250
{
gosub alertCheck
gosub useRunebook recall 1 %rbMisc
gosub alertCheck
exevent popup %bankerID 2
wait 20
set %bankID #contid
finditem POF C_ , #backpackid
gosub alertCheck
exevent drag #findid #findstack
gosub alertCheck
exevent dropc %bankID
return
}
if #charghost = no && #gold <= 4500 && #weight <= 250
return
}
sub recallAround
{
gosub alertCheck
if %baseLocation = escortDepot1
gosub useRunebook recall 1 %rbDepot
if %baseLocation = escortDepot2
gosub useRunebook recall 2 %rbDepot
if %baseLocation = escortDepot3
gosub useRunebook recall 3 %rbDepot
if %baseLocation = escortDepot4
gosub useRunebook recall 4 %rbDepot
if %baseLocation = escortDepot5
gosub useRunebook recall 5 %rbDepot
if %baseLocation = escortDepot6
gosub useRunebook recall 6 %rbDepot
if %baseLocation = escortDepot7
gosub useRunebook recall 7 %rbDepot
if %baseLocation = escortDepot8
gosub useRunebook recall 8 %rbDepot
if %baseLocation = escortDepot9
gosub useRunebook recall 9 %rbDepot
if %baseLocation = escortDepot10
gosub useRunebook recall 10 %rbDepot
if %baseLocation = escortDepot11
gosub useRunebook recall 11 %rbDepot
if %baseLocation = escortDepot12
gosub useRunebook recall 12 %rbDepot
if %baseLocation = escortDepot13
gosub useRunebook recall 13 %rbDepot
if %baseLocation = escortDepot14
gosub useRunebook recall 14 %rbDepot
if %baseLocation = escortDepot15
useRunebook recall 15 %rbDepot
if %baseLocation = escortDepot16
gosub useRunebook recall 16 %rbDepot
return
}
sub getEscort
{
set %destination none
set %escortFound #false
set %followers none
set %markFound #false
set %nearnpcID none
set %npcID none
set %npcPosX none
set %npcPosY none
set %redestAttempt #false
finditem HS_IS G_4
if #findcnt > 0
{
set %markFound #true
set %npcID #findid
finditem %npcID G_6
set %npcPosX #findx
set %npcPosY #findy
gosub alertCheck
set %jStart #jindex + 1
event pathfind %npcPosX %npcPosY
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if can't_get_there in #journal
{
set %markFound #false
set %jTimeout #scnt2
}
}
}
}
if %markFound = #true
{
gosub alertCheck
set %jStart #jindex + 1
event macro 1 0 destination
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if i_am_looking_to_go_to_britain in #journal || i_am_looking_to_go_to_cove in #journal || i_am_looking_to_go_to_covetous in #journal || i_am_looking_to_go_to_deceit in #journal || i_am_looking_to_go_to_despise in #journal || i_am_looking_to_go_to_destard in #journal || i_am_looking_to_go_to_hythloth in #journal || i_am_looking_to_go_to_jhelom in #journal || i_am_looking_to_go_to_magincia in #journal || i_am_looking_to_go_to_minoc in #journal || i_am_looking_to_go_to_moonglow in #journal || i_am_looking_to_go_to_nujel in #journal || i_am_looking_to_go_to_ocllo in #journal || i_am_looking_to_go_to_serpent in #journal || i_am_looking_to_go_to_shame in #journal || i_am_looking_to_go_to_skara in #journal || i_am_looking_to_go_to_trinsic in #journal || i_am_looking_to_go_to_vesper in #journal || i_am_looking_to_go_to_wrong in #journal || i_am_looking_to_go_to_yew in #journal
{
set %escortFound #true
set %jTimeout #scnt2
}
}
}
if %escortFound = #false
ignoreitem %npcID
if %escortFound = #true
{
finditem %npcID G_6
if #findx <> %npcPosX || #findy <> %npcPosY
{
finditem %npcID G_6
set %npcPosX #findx
set %npcPosY #findy
gosub alertCheck
event pathfind %npcPosX %npcPosY
}
gosub alertCheck
set %followers #followers
event macro 1 0 i will take thee
gosub stealGold %npcID
redestAttempt:
gosub alertCheck
set %jStart #jindex + 1
event macro 1 0 destination
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if britain in #journal
{
set %destination britain
set %jTimeout #scnt2
}
if cove in #journal
{
set %destination cove
set %jTimeout #scnt2
}
if covetous in #journal
{
set %destination covetous
set %jTimeout #scnt2
}
if deceit in #journal
{
set %destination deceit
set %jTimeout #scnt2
}
if despise in #journal
{
set %destination despise
set %jTimeout #scnt2
}
if destard in #journal
{
set %destination destard
set %jTimeout #scnt2
}
if hythloth in #journal
{
set %destination hythloth
set %jTimeout #scnt2
}
if jhelom in #journal
{
set %destination jhelom
set %jTimeout #scnt2
}
if magincia in #journal
{
set %destination magincia
set %jTimeout #scnt2
}
if minoc in #journal
{
set %destination minoc
set %jTimeout #scnt2
}
if moonglow in #journal
{
set %destination moonglow
set %jTimeout #scnt2
}
if nujel in #journal
{
set %destination nujel
set %jTimeout #scnt2
}
if ocllo in #journal
{
set %destination ocllo
set %jTimeout #scnt2
}
if serpent in #journal
{
set %destination serpent
set %jTimeout #scnt2
}
if shame in #journal
{
set %destination shame
set %jTimeout #scnt2
}
if skara in #journal
{
set %destination skara
set %jTimeout #scnt2
}
if trinsic in #journal
{
set %destination trinsic
set %jTimeout #scnt2
}
if vesper in #journal
{
set %destination vesper
set %jTimeout #scnt2
}
if wrong in #journal
{
set %destination wrong
set %jTimeout #scnt2
}
if yew in #journal
{
set %destination yew
set %jTimeout #scnt2
}
}
}
gosub alertCheck
if %destination = none && %redestAttempt = #false
{
set %redestAttempt #true
goto redestAttempt
}
if %redestAttempt = #true
{
wait 20
event macro 13 21
display ok Alert: #charname did not receive a destination from their escort after 2 attempts! Script halted!$
halt
}
if %destination = britain
gosub useRunebook gate 1 %rbDestination1
if %destination = cove
gosub useRunebook gate 2 %rbDestination1
if %destination = covetous
gosub useRunebook gate 3 %rbDestination1
if %destination = deceit
gosub useRunebook gate 4 %rbDestination1
if %destination = despise
gosub useRunebook gate 5 %rbDestination1
if %destination = destard
gosub useRunebook gate 6 %rbDestination1
if %destination = hythloth
gosub useRunebook gate 7 %rbDestination1
if %destination = jhelom
gosub useRunebook gate 8 %rbDestination1
if %destination = magincia
gosub useRunebook gate 9 %rbDestination1
if %destination = minoc
gosub useRunebook gate 10 %rbDestination1
if %destination = moonglow
gosub useRunebook gate 11 %rbDestination1
if %destination = nujel
gosub useRunebook gate 12 %rbDestination1
if %destination = ocllo
gosub useRunebook gate 13 %rbDestination1
if %destination = serpent
gosub useRunebook gate 14 %rbDestination1
if %destination = shame
gosub useRunebook gate 15 %rbDestination1
if %destination = skara
gosub useRunebook gate 16 %rbDestination1
if %destination = trinsic
gosub useRunebook gate 1 %rbDestination2
if %destination = vesper
gosub useRunebook gate 2 %rbDestination2
if %destination = wrong
gosub useRunebook gate 3 %rbDestination2
if %destination = yew
gosub useRunebook gate 4 %rbDestination2
}
}
if %markFound = #false
{
if %baseLocation = escortDepot1
{
set %baseLocation escortDepot2
return %baseLocation
}
if %baseLocation = escortDepot2
{
set %baseLocation escortDepot3
return %baseLocation
}
if %baseLocation = escortDepot3
{
set %baseLocation escortDepot4
return %baseLocation
}
if %baseLocation = escortDepot4
{
set %baseLocation escortDepot5
return %baseLocation
}
if %baseLocation = escortDepot5
{
set %baseLocation escortDepot6
return %baseLocation
}
if %baseLocation = escortDepot6
{
set %baseLocation escortDepot7
return %baseLocation
}
if %baseLocation = escortDepot7
{
set %baseLocation escortDepot8
return %baseLocation
}
if %baseLocation = escortDepot8
{
set %baseLocation escortDepot9
return %baseLocation
}
if %baseLocation = escortDepot9
{
set %baseLocation escortDepot10
return %baseLocation
}
if %baseLocation = escortDepot10
{
set %baseLocation escortDepot11
return %baseLocation
}
if %baseLocation = escortDepot11
{
set %baseLocation escortDepot12
return %baseLocation
}
if %baseLocation = escortDepot12
{
set %baseLocation escortDepot13
return %baseLocation
}
if %baseLocation = escortDepot13
{
set %baseLocation escortDepot14
return %baseLocation
}
if %baseLocation = escortDepot14
{
set %baseLocation escortDepot15
return %baseLocation
}
if %baseLocation = escortDepot15
{
set %baseLocation escortDepot16
return %baseLocation
}
if %baseLocation = escortDepot16
{
set %baseLocation escortDepot1
return %baseLocation
}
}
set %markFound none
return
}
sub stealGold
{
gosub alertCheck
gosub useRunebook stealgold 2 %rbMisc
wait 20
set #lobjectid %npcID
gosub alertCheck
event macro 17
wait 20
finditem ZJF CA_ , #contid
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 20
finditem POF C_ , #contid
set #ltargetid #findid
set #ltargetkind 1
gosub alertCheck
event macro 13 33
target 5s
event macro 22
set %waitTimer #scnt2 + 100
while #scnt2 < %waitTimer
gosub alertCheck
finditem POF C_ , #contid
set #ltargetid #findid
set #ltargetkind 1
gosub alertCheck
event macro 13 33
target 5s
event macro 22
set %waitTimer #scnt2 + 100
while #scnt2 < %waitTimer
gosub alertCheck
event macro 13 21
set %waitTimer #scnt2 + 1200
while #scnt2 < %waitTimer
gosub alertCheck
return
}
sub useRunebook
{
set %rbAction %1
set %rbRune %2 - 1
set %rb %3
set %reTravel #false
reTravel:
if %reTravel = #true
{
set %reTravel #false
wait 40
}
finditem %rb C_ , #backpackid
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 20
set %rbPage ( %rbRune / 2 ) + 1
if %rbPage < 5
set %rbPage %rbPage - 1
set %rbX #contposx + 140 + ( 35 * %rbPage )
set %rbY #contposy + 200
gosub alertCheck
click %rbX %rbY dmc
gosub alertCheck
if %rbAction = recall
{
set %rbX #contposx + 150 + ( 160 * ( %rbRune % 2 ) )
set %rbY #contposy + 175
set %jStart #jindex + 1
click %rbX %rbY dmc
set %jTimeout #scnt2 + 30
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if spell_fizzles in #journal
{
set %reTravel #true
goto reTravel
}
}
}
}
if %rbAction = gate
{
set %confX none
set %confY none
set %rbX #contposx + 225 + ( 160 * ( %rbRune % 2 ) )
set %rbY #contposy + 175
set %jStart #jindex + 1
click %rbX %rbY dmc
set %jTimeout #scnt2 + 30
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if spell_fizzles in #journal || that_location_is_blocked in #journal
{
set %reTravel #true
goto reTravel
}
}
}
finditem OTF G_1
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 40
set %confX #contposx + 35
set %confY #contposy + 150
gosub alertCheck
click %confX %confY dmc
wait 20
finditem OTF G_1
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 40
set %confX #contposx + 35
set %confY #contposy + 150
gosub alertCheck
click %confX %confY dmc
wait 20
gosub weightCheck
gosub alertCheck
event macro 13 21
set %waitTimer #scnt2 + 1000
while #scnt2 < %waitTimer
gosub alertCheck
}
if %rbAction = stealgold
{
set %confX none
set %confY none
set %rbX #contposx + 225 + ( 160 * ( %rbRune % 2 ) )
set %rbY #contposy + 175
gosub alertCheck
set %jStart #jindex + 1
click %rbX %rbY dmc
set %jTimeout #scnt2 + 30
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if that_location_is_blocked in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname has an escort or obstruction blocking their steal spot! Script halted!$
halt
}
if spell_fizzles in #journal
{
set %reTravel #true
goto reTravel
}
}
}
finditem OTF G_1
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 40
set %confX #contposx + 35
set %confY #contposy + 150
gosub alertCheck
click %confX %confY dmc
}
return
}