Author Topic: Very Rare but random crashes  (Read 5678 times)

0 Members and 1 Guest are viewing this topic.

Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Very Rare but random crashes
« on: April 03, 2016, 04:23:13 PM »
0
I finished my script its kinda ugly the travel subs are sad but i dont know how to use the better ones yet so theyll have to do. anyway my problem is that the client will randomly crash. its only happened twice so far once when dropping the maps in the trash can and once when recalling back to  the room

Code: [Select]
;=============================================================================
;-- Script Name:Dark Guardian Farm
;-- Author: Tana
;-- Version: 1.0
;-- Client Tested with: 7.0.49.2
;-- EUO version tested with: 1.5.1.297
;-- Shard OSI
;-- Revision Date:4/3/16
;-- Public Release:
;-- Purpose: Faming TMAPS for clean up points
;-- Copyright: 2016
;=============================================================================
;--------------------Purpose--------------------------------------------------
;Kills Dark Guardians in Doom and loots the TMaps to throw away for Clean Up
;points
;=============================================================================
;-------------------Instructions----------------------------------------------
;WARNING this script does not check for Broken Gear
;This script requires that you have less then 13 items in your pack including
;your lootbag and Bag of Sending if your using it
;This Script assumes your a Sampire Using a double axe or other weapon with
;secondary ability being Whirlwind Attack
;Start script near your trash can
;Mark your trash can rune within 2 tiles of your trash can
;Mark your rune to the room outside of the dark guardian room at least 5 tiles
;west of the door
;If your using followers make sure they can survive in the rooom i use a swampy
;=============================================================================
;----------------Coming Soon--------------------------------------------------
;Better Travel Subs once I figure out how they work
;Better movement once I figure out a cleaner way for doing it Rails maybe?
;TM CLAw support once I figure out how to use it lol
;=============================================================================
;Special Thanks to The Ghost for dealing with my scripting questions
;Special Thanks to DXrom I borrowed a bit of his LAME script to set WW
;Special Thanks to TM for his BOS sub
;Special Thanks to the SUO community for being the great people that you are
;=============================================================================

;=============================================================================
;-------------Variables-------------------------------------------------------
;------------DO NOT EDIT------------------------------------------------------
;=============================================================================
;
SET %creature WD ;Dark Guardian
SET %loot XVH   ;TMAPS
SET %trashcan CBQPOQD ;trashcan
SET %backpack #backpackid
SET %CORPSE YFM
set %safety 4 ;DO NOT EDIT
set %spellTimer #scnt2 ;DO NOT EDIT
set %attacking #false
set %looting #false
set %noloot #true
SET %setup #true

;=============================================================================
;-----------------MAINLOOP----------------------------------------------------
;=============================================================================

main:
 if #charghost = yes
  {
  halt
  }
 if %setup = #true
  {
gosub FirstSetup
}
gosub weightcheck
gosub attack
goto main

;=============================================================================
;-----------------MAINSUBS----------------------------------------------------
;=============================================================================

;-----------------------------------------------------------------------------
sub weightcheck
if %useBOS = #true
  {
   GOSUB BOS
  }
finditem * c_ , %mapbag
IF #findcnt > 110
   {
   gosub gohome
   }
   return
;-----------------------------------------------------------------------------


sub attack
FINDITEM %creature G_6
  if ( #findkind = -1 )
   {
   gosub loot
   }
  if ( #findkind = -1 ) && ( %noloot = #TRUE )
   {
   event pathfind 362 15
   wait 20
event pathfind 365 15
wait 20
   }
  if #findkind <> -1
   {
attackloop:
set %attacking #TRUE
  if #findcnt > 0 && ( %spellTimer < #scnt2 )
gosub execSec
if #FINDKIND = -1 4
finditem %creature
set %attack #findid
set #LTARGETID %attack
event macro 27 0
if #findid <> %attack
  {
set %attack #findid
set #LTARGETID %attack
event macro 27 0
goto attackloop
}
  }
  set %attacking #false
return
;-----------------------------------------------------------------------------

sub loot
;gosub get claw to start looting
;wait 90s for claw to finish and respawn time to pass
FINDITEM %CORPSE G_3
if ( #FINDKIND > -1 ) && ( %attacking = #false ) && ( %looting = #false )
   {
   set %noloot #false
   goto lootloop
   }
if #findkind = -1
   {
   set %noloot #true
   }

lootloop:
set %newcorpse #findID
set #LOBJECTID %newcorpse
if #CONTTYPE = %CORPSE
{
  set %opencorpse #CONTID
}
nextCPos 25 450
wait 20
EVENT MACRO 17
wait 20
FINDITEM %loot C_ , %opencorpse
if #findcnt > 0
 {
  set %looting #true
   exevent drag #findID
   wait 10
   EXEVENT DROPC %mapbag
   wait 10
 }
if #findcnt < 1
 {
 set %looting #false
 }
if %USEBOS = #true  ;<------Got stuck when looting after the BOS ran out of charges changed this to fix it
{
FINDITEM POF C_ , %opencorpse
if  #findcnt > 0
 {
   exevent drag #findID #findstack
   wait 10
   EXEVENT DROPC #BACKPACKID
   wait 10
 }
}
ignoreitem %newcorpse 1
return

;-----------------------------------------------------------------------------

sub dropoff
FINDITEM %loot C_ , %mapbag
if #FINDKIND > -1
{
goto droploop
}

droploop:
FINDITEM %loot C_ , %mapbag
set %trashmap #findid
EXEVENT DRAG %trashmap
wait 10
EXEVENT DROPC %trashcan
wait 10
ignoreitem %trashmap 2
if #findkind > -1
{
goto droploop
}
if #findkind = -1
{
gosub godemons
}
return
;-----------------------------------------------------------------------------

sub execSec
    cmppix 3 f
       {
       event macro 36 0
       wait 5
       }
return
;-----------------------------------------------------------------------------

SUB BOS
finditem %BOS C_ , #BACKPACKID
 if #FINDKIND <> -1
      {
          event property %BOS
          str pos #PROPERTY Charges:
          set #STRRES #STRRES + 9
          str mid #PROPERTY #STRRES 1
        if #STRRES = 0   ; as in zero charges
          {
           set %useBOS #false
           return
          }
         if ( #weight > #maxweight ) && ( %useBOS = #true )
           {
            wait 10
            set #LOBJECTID %BOS
            EVENT MACRO 17
            wait 10
            FINDITEM POF C_ , %backpack
            set %sendme #findid
            SET #LTARGETID %sendme
            EVENT MACRO 22
            wait 10
           }
      }
  if #FINDKIND = -1
   {
    SET %useBOS #false
   }
return
;-----------------------------------------------------------------------------

;=============================================================================
;--------------TRAVEL SUBS----------------------------------------------------
;=============================================================================


sub gohome
if %followers = #true
{
event macro 1 0 all , #spc , follow , #spc , me
}
  wait 20
EVENT pathfind 356 14
wait 40
EVENT MACRO 12 0
wait 40
EVENT pathfind 352 14
wait 20
SET #LTARGETID %homebook
EVENT MACRO 15 210
wait 60
EVENT MACRO 22 0
wait 5s
  set #LOBJECTID %mapbag
EVENT MACRO 17
  wait 20
gosub dropoff
return

;-----------------------------------------------------------------------------

sub godemons
SET #LTARGETID %doombook
EVENT MACRO 15 210
wait 60
EVENT MACRO 22 0
wait 5s
set #LOBJECTID %mapbag
EVENT MACRO 17
wait 60
if %followers = #true
   {
   EVENT MACRO 1 0 all , #spc , follow , #spc , me
   }
EVENT pathfind 355 15
wait 60
EVENT MACRO 12 0
wait 20
EVENT pathfind 356 15
if %followers = #true
{
EVENT MACRO 1 0 all , #SPC , follow , #SPC , me
wait 15s
  }
  WAIT 10
EVENT pathfind 356 11
wait 40
if %followers = #true
{
  EVENT MACRO 1 0 all , #SPC , follow , #SPC , me
  }
wait 40
if %followers = #true
{
EVENT MACRO 1 0 All , #SPC , Stay
  wair 5
  }
EVENT pathfind 365 15
  Return
;-----------------------------------------------------------------------------

;=============================================================================
;----------------SetUP Subs---------------------------------------------------
;=============================================================================


sub FirstSetup
display First we need to adjust the script for you.
wait 3
gosub opengumps
gosub setbos
gosub setmapbag
gosub settrash
gosub sethomebook
gosub setdoombook
gosub usefollowers
gosub setpixel-secondary
gosub traveltodoom
set %setup #false
return

sub setpixel-secondary
    event macro 36 0
    display Move the mouse to the BOTTOM LEFT CORNER of the secondary Weapon Move button. You have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 3
    wait 5
    event macro 36 0
    display Everything is set!
return

sub setbos
    display yesno Do you want to use a Bag of Sending?
    if #dispRes = yes
    {
    set %useBOS #true
    display Please select your Bag Of Sending
    set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %BOS #LTARGETID
    }
    if #dispRes = no
    {
    set %useBOS #false
    }
Return

sub setmapbag
     display Please Select Your Map Bag.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %mapbag #LTARGETID
     set #LOBJECTID %mapbag
     nextCpos 25 852
     event macro 17
return

sub settrash
     display Please Select Your Trash Can.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %trashcan #LTARGETID
return

sub sethomebook
     display Please Select Your runebook with your trash can rune set as default.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %homebook #LTARGETID
return

sub setdoombook
     display Please Select Your runebook with a rune outside of dark guardians room as default.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %doombook #LTARGETID
return

sub usefollowers
    display yesno Do you want to use followers to spawn more Guardians?
    if #dispRes = yes
    {
    set %followers #true
    }
    if  #dispRes = no
    {
    set %followers #false
    }
return

sub  traveltodoom
     display Please Travel to the Dark guarding room resume script once inside
     pause
     set #LOBJECTID %mapbag
     nextCpos 25 852
     event macro 17
return

sub opengumps
 EVENT MACRO 8 1
 wait 10
 EVENT MACRO 8 2
 wait 10
 EVENT MACRO 8 7
return

EDIT: Fixed part of the loot sub got stuck trying to loot gold when  %useBOS changed to FALSE
« Last Edit: April 04, 2016, 03:44:13 PM by Tana »

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Very Rare but random crashes
« Reply #1 on: April 04, 2016, 04:23:12 PM »
0
Just some idea for you.

I did some minor change. 
1) add my recall sub for you.
2) change your  dropoff  a bit.  that might help with the crash.   
3)  I change  the way to call your in just to show you another way.
PS:  you don't need to open your loot bag to put t-map inside, just when u empty it.

Code: [Select]
;
;=============================================================================
;-- Script Name:Dark Guardian Farm
;-- Author: Tana
;-- Version: 1.0
;-- Client Tested with: 7.0.49.2
;-- EUO version tested with: 1.5.1.297
;-- Shard OSI
;-- Revision Date:4/3/16
;-- Public Release:
;-- Purpose: Faming TMAPS for clean up points
;-- Copyright: 2016
;=============================================================================
;--------------------Purpose--------------------------------------------------
;Kills Dark Guardians in Doom and loots the TMaps to throw away for Clean Up
;points
;=============================================================================
;-------------------Instructions----------------------------------------------
;WARNING this script does not check for Broken Gear
;This script requires that you have less then 13 items in your pack including
;your lootbag and Bag of Sending if your using it
;This Script assumes your a Sampire Using a double axe or other weapon with
;secondary ability being Whirlwind Attack
;Start script near your trash can
;Mark your trash can rune within 2 tiles of your trash can
;Mark your rune to the room outside of the dark guardian room at least 5 tiles
;west of the door
;If your using followers make sure they can survive in the rooom i use a swampy
;=============================================================================
;----------------Coming Soon--------------------------------------------------
;Better Travel Subs once I figure out how they work
;Better movement once I figure out a cleaner way for doing it Rails maybe?
;TM CLAw support once I figure out how to use it lol
;=============================================================================
;Special Thanks to The Ghost for dealing with my scripting questions
;Special Thanks to DXrom I borrowed a bit of his LAME script to set WW
;Special Thanks to TM for his BOS sub
;Special Thanks to the SUO community for being the great people that you are
;=============================================================================

;=============================================================================
;-------------Variables-------------------------------------------------------
;------------DO NOT EDIT------------------------------------------------------
;=============================================================================
;
SET %creature WD ;Dark Guardian
SET %loot XVH   ;TMAPS
SET %trashcan CBQPOQD ;trashcan
; SET %backpack #backpackid    ; <   dont need that,  it will detect the right value
SET %CORPSE YFM
set %safety 4 ;DO NOT EDIT
set %spellTimer #scnt2 ;DO NOT EDIT
set %attacking #false
set %looting #false
set %noloot #true
SET %setup #true

;=============================================================================
;-----------------MAINLOOP----------------------------------------------------
;=============================================================================

repeat
{
 if #charghost = yes
    pause   ;   this way you dont have to set up again.
 if %setup = #true
gosub FirstSetup
gosub weightcheck
gosub attack
}
until #false

;=============================================================================
;-----------------MAINSUBS----------------------------------------------------
;=============================================================================

;-----------------------------------------------------------------------------
sub weightcheck
if %useBOS = #true
  {
   GOSUB BOS
  }
finditem * c_ , %mapbag
IF #findcnt > 110
   {
   gosub gohome
   }
 return
;-----------------------------------------------------------------------------


sub attack
FINDITEM %creature G_6
  if #findkind = -1
   {
   gosub loot
   }
  if ( #findkind = -1 ) && ( %noloot = #TRUE )
   {
   event pathfind 362 15
   wait 20
event pathfind 365 15
wait 20
   }
  if #findkind <> -1
   {
attackloop:
set %attacking #TRUE
  if #findcnt > 0 && ( %spellTimer < #scnt2 )
gosub execSec
if #FINDKIND = -1 4
finditem %creature
set %attack #findid
set #LTARGETID %attack
event macro 27 0
if #findid <> %attack
  {
set %attack #findid
set #LTARGETID %attack
event macro 27 0
goto attackloop
}
  }
  set %attacking #false
return
;-----------------------------------------------------------------------------

sub loot
;gosub get claw to start looting
;wait 90s for claw to finish and respawn time to pass
FINDITEM %CORPSE G_3
if ( #FINDKIND > -1 ) && ( %attacking = #false ) && ( %looting = #false )
   {
   set %noloot #false
   goto lootloop
   }
if #findkind = -1
   {
   set %noloot #true
   }

lootloop:
set %newcorpse #findID
set #LOBJECTID %newcorpse
if #CONTTYPE = %CORPSE
{
  set %opencorpse #CONTID
}
nextCPos 25 450
wait 20
EVENT MACRO 17
wait 20
FINDITEM %loot C_ , %opencorpse
if #findcnt > 0
 {
   set %looting #true
   exevent drag #findID
   wait 15
   exevent DROPC %mapbag
   wait 15    ;  I add a bit more time  for lag issue maybe.
 }
if #findcnt < 1
 {
 set %looting #false
 }
FINDITEM POF C_ , %opencorpse
if ( #findcnt > 0 ) && ( %USEBOS = #true )
 {
   exevent drag #findID #findstack
   wait 10
   EXEVENT DROPC #BACKPACKID
   wait 10
 }
ignoreitem %newcorpse 1
return

;-----------------------------------------------------------------------------

sub dropoff
  set #lobjectid %mapbag       ;  to ensure your loot bag is open after recall
  wait 10
  event macro 17
  wait 15
  contpos 830 65
REPEAT
    FINDITEM %loot C_ , %mapbag
    IF #FINDCNT > 0
    {
      EXEVENT DRAG #FINDID #FINDSTACK
      WAIT 10
      EXEVENT DROPC %trashcan
      WAIT 10
    }
UNTIL #FINDCNT = 0
return

;-----------------------------------------------------------------------------

sub execSec
    cmppix 3 f
       {
       event macro 36 0
       wait 10
       }
return
;-----------------------------------------------------------------------------

SUB BOS
finditem %BOS C_ , #BACKPACKID
 if #FINDKIND <> -1
      {
          event property %BOS
          str pos #PROPERTY Charges:
          set #STRRES #STRRES + 9
          str mid #PROPERTY #STRRES 1
        if #STRRES = 0   ; as in zero charges
          {
           set %useBOS #false
           return
          }
         if ( #weight > #maxweight ) && ( %useBOS = #true )
           {
            wait 10
            set #LOBJECTID %BOS
            EVENT MACRO 17
            wait 10
            FINDITEM POF C_ , #backpackid  ;   %backpack
            set %sendme #findid
            SET #LTARGETID %sendme
            EVENT MACRO 22
            wait 10
           }
      }
  if #FINDKIND = -1
   {
    SET %useBOS #false
   }
return
;-----------------------------------------------------------------------------

;=============================================================================
;--------------TRAVEL SUBS----------------------------------------------------
;=============================================================================


sub gohome
if %followers = #true
{
  msg $
  msg all come$
; event macro 1 0 all , #spc , follow , #spc , me
}
  wait 20
EVENT pathfind 356 14
wait 40
EVENT MACRO 12 0
wait 40
EVENT pathfind 352 14
wait 20
  gosub TG_recall %homebook
  gosub dropoff
gosub godemons
return

;-----------------------------------------------------------------------------

sub godemons
gosub TG_recall %doomboo
set #LOBJECTID %mapbag
EVENT MACRO 17
wait 60
if %followers = #true
   {
   EVENT MACRO 1 0 all , #spc , follow , #spc , me
   }
EVENT pathfind 355 15
wait 60
EVENT MACRO 12 0
wait 20
EVENT pathfind 356 15
if %followers = #true
{
EVENT MACRO 1 0 all , #SPC , follow , #SPC , me
wait 15s
  }
  WAIT 10
EVENT pathfind 356 11
wait 40
if %followers = #true
{
  EVENT MACRO 1 0 all , #SPC , follow , #SPC , me
  }
wait 40
if %followers = #true
{
EVENT MACRO 1 0 All , #SPC , Stay
  wait 10    ; <---   was wair   miss spell
  }
EVENT pathfind 365 15
  Return
;-----------------------------------------------------------------------------

;=============================================================================
;----------------SetUP Subs---------------------------------------------------
;=============================================================================


sub FirstSetup
display First we need to adjust the script for you.
wait 3
gosub opengumps
gosub setbos
gosub setmapbag
gosub settrash
gosub sethomebook
gosub setdoombook
gosub usefollowers
gosub setpixel-secondary
gosub traveltodoom
set %setup #false
return

sub setpixel-secondary
    event macro 36 0
    display Move the mouse to the BOTTOM LEFT CORNER of the secondary Weapon Move button. You have 2 seconds
    wait 2s
    savePix #CURSORX #CURSORY 3
    wait 5
    event macro 36 0
    display Everything is set!
return

sub setbos
    display yesno Do you want to use a Bag of Sending?
    if #dispRes = yes
    {
    set %useBOS #true
    display Please select your Bag Of Sending
    set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %BOS #LTARGETID
    }
    if #dispRes = no
    {
    set %useBOS #false
    }
Return

sub setmapbag
     display Please Select Your Map Bag.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %mapbag #LTARGETID
     set #LOBJECTID %mapbag
     nextCpos 25 852
     event macro 17
return

sub settrash
     display Please Select Your Trash Can.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %trashcan #LTARGETID
return

sub sethomebook
     display Please Select Your runebook with your trash can rune set as default.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %homebook #LTARGETID
return

sub setdoombook
     display Please Select Your runebook with a rune outside of dark guardians room as default.
     set #targCurs 1
     target
     repeat
     wait 1
     until #targCurs = 0
     set %doombook #LTARGETID
return

sub usefollowers
    display yesno Do you want to use followers to spawn more Guardians?
    if #dispRes = yes
    {
    set %followers #true
    }
    if  #dispRes = no
    {
    set %followers #false
    }
return

sub  traveltodoom
     display Please Travel to the Dark guarding room resume script once inside
     pause
     set #LOBJECTID %mapbag
     nextCpos 25 852
     event macro 17
return

sub opengumps
 EVENT MACRO 8 1
 wait 10
 EVENT MACRO 8 2
 wait 10
 EVENT MACRO 8 7
return

; ======================= RECALL======================
; goSub TG_recall (ItemID)
Sub TG_recall
; %1 Item to recall from
    finditem %1 C_ , %backpackid
    set #ltargetID %1
    set #ltargetkind 1
    wait 2s
    event macro 15 210 ;    210  or SJ 31  ; Recall Spell
    wait 1s
    target
    event macro 22 0  ; Last target
    wait 5s
Return
; ========================================



Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Re: Very Rare but random crashes
« Reply #2 on: April 04, 2016, 05:29:42 PM »
0
ive actually updated it since i posted this lol it includes TMs travel subs since i spent all day today learning how to use them im running debugs now ill post the revision when i complete it. also Thank you for help and the advice on the longer wait time.

PS i know i dont need to have it open to drop them inside but the way my weight check sub works

Code: [Select]
sub weightcheck
  if %useBOS = #true
  {
    GOSUB BOS
  }
  finditem * c_ , %mapbag
  IF #findcnt > 110
  {
    gosub gohome
  }
return

the Bag has to be open for it to find count. unless im wrong about that
« Last Edit: April 04, 2016, 05:35:24 PM by Tana »

Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Re: Very Rare but random crashes
« Reply #3 on: April 04, 2016, 05:46:52 PM »
0
What i have using TMs travel subs think there is a couple minor things that needed to be changed cause of how the %useBOS changed to #false it cause it to stay inside a corpse so i changed that way it started to look for gold. works fine now. think it still might have an issue but i was pausing the sub and clicking on things so it could have jsut been me making ignore ids not register or something

Code: [Select]
;=============================================================================
;-- Script Name:Dark Guardian Farm
;-- Author: Tana
;-- Version: 1.0
;-- Client Tested with: 7.0.49.2
;-- EUO version tested with: 1.5.1.297
;-- Shard OSI
;-- Revision Date:4/3/16
;-- Public Release:
;-- Purpose: Faming TMAPS for clean up points
;-- Copyright: 2016
;=============================================================================
;--------------------Purpose--------------------------------------------------
;Kills Dark Guardians in Doom and loots the TMaps to throw away for Clean Up
;points
;=============================================================================
;-------------------Instructions----------------------------------------------
;WARNING this script does not check for Broken Gear
;This script requires that you have less then 13 items in your pack including
;your lootbag and Bag of Sending if your using it
;This Script assumes your a Sampire Using a double axe or other weapon with
;secondary ability being Whirlwind Attack
;Start script near your trash can
;Mark your trash can rune within 2 tiles of your trash can
;Mark your rune to the room outside of the dark guardian room at least 5 tiles
;west of the door
;If your using followers make sure they can survive in the rooom i use a swampy
;=============================================================================
;----------------Coming Soon--------------------------------------------------
;Better Travel Subs once I figure out how they work
;Better movement once I figure out a cleaner way for doing it Rails maybe?
;TM CLAw support once I figure out how to use it lol
;=============================================================================
;Special Thanks to The Ghost for dealing with my scripting questions
;Special Thanks to DXrom I borrowed a bit of his LAME script to set WW
;Special Thanks to TM for his BOS SUB his Travel Subs and everything else he
;has done
;Special Thanks to the SUO community for being the great people that you are
;=============================================================================

;=============================================================================
;-------------Variables-------------------------------------------------------
;------------DO NOT EDIT------------------------------------------------------
;=============================================================================
;
SET %creature WD ;Dark Guardian
SET %loot XVH   ;TMAPS
SET %backpack #backpackid
SET %CORPSE YFM
set %safety 4 ;DO NOT EDIT
set %spellTimer #scnt2 ;DO NOT EDIT
set %attacking #false
set %looting #false
set %noloot #true
SET %setup #true

;=============================================================================
;-----------------MAINLOOP----------------------------------------------------
;=============================================================================

main:
if #charghost = yes
{
  pause
}
if %setup = #true
{
  gosub FirstSetup
}
gosub weightcheck
gosub attack
goto main

;=============================================================================
;-----------------MAINSUBS----------------------------------------------------
;=============================================================================

;-----------------------------------------------------------------------------
sub weightcheck
  if %useBOS = #true
  {
    GOSUB BOS
  }
  finditem * c_ , %mapbag
  IF #findcnt > 110
  {
    gosub gohome
  }
return
;-----------------------------------------------------------------------------


sub attack
  FINDITEM %creature G_6
  if ( #findkind = -1 )
  {
    gosub loot
  }
  if ( #findkind = -1 ) && ( %noloot = #TRUE )
  {
    event pathfind 362 15
    wait 20
    event pathfind 365 15
    wait 20
  }
  if #findkind <> -1
  {
attackloop:
    set %attacking #TRUE
    if #findcnt > 0 && ( %spellTimer < #scnt2 )
      gosub execSec
    if #FINDKIND = -1 4
      finditem %creature
    set %attack #findid
    set #LTARGETID %attack
    event macro 27 0
    if #findid <> %attack
    {
      set %attack #findid
      set #LTARGETID %attack
      event macro 27 0
      goto attackloop
    }
  }
  set %attacking #false
return
;-----------------------------------------------------------------------------

sub loot
  ;gosub get claw to start looting
  ;wait 90s for claw to finish and respawn time to pass
  FINDITEM %CORPSE G_2
  if ( #FINDKIND > -1 ) && ( %attacking = #false ) && ( %looting = #false )
  {
    set %noloot #false
    goto lootloop
  }
  if #findkind = -1
  {
    set %noloot #true
  }
 
lootloop:
  set %newcorpse #findID
  set #LOBJECTID %newcorpse
  if #CONTTYPE = %CORPSE
  {
    set %opencorpse #CONTID
  }
  nextCPos 25 450
  wait 20
  EVENT MACRO 17
  wait 20
  FINDITEM %loot C_ , %opencorpse
 if #findcnt > 0
  {
    set %looting #true
    exevent drag #findID
    wait 15
    EXEVENT DROPC %mapbag
    wait 15
  }
  if #findcnt < 1
  {
    set %looting #false
  }
 if %useBOS = #true
  {
  FINDITEM POF C_ , %opencorpse
   if #findcnt > 0
   {
    exevent drag #findID #findstack
    wait 10
    EXEVENT DROPC #BACKPACKID
    wait 10
   }
  }
  ignoreitem %newcorpse 1
return

;-----------------------------------------------------------------------------

sub dropoff
set #lobjectid %mapbag       ;  to ensure your loot bag is open after recall
  wait 10
  event macro 17
  wait 15
  contpos 830 65
  FINDITEM %loot C_ , %mapbag
  if #FINDKIND > -1
  {
    goto droploop
  }
 
droploop:
  FINDITEM %loot C_ , %mapbag
  set %trashmap #findid
  EXEVENT DRAG %trashmap
  wait 10
  EXEVENT DROPC %trashcan
  wait 10
  ignoreitem %trashmap 2
  if #findkind > -1
  {
    goto droploop
  }
  if #findkind = -1
  {
    gosub godemons
  }
return
;-----------------------------------------------------------------------------

sub execSec
  cmppix 3 f
  {
    event macro 36 0
    wait 5
  }
return
;-----------------------------------------------------------------------------

SUB BOS
  finditem %BOS C_ , #BACKPACKID
  if #FINDKIND <> -1
  {
    event property %BOS
    str pos #PROPERTY Charges:
    set #STRRES #STRRES + 9
    str mid #PROPERTY #STRRES 1
    if #STRRES = 0   ; as in zero charges
    {
      set %useBOS #false
      return
    }
    if ( #weight > #maxweight ) && ( %useBOS = #true )
    {
      wait 10
      set #LOBJECTID %BOS
      EVENT MACRO 17
      wait 10
      FINDITEM POF C_ , %backpack
      set %sendme #findid
      SET #LTARGETID %sendme
      EVENT MACRO 22
      wait 10
    }
  }
  if #FINDKIND = -1
  {
    SET %useBOS #false
  }
return
;-----------------------------------------------------------------------------

;=============================================================================
;--------------TRAVEL SUBS----------------------------------------------------
;=============================================================================


sub gohome
  if %followers = #true
  {
    event macro 1 0 all , #spc , follow , #spc , me
  }
  wait 20
  EVENT pathfind 356 14
  wait 40
  EVENT MACRO 12 0
  wait 40
  EVENT pathfind 352 14
  wait 20
  ;
  gosub TM_TravelFromobject SJ %homebook
 ;SET #LTARGETID %homebook
 ; EVENT MACRO 15 210
 ; wait 60
 ; EVENT MACRO 22 0
 ; wait 5s
 ;
  gosub dropoff
  gosub godemons
return

;-----------------------------------------------------------------------------

sub godemons
gosub TM_TravelFromObject SJ %doombook
 ; SET #LTARGETID %doombook
 ; EVENT MACRO 15 210
 ; wait 60
 ; EVENT MACRO 22 0
  set #LOBJECTID %mapbag
  EVENT MACRO 17
  wait 60
  if %followers = #true
  {
    EVENT MACRO 1 0 all , #spc , follow , #spc , me
  }
  EVENT pathfind 355 15
  wait 60
  EVENT MACRO 12 0
  wait 20
  EVENT pathfind 356 15
  if %followers = #true
  {
    EVENT MACRO 1 0 all , #SPC , follow , #SPC , me
    wait 15s
  }
  WAIT 10
  EVENT pathfind 356 11
  wait 40
  if %followers = #true
  {
    EVENT MACRO 1 0 all , #SPC , follow , #SPC , me
  }
  wait 40
  if %followers = #true
  {
    EVENT MACRO 1 0 All , #SPC , Stay
    wait 10
  }
  EVENT pathfind 365 15
Return
;-----------------------------------------------------------------------------

;=============================================================================
;----------------SetUP Subs---------------------------------------------------
;=============================================================================


sub FirstSetup
  display First we need to adjust the script for you.
  wait 3
  gosub TM_AddUnderscore #CHARNAME
  set %charname #RESULT
  gosub opengumps
  gosub setbos
  gosub setmapbag
  gosub settrash
  gosub sethomebook
  gosub setdoombook
  gosub usefollowers
  gosub setpixel-secondary
  gosub traveltodoom
  set %setup #false
return

sub setpixel-secondary
  event macro 36 0
  display Move the mouse to the BOTTOM LEFT CORNER of the secondary Weapon Move button. You have 2 seconds
  wait 2s
  savePix #CURSORX #CURSORY 3
  wait 5
  event macro 36 0
  display Everything is set!
return

sub setbos
  display yesno Do you want to use a Bag of Sending?
  if #dispRes = yes
  {
    set %useBOS #true
    display Please select your Bag Of Sending
    set #targCurs 1
    target
    repeat
      wait 1
    until #targCurs = 0
    set %BOS #LTARGETID
  }
  if #dispRes = no
  {
    set %useBOS #false
  }
Return

sub setmapbag
  display Please Select Your Map Bag.
  set #targCurs 1
  target
  repeat
    wait 1
  until #targCurs = 0
  set %mapbag #LTARGETID
  set #LOBJECTID %mapbag
  nextCpos 25 852
  event macro 17
return

sub settrash
  display Please Select Your Trash Can.
  set #targCurs 1
  target
  repeat
    wait 1
  until #targCurs = 0
  set %trashcan #LTARGETID
return

sub sethomebook
  display Please Select Your runebook with your trash can rune set as default.
  set #targCurs 1
  target
  repeat
    wait 1
  until #targCurs = 0
  set %homebook #LTARGETID
return

sub setdoombook
  display Please Select Your runebook with a rune outside of dark guardians room as default.
  set #targCurs 1
  target
  repeat
    wait 1
  until #targCurs = 0
  set %doombook #LTARGETID
return

sub usefollowers
  display yesno Do you want to use followers to spawn more Guardians?
  if #dispRes = yes
  {
    set %followers #true
  }
  if  #dispRes = no
  {
    set %followers #false
  }
return

sub  traveltodoom
  display Please Travel to the Dark guarding room resume script once inside
  pause
  set #LOBJECTID %mapbag
  nextCpos 25 852
  event macro 17
return

sub opengumps
  EVENT MACRO 8 1
  wait 10
  EVENT MACRO 8 2
  wait 10
  EVENT MACRO 8 7
return

;=================================================================
; 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_AdvJournalSync SPELLCAST
      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_AdvJournalScan SPELLCAST VALID 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_AdvJournalScan SPELLCAST VALID 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_AdvJournalSync SPELLCAST
          set !clickx #CONTPOSX + 26
          set !clicky #CONTPOSY + 261
          click !clickx !clicky ; click ok
        }
      }
    }

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

    set !tempscnt #SCNT + 10
  WaitforTravel_loop1:
    gosub TM_AdvJournalScan SPELLCAST VALID location_is_blocked something_is_blocking you_spirit_lacks
    if #RESULT = #TRUE
    {
      gosub TM_AdvJournalSync SPELLCAST
      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_AdvJournalSync SPELLCAST
          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_AdvJournalScan SPELLCAST VALID location_is_blocked something_is_blocking your_spirit_lacks
    if #RESULT = #TRUE
    {
      gosub TM_AdvJournalSync SPELLCAST
      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
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - #LPC setting (optional)
; Brings !_jindex up to the most recent #journal entry
sub TM_AdvJournalSync
  namespace push
  namespace local TM_AdvJS_ , %1
  set !_jindex #jindex + 1
  if %0 > 1
    set !lpc_set %2
  namespace pop
  set !TM_FunctionCalled #TRUE
return
;-------------------------------------------------------------------------------
; %1 - Journal Name
; %2 - NONE, ADVANCE , ( _VALID ) - advances jindex pointer, anything else
; %3, %4, %5, 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
;  About %2 arguments:
;    NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
;    ADVANCE: no spam checking, advances #jindex copy
;    VALID: invokes SPAM filtering, no advance of #jindex copy
;    VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy
sub TM_AdvJournalScan
  namespace push
  namespace local TM_AdvJS_ , %1
  set !args %2
  set !temp_lpc #LPC
  if !lpc_set = N/A
    set #LPC 1000
  else
    set #LPC !lpc_set
  set !num_args %0
  set !first_arg 3
  if !_jindex = N/A
    set !_jindex #jindex
  if !charname = N/A
  {
    set !charname #CHARNAME
    AdvJournalScan_loop1:
      str pos !charname #SPC
      if #STRRES <> 0
      {
        set !val #STRRES - 1
        str left !charname !val
        set !left #STRRES
        set !val !val + 1
        str del !charname 1 !val
        set !charname !left , _ , #STRRES
        goto AdvJournalScan_loop1
      }
  }
  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 || VALID notin !args
        set !pass #TRUE
      else
        set !pass #FALSE
      if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
      {
        set !temp_jindex !temp_jindex + 1
        if ADVANCE in !args
          set !_jindex !temp_jindex
        set #LPC !temp_lpc
        namespace pop
        set !TM_FunctionCalled #TRUE
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until !index - !first_arg > !num_args - !first_arg
  set #LPC !temp_lpc
  namespace pop
  set !TM_FunctionCalled #TRUE
return #FALSE
;-------------------------------------------------------------------------------
; %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




Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Re: Very Rare but random crashes
« Reply #4 on: April 05, 2016, 03:55:09 PM »
0
UPDATE: been running it all day no crashes.. no %useBOS changing to #false errors it works!!! ill run it for another day then post er in the submit your script :)

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Very Rare but random crashes
« Reply #5 on: April 05, 2016, 04:57:26 PM »
0
Nice work.

Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Re: Very Rare but random crashes
« Reply #6 on: April 06, 2016, 01:32:00 AM »
0
well ghost i tried to rewrite my loot sub to look a little more like the drop off sub you wrote me and i think ive done it way wrong...here it is.
PS this is me just tryng to make the script better my current version is still stable :)

Code: [Select]
sub loot
 lootloop:
  FINDITEM %CORPSE G_2
  if #findkind =  -1
   {
    set %noloot #true
    return
   }
  if ( #FINDKIND > -1 ) && ( %attacking = #false ) && ( %looting = #false )
   {
    set %noloot #false
    set %newcorpse #findID
    set #LOBJECTID %newcorpse
    if #CONTTYPE = %CORPSE
     {
      set %opencorpse #CONTID
     }
    nextCPos 25 450
    wait 20
    EVENT MACRO 17
    wait 20
   Repeat
    FINDITEM %loot C_ , %opencorpse
    if #findcnt > 0
     {
      set %looting #true
      exevent drag #findID
      wait 15
      EXEVENT DROPC %mapbag
      wait 15
     }
    Until #findcnt = 0
    if #findcnt < 1
     {
      set %looting #false
     }
    IF %useBOS = #true
     {
     Repeat
      FINDITEM POF C_ , %opencorpse
       if #findcnt > 0
        {
         exevent drag #findID #findstack
         wait 15
         EXEVENT DROPC #BACKPACKID
         wait 15
        }
      Until #findcnt = 0
    ignoreitem %newcorpse 1
    goto lootloop
   }

return

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Very Rare but random crashes
« Reply #7 on: April 06, 2016, 03:33:49 AM »
0
I had play around but nerver finished it.   I that TM have a big looting script, that do all of above.

Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Re: Very Rare but random crashes
« Reply #8 on: April 06, 2016, 10:40:18 AM »
0
the only part of the script that doesnt seem to work for me is putting repeats idk why. heres what i have that is stable. i was trying to throw in repeats so it doesnt even leave the loot sub till after everything is looted but when i throw in my repeats it gets stuck on like the same body or it sets my %noloot to true (has to be false otherwise my attack sub will start pathfinding) and ill walk away from the corpse ignoring it instead of looting it. i know TMs CLAw is amazing but im trying to make this thing completly afkable and if i set claw to autoloot it tends to cause UO to crash

Code: [Select]
sub loot
  FINDITEM %CORPSE G_2
  if ( #FINDKIND > -1 ) && ( %attacking = #false ) && ( %looting = #false )
   {
    set %noloot #false
   }
  if #findkind = -1
   {
    set %noloot #true
   }
  set %newcorpse #findID
  set #LOBJECTID %newcorpse
  if #CONTTYPE = %CORPSE
  {
    set %opencorpse #CONTID
  }
  nextCPos 25 450
  wait 20
  EVENT MACRO 17
  wait 20
  FINDITEM %loot C_ , %opencorpse
  if #findcnt > 0
  {
    set %looting #true
    exevent drag #findID
    wait 15
    EXEVENT DROPC %mapbag
    wait 15
  }
  if #findcnt < 1
  {
    set %looting #false
  }
  IF %useBOS = #true
  {
    FINDITEM POF C_ , %opencorpse
    if #findcnt > 0
    {
      exevent drag #findID #findstack
      wait 15
      EXEVENT DROPC #BACKPACKID
      wait 15
    }
  }
  ignoreitem %newcorpse 1
return


Offline TanaTopic starter

  • Jr. Member
  • **
  • Posts: 67
  • Activity:
    0%
  • Reputation Power: 1
  • Tana has no influence.
  • Respect: +6
  • Referrals: 1
    • View Profile
Re: Very Rare but random crashes
« Reply #9 on: April 15, 2016, 03:00:17 PM »
0
ok ghost heres the most recent version of this tmap farming script i think ive narrowed down the crashes they only happen when im returning from TMs travel sub ive indicated in the script where i think its messing up


PS
I was wondering your opinion on event pathfind? should i be using that or should i use Move X Y?  event pathfind leaves me a couple spaces away from where i want to be sometimes since random chests and vases spawn in the  room. the event pathfind example in the documention i dont really understand yet itll take me a day or 2 to get the entire thing down then another couple days to figure out how to use it correctly.. just wondering your opinion on the matter.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
DarkGuardianFarmV14.txt
« Last Edit: April 16, 2016, 12:53:27 AM by Tana »

Tags: