JoooeMyyy's Auto Ocean Fisher by joooemyyy
# Ocean Fishing by JoooeMyyy
# UO Outlands
# This script is designed to automatically:
# 1. Self-bandage if any damage is taken
# 2. Attack any grey monster within range
# 3. Keep Mariners Fortune up as much as possible
# 3. Cast fishing nets at fishing spots (when no nearby monsters are found)
# 4. Cast with a fishing pole when no monsters or no fishing spots are nearby
# It is currently useful for Fishing Spots and for casting MIBs (with the caveat that Mariners Fortune is not ideal for them atm).
# I will update it to support special fishing nets soonish.
# IMPORTANT!!! This script is currently spamming some actions without regards to cooldown which can result in it making a mess
# if you have auto-queue object delay enabled.
# Turn that off in Razor, Options > Targeting and Queues > Uncheck Auto-Queue Object Delay
# I would not have uploaded this in its current state if it hadnt been requested. It is still great but has some pretty rough edges.
# TODO: Improve efficiency and fix UX issues
# TODO: Add warning messages when out of fishing nets or fishing poles
# TOOD: Use a timer to reduce mariners fortune spam
# TODO: MIB mode that avoids casting when Mariners Fortune is not active
# TODO: Carve non-COTW fishes.
# TODO: Drop stuff into the ships hold
# -- Config
@setvar! "AllowHarvestArmor" 1
@setvar! "AllowFortuneArmor" 0
@setvar! "ThrowSpecialFishingNets" 0
@setvar! "ThrowFishingNets" 1
@setvar! "ParticipateInCombat" 1
@setvar! "ActivateMarinersFortune" 1
@setvar! "CastFishingPoleWhenIdle" 1
@setvar! "RequireAspectWeapon" 1
# Record our prefered weapon(s). (Note this has only been tested with a harpoon)
if findlayer self righthand as RightHandWeapon
@setvar! "myrighthanditem" RightHandWeapon
getlabel RightHandWeapon RightHandWeaponName
#overhead RightHandWeaponName
endif
if findlayer self lefthand as LeftHandWeapon
@setvar! "mylefthanditem" LeftHandWeapon
getlabel LeftHandWeapon LeftHandWeaponName
#overhead LeftHandWeaponName
if "RequireAspectWeapon" = 1
if "aspect" in LeftHandWeaponName
else
overhead "WARNING! Weapon is not aspected. Please correct and restart the script"
stop
endif
endif
endif
# Ensure we have harvest or fortune armor equipped
if findlayer self innertorso as ChestArmor
getlabel ChestArmor desc
if "harvest" in desc
if "AllowHarvestArmor" = 0
overhead "WARNING! Harvest armor detected but is disallowed above. Pretty sure you want that var set to 1."
stop
endif
elseif "fortune" in desc
if "AllowFortuneArmor" = 0
overhead "WARNING! Fortune armor detected but is disallowed above. Please correct and restart the script"
stop
endif
else
overhead "WARNING! Neither harvest nor fortune armor detected. Please correct and restart the script"
stop
endif
endif
// -- State
@setvar! "IsInCombat" 0
@setvar! "IsAtFishingSpot" 0
while not dead
# Apply a bandage if health is not full
if diffhits >= 1 and not bandaging and not findbuff "Noble Sacrifice"
if skill 'healing' >= 50 or skill "veterinary" >= 50
if findtype 'clean bandage%s%' backpack
hotkey 'bandage self'
wait 200
endif
endif
endif
if "ParticipateInCombat" = 1
# Check if there is anything nearby to fight
hotkey "Target Closest Grey Monster"
wait 400
if insysmsg "no one matching"
@setvar! "IsInCombat" 0
else
@setvar! "IsInCombat" 1
endif
endif
if "IsInCombat" = 0
# Nothing within attack range. Time to fish!
@setvar! myFishingNet 0
@setvar! requireManualTargeting 0
if "ThrowSpecialFishingNets" = 1
if not targetexists
if findtype 3530 backpack 2851 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2900 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2839 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2795 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2871 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2785 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2880 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2814 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2963 as item
@setvar! myFishingNet item
endif
@setvar! requireManualTargeting 1
endif
elseif "ThrowFishingNets" = 1
if not targetexists
if findtype 3530 backpack 1763 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2219 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2207 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2425 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2213 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2413 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 2419 as item
@setvar! myFishingNet item
elseif findtype 3530 backpack 0 as item
@setvar! myFishingNet item
endif
endif
endif
if myFishingNet != 0
dclick myFishingNet
wft 500
if "ThrowSpecialFishingNets" = 1
overhead "Where should I throw the special fishing net?"
while targetexists
endwhile
@setvar! "IsAtFishingSpot" 1
else
if targetexists
hotkey "Target Self"
endif
if insysmsg "anything nearby that requires a fishing net"
@setvar! "IsAtFishingSpot" 0
else
@setvar! "IsAtFishingSpot" 1
endif
endif
wait 400
endif
if "IsAtFishingSpot" = 1
# Use Mariners Fortune if its available
if "ActivateMarinersFortune" = 1
say "[GreaterAbility"
endif
# Wait for the fishing net to finish
if "ThrowSpecialFishingNets" = 1
wait 7000
else
wait 3500
endif
if insysmsg "Something emerges from the water!"
overhead "Time to fight!" 34
endif
else
# No fishing spot nearby. Switch to the pole
if findlayer self lefthand as LeftHandItem
getlabel LeftHandItem LeftHandItemName
if "fishing pole" in LeftHandItemName
dclick LeftHandItem
wait 6000
else
if findtype "fishing pole" backpack as FishingPole
dclick FishingPole
wait 500
else
overhead "No fishing pole found!" 34
endif
endif
endif
endif
else
// -- Something is in range to fight. Ensure weapons are equipped.
# Auto re-equip weapons if they are not equipped
if find "mylefthanditem" backpack and not casting and not targetexists
dclick "mylefthanditem"
pause 500
endif
if find "myrighthanditem" backpack and not casting and not targetexists
dclick "myrighthanditem"
pause 500
endif
# End of Auto Re-equip
attack lasttarget
wait 500
endif
endwhile








