06/15/05 06:38:30 AM
***** XUnleashed Trace Log Started: Wednesday, June 15, 2005 06:38:30
06/15/05 06:38:30 AM Registered XUnleashed Controls...
06/15/05 06:38:31 AM Registered XUnleashed IPPacketSniffer......
06/15/05 06:38:31 AM Registered XUScriptHelper...
06/15/05 06:38:31 AM XUnleashed Client: Click Play to begin...
06/15/05 06:38:39 AM XUnleashed Client: Updating 3rd Party Plugins and Services...
06/15/05 06:38:39 AM XUnleashed Client: Patching FFXIUnleashed Map Plugin
06/15/05 06:38:39 AM XUnleashed Client: Retrieving the file: update
06/15/05 06:38:39 AM XUnleashed Client: Redirecting to alternate patch server. . .
06/15/05 06:38:39 AM XUnleashed Client: Retrieving the file: FFXINews.txt
06/15/05 06:38:39 AM XUnleashed Client: Redirecting to alternate patch server. . .
06/15/05 06:38:39 AM XUnleashed Client: Patching Wyvern's FFXi Servicer
06/15/05 06:38:39 AM XUnleashed Client: Retrieving the file: update
06/15/05 06:38:39 AM XUnleashed Client: Redirecting to alternate patch server. . .
06/15/05 06:38:39 AM XUnleashed Client: Patching complete. . .
06/15/05 06:38:39 AM XUnleashed Client: Connecting to XUnleashed...
06/15/05 06:38:39 AM XUnleashed Client: Authenticating User...
06/15/05 06:38:40 AM XUnleashed Client: Connected. . .
06/15/05 06:38:40 AM Using Standard Hooking. . .
06/15/05 06:38:40 AM XUnleashed Client: Launching. . .
06/15/05 06:38:41 AM Found Target Process: pol.exe
06/15/05 06:38:41 AM Initializing COM Objects. . .
06/15/05 06:38:41 AM Setting up DirectX Hooks. . .
06/15/05 06:39:48 AM FOUND: Direct3DCreate8
06/15/05 06:39:48 AM Starting Services. . .
06/15/05 06:39:48 AM ------->FOUND A StandardSERVICE: XUnleashed Windows Input Service
06/15/05 06:39:48 AM CXUWinInput::Initialize()
06/15/05 06:39:48 AM ------->FOUND A StandardSERVICE: XUnleashed TCP/IP Packet Sniffer
06/15/05 06:39:48 AM Starting the 3rd Party Services...
06/15/05 06:39:48 AM ------->FOUND A 3rd Party Service: Wyvern's FFXi Servicer
06/15/05 06:39:49 AM Starting Plugins. . .
06/15/05 06:39:49 AM ------->FOUND A 3rd Party Plugin: FFXIUnleashed Map Plugin
06/15/05 06:39:49 AM Loading Window Schema. . .
06/15/05 06:39:49 AM Looking for 3rd Party Service for services\FFXIService.Service
06/15/05 06:39:49 AM ERROR: Failed to find a named Control!!!
06/15/05 06:39:49 AM ------->FOUND A STANDARD Plugin: XUnleashed V2 Triggers
06/15/05 06:39:49 AM Loading Window Schema. . .
06/15/05 06:39:49 AM ------->FOUND A STANDARD Plugin: XUnleashed V2 Macros
06/15/05 06:39:49 AM Loading Window Schema. . .
06/15/05 06:39:49 AM ------->FOUND A STANDARD Plugin: XUnleashed V2 Scripts
06/15/05 06:39:49 AM Loading Window Schema. . .
06/15/05 06:39:49 AM Attempting to lock onto Client. . .
06/15/05 06:39:49 AM FOUND: Direct3D8::CreateDevice()
06/15/05 06:39:59 AM FOUND: Direct3DDevice8::Present
06/15/05 06:39:59 AM Initializing DX8 BackBuffers...
06/15/05 06:40:44 AM XUScriptHelper->Creating Script Engine (VBScript). . .
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: XUScriptHost
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: Win32API
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: VirtualKey
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: Memory
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: SystemInfo
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: MemoryBasicInformation
06/15/05 06:40:44 AM XUScriptHelper->AddScriptItem: XUScriptPlugin
06/15/05 06:40:44 AM XUScriptHelper->Executing Script: ' Include variables declaration
XUScriptHost.ImportScript("xufish\fisher_variables.vbs")
scriptTimeInterval = 60
' Declare events
function onChangeZone
' Beep
if not scriptPaused then
ForcePause
Win32API.XUBeep 750,1000
end if
end function
function onStateChange
' Do nothing
end function
function onScriptTimeInterval
' Just beep three times
Win32API.XUBeep 750,1000
Sleep(250)
Win32API.XUBeep 750,1000
Sleep(250)
Win32API.XUBeep 750,1000
end function
function onMonsterCheck
' Do nothing
end function
function onNoBait
ForcePause
end function
' Include and start main script
XUScriptHost.ImportScript("xufish\fisher.vbs")
runFisher
06/15/05 06:40:44 AM XUScriptHelper->Executing Script: ' Variables intended to be set by the user per script are declared here
' Declare variables
'XUScriptPlugin.staStatus.Text = "Initializing..."
Public scriptTimeInterval
Public quick_macro, quick_macroShift
Public normal_macro, normal_macroShift
Public rod_macro, rod_macroShift
Public armor_macro, armor_macroShift
Public max_waitFishingStart
Public sort_waitMin, sort_waitMax
Public useStatistics
Public isFullscreen
Public catch_reactionspeedMax, catch_reactionspeedMin
Public fishes
' Macro shortcuts
quick_macro = VirtualKey.VK_2
quick_macroShift = VirtualKey.VK_MENU
normal_macro = VirtualKey.VK_1
normal_macroShift = VirtualKey.VK_MENU
rod_macro = VirtualKey.VK_3
rod_macroShift = VirtualKey.VK_MENU
armor_macro = VirtualKey.VK_4
armor_macroShift = VirtualKey.VK_MENU
' Max time to wait for PlayerStatus 0 to turn into 1
max_waitFishingStart = 8000
' Shortest user recation time on catch
catch_reactionspeedMax = 1000
' Longest user recation time on catch
catch_reactionspeedMin = 500
' Set to true to enable statistics window
useStatistics = true
' Set to false if you play the game in a window
isFullscreen = true
' Minimum amount of catches before sort inventory
sort_waitMin = 3
' Maximum amount of catches before sort inventory
sort_waitMax = 4
' This is a list of known fishes
' Format:
' name type rare stack value
' Type:
' 0: keep
' 1: throw away
fishes = array( _
array(0, "pair of rusty leggings", 1, false, false, 0), _
array(0, "Bastore Bream", 0, false, true, 1230), _
array(0, "Bastore Sardine", 0, false, true, 15), _
array(0, "Bhefhel Marlin", 0, false, false, 615), _
array(0, "Black Eel", 0, false, true, 392), _
array(0, "Black Sole", 0, false, true, 1575), _
array(0, "Bladefish", 0, false, false, 900), _
array(0, "Bluetail", 0, false, true, 675), _
array(0, "Cave Cherax", 0, false, false, 3280), _
array(0, "Cheval Salmon", 0, false, true, 41), _
array(0, "Cobalt Jellyfish", 0, false, true, 165), _
array(0, "Copper Frog", 1, false, true, 45), _
array(0, "Coral Butterfly", 0, false, false, 256), _
array(0, "Crayfish", 0, false, true, 80), _
array(0, "Crescent Fish", 0, false, true, 990), _
array(0, "Crystal Bass", 0, false, true, 0), _
array(0, "Dark Bass", 0, false, true, 45), _
array(0, "Elshimo Frog", 0, false, true, 115), _
array(0, "Elshimo Newt", 0, false, false, 393), _
array(0, "Emperor Fish", 0, false, false, 1230), _
array(0, "Fat Greedie", 0, true, false, 0), _
array(0, "Forest Carp", 0, false, true, 33), _
array(0, "Gavial Fish", 0, false, false, 1500), _
array(0, "Giant Catfish", 1, false, false, 225), _
array(0, "Giant Chirai", 0, false, false, 2255), _
array(0, "Giant Donko", 0, false, false, 430), _
array(0, "Gigant Squid", 0, false, false, 1200), _
array(0, "Gold Carp", 0, false, true, 675), _
array(0, "Gold Lobster", 0, false, true, 430), _
array(0, "Greedie", 0, false, true, 15), _
array(0, "Grimmonite", 0, false, false, 1400), _
array(0, "Gugru Tuna", 0, false, false, 225), _
array(0, "Icefish", 0, false, true, 344), _
array(0, "Jungle Catfish", 0, false, false, 1350), _
array(0, "Moat Carp", 0, false, true, 333), _
array(0, "Monke-Onke", 0, false, false, 675), _
array(0, "Nebimonite", 0, false, true, 1000), _
array(0, "Noble Lady", 0, false, true, 900), _
array(0, "Nosteau Herring", 0, false, true, 180), _
array(0, "Ogre Eel", 0, false, true, 73), _
array(0, "Pipira", 0, false, true, 104), _
array(0, "Quus", 0, false, true, 45), _
array(0, "Red Terrapin", 0, false, true, 675), _
array(0, "Ryugu Titan", 0, false, false, 3280), _
array(0, "Sandfish", 0, false, true, 52), _
array(0, "Sea Zombie", 0, false, false, 1435), _
array(0, "Shall Shell", 0, false, true, 675), _
array(0, "Shining Trout", 0, false, true, 58), _
array(0, "Silver Shark", 0, false, true, 1125), _
array(0, "Takitaro", 0, false, false, 1435), _
array(0, "Three-eyed Fish", 0, false, false, 1025), _
array(0, "Tiger Cod", 0, false, true, 115), _
array(0, "Titanictus", 0, false, false, 2000), _
array(0, "Tricolored Carp", 0, false, true, 105), _
array(0, "Yellow Globe", 0, false, true, 165), _
array(0, "Zafmlug Bass", 0, false, true, 53), _
array(0, "Zebra Eel", 0, false, true, 900), _
array(0, "Gil", 0, false, false, 1), _
array(0, "Arrowwood Log", 1, false, false, 0), _
array(0, "Copper Ring", 1, false, false, 0), _
array(0, "Coral Fragment", 0, false, true, 5000), _
array(0, "Clump of Pamtam kelp",1, false, true, 0), _
array(0, "Damp Scroll", 0, true, false, 1000), _
array(0, "Fish Scale Shield", 0, false, false, 0), _
array(0, "Mythril Dagger", 0, false, false, 0), _
array(0, "Mythril Sword", 0, false, false, 0), _
array(0, "Norg Shell", 0, true, false, 505), _
array(0, "Ripped Cap", 1, true, false, 0), _
array(0, "Rusty Bucket", 1, false, false, 0), _
array(0, "Rusty Cap", 0, false, false, 1800), _
array(0, "Rusty Greatsword", 0, false, false, 4000), _
array(0, "Rusty Leggings", 1, false, false, 0), _
array(0, "Rusty Pick", 0, false, false, 2700), _
array(0, "Rusty Subligar", 1, false, false, 0), _
array(0, "Silver Ring", 0, false, false, 1500) _
)
for i = LBound(fishes) to UBound(fishes)
fishes(i)(1) = LCase(fishes(i)(1))
next
' New format
' name type
'
' type1:
' arrays
' match colors
' except colors (can be null)
' Format
' index
' type
' 1:
' arrays
' match colors array
' except colors array (can be null)
'
' Indexes:
' tell detect = This detects a tell message at the bottom line of the chat dialog
' gm detect = This detects GMs, there's intentionally no support for this check, afk fish at your own risk
' zoning detect = This detects when the character is switching zones
' user chatting = This detects if the user is currently typing (the white bar shown when entering text)
' macro toolbar = This detects if the macro toolbar is visible (the one that pops up when you press alt)
' damage detect = This detects a line in the chatbox where you take damage (I set this to an orange color, red maxed, green at 20% and blue at 0%)
' rusty check = This detects various items that should be thrown away when caught
' onland check = This detects a line in the chatbox where you can't fish in the current location
' nobait check = This detects a line in the chatbox where you are out of bait
' toosmall check = This detects a line in the chatbox where you are notified that the fish you caught was too small
' monster hp 85 = monster 85% hp check
' monster hp 50 = monster 50% hp check
' player hp 75 = player 75% hp check
' player hp 50 = player 50% hp check
' player hp 25 = player 25% hp check
Public colorDetect
colorDetect = array( _
array("tell detect", 1, _
array( _
null, _
null _
) _
), _
array("gm detect", 1, _
array( _
null, _
null _
) _
), _
array("zoning detect", 1, _
array( _
null, _
null _
) _
), _
array("user chatting", 1, _
array( _
null, _
null _
) _
), _
array("macro toolbar", 1, _
array( _
null, _
null _
) _
), _
array("damage detect", 1, _
array( _
null, _
null _
) _
), _
array("onland check", 1, _
array( _
null, _
null _
) _
) _
)
' These are MY colors for 640x480, THEY MOST LIKELY WON'T WORK FOR YOU!!!!!!!!!!!!!!!!!!!!!!!
'colorDetect = array( _
' array("tell detect", 1, _
' array( _
' array( _
' array( 21, 432, 10, 25, 230, 255, 120, 160, 230, 255, 10) _
' ), _
' null _
' ) _
' ), _
' array("gm detect", 1, _
' array( _
' array( _
' array(129, 325, 40, 1, 155, 165, 165, 175, 180, 190, 15) _
' ), _
' null _
' ), _
' array( _
' array( _
' array( 21, 432, 10, 25, 60, 100, 200, 255, 200, 255, 10) _
' ), _
' null _
' ) _
' ), _
' array("zoning detect", 1, _
' array( _
' array( _
' array(400, 386, 3, 3, 0, 0, 0, 0, 0, 0, 9) _
' ), _
' null _
' ) _
' ), _
' array("user chatting", 1, _
' array( _
' array( _
' array(299, 443, 1, 1, 186, 186, 195, 195, 199, 199, 1) _
' ), _
' null _
' ) _
' ), _
' array("damage detect", 1, _
' array( _
' array( _
' array( 21, 446, 10, 12, 240, 255, 160, 180, 40, 60, 5) _
' ), _
' null _
' ) _
' ), _
' array("onland check", 1, _
' array( _
' null, _
' null _
' ) _
' ) _
')
06/15/05 06:40:45 AM XUScriptHelper->Executing Script: ' Include libraries
XUScriptPlugin.staStatus.Text = "Loading libraries... (fisher functions)"
XUScriptHost.ImportScript("xufish\fisher_functions.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (common)"
XUScriptHost.ImportScript("xufish\common.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (common functions)"
XUScriptHost.ImportScript("xufish\common_functions.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (navigator)"
XUScriptHost.ImportScript("xufish\navigator.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (utils)"
XUScriptHost.ImportScript("xufish\utils.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (playerstatus)"
XUScriptHost.ImportScript("xufish\playerstatus.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (monster)"
XUScriptHost.ImportScript("xufish\monster.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (synth)"
XUScriptHost.ImportScript("xufish\synth.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries done."
' Script global variables, only set once
XUScriptPlugin.staStatus.Text = "Declaring variables."
Dim scriptRunning
Dim scriptPaused
Dim scriptState
Dim scriptTime
Dim totalScriptTime
Dim statsTries, statsBites, statsObtained, statsLost, statsMisses, statsLineBreaks, statsRodBreaks, statsMonsters, statsRusty, statsTooSmall, statsGil
Dim i
Dim onSneakWearing, onSneakOff, onCatchMonster, onHPMPCheck, onCanCast, onBite, onInventoryFull, onMonsterHit, onCantFishHereMessage, onCatchFish, onReady
onSneakWearing = null
onSneakOff = null
onSneakOn = null
onCatchMonster = null
onHPMPCheck = null
onCanCast = null
onBite = null
onInventoryFull = null
onMonsterHit = null
onCantFishHereMessage = null
onCatchFish = null
onReady = null
Dim obtainedRegExp, releaseRegExp, waitRegExp, nobaitRegExp
' Initialize variables
XUScriptPlugin.staStatus.Text = "Initializing variables"
' Set stats to start from 0
statsTries = 0
statsBites = 0
statsObtained = 0
statsLost = 0
statsMisses = 0
statsLineBreaks = 0
statsRodBreaks = 0
statsMonsters = 0
statsRusty = 0
statsTooSmall = 0
statsGil = 0
' Init script state, for automated zoning and stuff
scriptState = 0
scriptTime = Now
totalScriptTime = Now
' Init regexps
set obtainedRegExp = New RegExp
obtainedRegExp.Pattern = characterName & " caught ([^\s]+)[\s]?(.*)!"
obtainedRegExp.IgnoreCase = False
obtainedRegExp.Global = True
set releaseRegExp = New RegExp
releaseRegExp.Pattern = characterName & " caught ([^\s]+)[\s]?(.*), but"
releaseRegExp.IgnoreCase = False
releaseRegExp.Global = True
set waitRegExp = New RegExp
waitRegExp.Pattern = "You must wait longer to perform that action"
waitRegExp.IgnoreCase = False
waitRegExp.Global = True
set nobaitRegExp = New RegExp
nobaitRegExp.Pattern = "You can't fish without bait on the hook"
nobaitRegExp.IgnoreCase = False
nobaitRegExp.Global = True
set toosmallRegExp = New RegExp
toosmallRegExp.Pattern = "Whatever caught the hook was too small to fish with this rod"
toosmallRegExp.IgnoreCase = False
toosmallRegExp.Global = True
set sneakwearingRegExp = New RegExp
sneakwearingRegExp.Pattern = "The effect of Sneak is about to wear off"
sneakwearingRegExp.IgnoreCase = False
sneakwearingRegExp.Global = True
set sneakoffRegExp = New RegExp
sneakoffRegExp.Pattern = characterName & "'s Sneak effect wears off"
sneakoffRegExp.IgnoreCase = False
sneakoffRegExp.Global = True
set sneakonRegExp = New RegExp
sneakonRegExp.Pattern = characterName & " gains the effect of Sneak."
sneakonRegExp.IgnoreCase = False
sneakonRegExp.Global = True
XUScriptPlugin.staStatus.Text = "Declaring functions..."
' Configurable functions
function quickFishMacro
KeyDown(quick_macroShift)
waitForMacroBar
pressKey(quick_macro)
KeyUp(quick_macroShift)
end function
function normalFishMacro
KeyDown(normal_macroShift)
waitForMacroBar
pressKey(normal_macro)
KeyUp(normal_macroShift)
end function
function equipRodMacro
KeyDown(rod_macroShift)
waitForMacroBar
pressKey(rod_macro)
KeyUp(rod_macroShift)
end function
function equipArmorMacro
KeyDown(armor_macroShift)
waitForMacroBar
pressKey(armor_macro)
KeyUp(armor_macroShift)
end function
function checkKeyboard
' here we look through all keyboard shortcuts
if (XUGetAsyncKeyState(VirtualKey.VK_F6) <> 0) Then
useTellDetect = not useTellDetect
if useTellDetect then
writeLogLine ("TellDetect enabled after user pressed F6!")
updateStatus "TellDetect enabled"
else
writeLogLine ("TellDetect disabled after user pressed F6!")
updateStatus "TellDetect disabled"
end if
end if
if (XUGetAsyncKeyState(VirtualKey.VK_F7) <> 0) Then
writeLogLine ("Resetting TopLeft after user pressed F7!")
win_posx = -1
win_posy = -1
getTopLeft
end if
if (XUGetAsyncKeyState(VirtualKey.VK_F8) <> 0) Then
writeLogLine ("Forcing pause after user pressed F8!")
ForcePause
Sleep 300
updateStatus "Pause pressed"
end if
if (XUGetAsyncKeyState(VirtualKey.VK_F9) <> 0) Then
writeLogLine ("UnPausing after user pressed F9!")
UnPause
Sleep 300
updateStatus "Unpause pressed"
end if
if (XUGetAsyncKeyState(VirtualKey.VK_F10) <> 0) Then
if useStatistics then
writeLogLine ("Toggling statistics after user pressed F10!")
toggleStatsWindow
end if
end if
if (XUGetAsyncKeyState(VirtualKey.VK_F11) <> 0) Then
writeLogLine ("Terminating script after user pressed F11!")
scriptRunning = false
Sleep 300
end if
end function
' Common functions, don't touch
function checkForTellMessage
Dim colorCheck
colorCheck = GetDetectArray("tell detect", colorDetect)
if colorDetectCheck(colorCheck) then
writeLogLine ("Tell detected!")
onTellMessage
end if
end function
function checkForGMMessage
Dim colorCheck
colorCheck = GetDetectArray("gm detect", colorDetect)
if colorDetectCheck(colorCheck) then
writeLogLine ("GM detected!")
onGMMessage
end if
end function
function checkForMonster
Dim colorCheck
colorCheck = GetDetectArray("damage detect", colorDetect)
if colorDetectCheck(colorCheck) then
Win32API.XUBeep 750,200
if not IsNull(onMonsterHit) then
Execute(onMonsterHit + "()")
else
writeLogLine ("Entering onMonsterAttack(false)!")
onMonsterAttack(false)
writeLogLine ("Leaving onMonsterAttack(false).")
end if
end if
onMonsterCheck
end function
function checkForZoning
Dim colorCheck
colorCheck = GetDetectArray("zoning detect", colorDetect)
if colorDetectCheck(colorCheck) then
writeLogLine ("Zone change detected!")
onChangeZone
end if
end function
function checkImportantEvents
checkForTellMessage
checkForGMMessage
checkForZoning
checkKeyboard
end function
function waitForMacroBar
Dim colorCheck
colorCheck = GetDetectArray("macro toolbar", colorDetect)
if IsNull(colorCheck) then
sleep(1000)
else
Dim localtimer
localtimer = 0
do while (localtimer < 2500) and (not colorDetectCheck(colorCheck))
Sleep 100
localtimer = localtimer + 100
loop
end if
end function
function waitForUser
' wait max 60 seconds for user to stop typing
Dim localtimer
Dim temptext
Dim colorCheck
localtimer = 0
colorCheck = GetDetectArray("user chatting", colorDetect)
if colorDetectCheck(colorCheck) then
writeLogLine ("Waiting for user to stop typing!")
temptext = XUScriptPlugin.staStatus.Text
updateStatus "Waiting for user"
do while (localtimer < 240) and colorDetectCheck(colorCheck)
Sleep 250
localtimer = localtimer + 1
loop
XUScriptPlugin.staStatus.Text = temptext
end if
end function
function controlledSleep(sleepTime)
Dim currentSleepTime
currentSleepTime = 0
do while sleepTime >= currentSleepTime
Sleep 200
currentSleepTime = currentSleepTime + 200
checkImportantEvents
checkForMonster
loop
end function
function togglePause
writeLogLine ("TogglePause called!")
scriptPaused = not scriptPaused
if useStatistics then
updateButtons
end if
end function
function forcePause
writeLogLine ("ForcePause called!")
scriptPaused = true
if useStatistics then
updateButtons
end if
end function
function unPause
writeLogLine ("UnPause called!")
scriptPaused = false
if useStatistics then
updateButtons
end if
end function
' Script start, don't touch this either
function runFisher
XUScriptPlugin.staStatus.Text = "Loading FFXIService..."
on error resume next
set serviceObject = XUScriptPlugin.GetService("FFXiService.Service")
if Err.number <> 0 then
' FFXIService didn't load
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
writeLogLine ("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
XUScriptPlugin.staStatus.Text = "FFXIService failed to load"
MsgBox("CRITICAL ERROR!!!! ffxiService failed to load, please install it!!")
else
on error goto 0
XUScriptPlugin.staStatus.Text = "FFXIService loaded"
on error resume next
if (characterName = "") then
writeLogLine ("CRITICAL ERROR!!!! (name check) Your ffxiService is old or not functioning properly, please reinstall it!!")
MsgBox("CRITICAL ERROR!!!! (name check) Your ffxiService is old or not functioning properly, please reinstall it!!")
end if
if Err.Number <> 0 then
writeLogLine ("CRITICAL ERROR!!!! (name check) Your ffxiService is old or not functioning properly, please reinstall it!! BACKUP LINE!")
end if
on error goto 0
' get the top left position of the window
if isFullscreen then
win_posx = 0
win_posy = 0
else
win_posx = -1
win_posy = -1
getTopLeft
end if
if useStatistics then
XUScriptPlugin.staStatus.Text = "Creating statistics window"
XUScriptHost.ImportScript("xufish\stats.vbs")
openStatsWindow
end if
scriptRunning = true
Dim currentStatus, lastStatus
Dim lastMacroTime
Dim isFish
Dim sortCurrent, sortNext
Dim deleteRusty
Dim skip
Dim text
Dim colorCheck
Dim regexpMatch
Dim canCast, canPullIn
Dim firstCase
Dim tempInLoppFishWeight
lastMacroTime = -1
currentStatus = -1
isFish = false
sortCurrent = 0
sortNext = -1
deleteRusty = false
lostTooSmall = false
' Generate change event in case the user wants to do something before fishing
onStateChange
' Reset script running time
scriptTime = Now
firstCast = true
writeLogLine ("Script now running...")
updateStatus "Fishing"
doKeyboardCommand("/cm p")
equipRodMacro
do while scriptRunning
if scriptPaused then
currentStatus = getPlayerStatus(serviceObject)
updateStatus "Paused (" & currentStatus & ", " & (scriptTimeInterval - minuteDiff(Now, scriptTime)) & " minutes [ " & minuteDiff(Now, totalScriptTime) & " ])"
Sleep 200
checkKeyboard
checkForMonster
checkForZoning
' have to reset this or script might repause immediatelly on resume
lastMacroTime = -1
else
' Sleep so script can be closed with F12
controlledSleep(200)
checkForMonster
lastStatus = currentStatus
currentStatus = getPlayerStatus(serviceObject)
updateStatus "Fishing (" & currentStatus & ", " & (scriptTimeInterval - minuteDiff(Now, scriptTime)) & " minutes [ " & minuteDiff(Now, totalScriptTime) & " ])"
select case currentStatus
case statusNone
if minuteDiff(Now, scriptTime) > scriptTimeInterval then
writeLogLine ("Entering onScriptTimeInterval...")
onScriptTimeInterval
writeLogLine ("Leaving onScriptTimeInterval.")
' Reset script running time
scriptTime = Now
lastMacroTime = -1
end if
skip = false
lostCatch = false
lostTooSmall = false
' Check for "Can't fish here"
if lastMacroTime <> -1 then
colorCheck = GetDetectArray("onland check", colorDetect)
if colorDetectCheck(colorCheck) then
writeLogLine ("Can't fish here detected!")
onCantFishHere
lastMacroTime = -1
skip = true
end if
end if
if (secondDiff(Now, scriptTime) < 15) and not firstCast then
skip = true
end if
firstCast = false
if not skip then
if not IsNull(onCanCast) then
Execute("canCast = " & onCanCast & "()")
else
canCast = true
end if
if canCast then
if lastMacroTime = -1 then
if not IsNull(onHPMPCheck) then
Execute(onHPMPCheck + "()")
end if
lastMacroTime = Now
waitForUser
if not IsNull(onReady) then
Execute(onReady + "()")
end if
waitForUser
if deleteRusty then
writeLogLine ("Deleting a rusty item.")
deleteLastItem
deleteRusty = false
end if
if sortCurrent >= sortNext then
writeLogLine ("Sorting inventory.")
SortInventory win_posx, win_posy, mouse_sort_autox, mouse_sort_autoy, mouse_sort_yesx, mouse_sort_yesy
sortCurrent = 0
sortNext = Int((sort_waitMax - sort_waitMin + 1) * Rnd + sort_waitMin)
end if
waitForUser
writeLogLine ("Trying to fish: normal.")
normalFishMacro
elseif secondDiff(Now, lastMacroTime) > (max_waitFishingStart / 1000) then
waitForUser
writeLogLine ("Trying to fish: quick.")
quickFishMacro
' sleep so we don't repeat too fast
controlledSleep(2000)
end if
end if
if lastMacroTime <> -1 then
if secondDiff(Now, lastMacroTime) > 60 then
writeLogLine ("Forcing pause, character has been trying to fish without success for over 60 seconds!")
forcePause
end if
end if
end if
case statusDead
' just do nothing, we're dead after all
Sleep 1000
case statusFighting
' just do nothing, assuming player is fighting manually
Sleep 1000
case statusHealing
writeLogLine ("Character is healing, trying to stand up.")
pressKey(VirtualKey.VK_A)
controlledSleep(4000)
case statusChocobo
' sleep extra long to reduce script load
Sleep 10000
case statusFishing
' good times, we are now fishing
if lastStatus <> statusFishing then
writeLogLine ("Fishing.")
lastMacroTime = -1
if useStatistics then
updateStatistics
end if
statsTries = statsTries + 1
isFish = false
end if
case statusBite
if lastStatus <> statusBite then
if not IsNull(onBite) then
Execute("canPullIn = " & onBite & "()")
else
canPullIn = true
end if
if canPullIn then
writeLogLine ("Something caught the hook.")
Sleep Int((catch_reactionspeedMax - catch_reactionspeedMin + 1) * Rnd + catch_reactionspeedMin)
waitForUser
tempInLoppFishWeight = getFishWeight(serviceObject)
writeLogLine("This fish weighs " & tempInLoppFishWeight)
if (tempInLoppFishWeight < 0) then
MsgBox("CRITICAL ERROR!!!! (stamina check) Your ffxiService is old or not functioning properly, please reinstall it!!")
end if
writeLogLine ("Entering onFishBite!")
onFishBite
writeLogLine ("Leaving onFishBite.")
writeLogLine ("Reeling in.")
pressKey(VK_ENTER)
statsBites = statsBites + 1
isFish = true
else
writeLogLine ("Something caught the hook but we were forced to ignore it!")
updateStatus "Forced to skip a " & getFishWeight(serviceObject) & " stamina catch!"
Sleep(2500)
pressKey(VirtualKey.VK_N)
end if
end if
case statusObtained
if lastStatus <> statusObtained then
writeLogLine ("We caught something!")
lastMacroTime = -1
statsObtained = statsObtained + 1
sortCurrent = sortCurrent + 1
end if
case statusRodBreak
if lastStatus <> statusRodBreak then
writeLogLine ("Rod broke!")
statsRodBreaks = statsRodBreaks + 1
onRodBreak
end if
case statusLineBreak
if lastStatus <> statusLineBreak then
writeLogLine ("Line broke!")
statsLineBreaks = statsLineBreaks + 1
end if
case statusCatchMonster
if lastStatus <> statusCatchMonster then
writeLogLine ("We caught a monster!")
statsBites = statsBites - 1
statsMonsters = statsMonsters + 1
if not IsNull(onCatchMonster) then
Execute(onCatchMonster + "()")
end if
end if
if useMonsterDetect then
writeLogLine ("Entering onMonsterAttack(true)!")
onMonsterAttack(true)
writeLogLine ("Leaving onMonsterAttack(true).")
lastStatus = -1
lastMacroTime = -1
end if
case statusLostCatch
if lastStatus <> statusLostCatch then
writeLogLine ("Lost the catch.")
if isFish then
statsLost = statsLost + 1
else
statsMisses = statsMisses + 1
end if
end if
case statusSitting
writeLogLine ("Character is sitting, trying to stand up...")
pressKey(VirtualKey.VK_A)
controlledSleep(4000)
case else
writeLogLine ("Unknown status code: " & currentStatus)
end select
end if
do while true
Dim regexpFound
Dim count, fish
Dim i
Dim handled
regexpFound = false
text = readLogLine
if text = "" then
exit do
end if
' Look for "Obtained: ([\d]*)\s?(.*)"
set regexpMatch = obtainedRegExp.Execute(text)
if regexpMatch.Count > 0 then
set regexpMatch = regexpMatch(0)
regexpFound = true
handled = false
count = regexpMatch.SubMatches(0)
fish = regexpMatch.SubMatches(1)
if (count = "") or (count = "a") or (count = "an") then
count = 1
end if
writeLogLine ("Caught " & count & " " & fish)
fish = LCase(fish)
for i = LBound(fishes) to UBound(fishes)
if StrComp(fishes(i)(1), fish) = 0 then
fishes(i)(0) = fishes(i)(0) + count
if fishes(i)(2) = 1 then
writeLogLine ("Throwing away catch.")
deleteRusty = true
statsObtained = statsObtained - 1
statsBites = statsBites - 1
statsRusty = statsRusty + 1
sortCurrent = sortCurrent - 1
else
statsGil = statsGil + (count * fishes(i)(5))
end if
handled = true
exit for
end if
next
if not handled then
writeLogLine ("Catch '" & fish & "' is unknown, not recording stats for this catch.")
end if
if not IsNull(onCatchFish) then
Execute(onCatchFish + "(fish)")
end if
end if
' Look for "You caught ([^\s]+)[\s]?(.*), but"
if not regexpFound then
set regexpMatch = releaseRegExp.Execute(text)
if regexpMatch.Count > 0 then
set regexpMatch = regexpMatch(0)
regexpFound = true
handled = false
count = regexpMatch.SubMatches(0)
fish = LCase(regexpMatch.SubMatches(1))
if (count = "") or (count = "a") or (count = "an") then
count = 1
end if
for i = LBound(fishes) to UBound(fishes)
if StrComp(fishes(i)(1), fish) = 0 then
fishes(i)(0) = fishes(i)(0) + count
if fishes(i)(3) then
writeLogLine ("Threw away " & count & " " & fish & ", catch is rare.")
statsBites = statsBites - 1
statsRusty = statsRusty + 1
else
writeLogLine ("Threw away " & count & " " & fish & ", inventory is full.")
statsObtained = statsObtained - 1
sortCurrent = SortNext + 1
if not IsNull(onInventoryFull) then
Execute(onInventoryFull + "()")
else
ForcePause
end if
end if
handled = true
exit for
end if
next
if not handled then
writeLogLine ("Threw away " & count & " unknown catch '" & fish & "', inventory is full.")
statsObtained = statsObtained - 1
sortCurrent = SortNext + 1
if not IsNull(onInventoryFull) then
Execute(onInventoryFull + "()")
else
ForcePause
end if
end if
end if
end if
' Look for "You must wait longer to perform that action"
if not regexpFound then
set regexpMatch = waitRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
currentStatus = getPlayerStatus(serviceObject)
if currentStatus = statusNone then
if not scriptPaused then
writeLogLine ("Trying to fish: quick.")
waitForUser
quickFishMacro
end if
end if
end if
end if
' Look for "You can't fish without bait on the hook"
if not regexpFound then
set regexpMatch = nobaitRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Out of bait!")
onNoBait
lastMacroTime = Now
end if
end if
' Look for "Whatever caught the hook was too small to fish with this rod"
if not regexpFound then
set regexpMatch = toosmallRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Oh, it was too small!")
statsLost = statsLost - 1
statsTooSmall = statsTooSmall + 1
end if
end if
' Look for "The effect of Sneak is about to wear off"
if not regexpFound then
set regexpMatch = sneakwearingRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Sneak wearing off!")
if not IsNull(onSneakWearing) then
Execute(onSneakWearing + "()")
else
ForcePause
Win32API.XUBeep 750,200
end if
end if
end if
' Look for characterName & "'s Sneak effect wears off"
if not regexpFound then
set regexpMatch = sneakoffRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Sneak wore off!")
if not IsNull(onSneakOff) then
Execute(onSneakOff + "()")
else
ForcePause
Win32API.XUBeep 750,500
end if
end if
end if
' Look for characterName & "gainst the effect of Sneak"
if not regexpFound then
set regexpMatch = sneakonRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Sneak is on!")
if not IsNull(onSneakOn) then
Execute(onSneakOn + "()")
lastMacroTime = -1
end if
end if
end if
if not regexpFound then
if InStr(text, "7B:You cannot fish here") then
regexpFound = true
writeLogLine ("We can't fish in the current location!")
if not IsNull(onCantFishHereMessage) then
Execute(onCantFishHereMessage + "()")
lastMacroTime = -1
else
ForcePause
Win32API.XUBeep 750,500
end if
end if
end if
set regexpMatch = nothing
loop
loop
end if
if useStatistics then
closeStatsWindow
end if
set serviceObject = Nothing
set obtainedRegExp = Nothing
set releaseRegExp = Nothing
end function
XUScriptPlugin.staStatus.Text = "Done parsing fisher.vbs!"
06/15/05 06:40:49 AM XUScriptHelper->Executing Script: function onTellMessage
' beep by default
if (not scriptPaused) and useTellDetect then
writeLogLine ("Tell detected. Forcing pause.")
ForcePause
updateStatus "Tell detected..."
do while scriptPaused
Win32API.XUBeep 750,1000
Sleep 500
checkKeyboard
loop
end if
end function
function onGMMessage
' beep by default
if not scriptPaused then
writeLogLine ("GM detected! Forcing pause.")
ForcePause
updateStatus "GM detected..."
do while scriptPaused
Win32API.XUBeep 750,1000
Sleep 500
checkKeyboard
loop
end if
end function
function onRodBreak
writeLogLine ("Rod broke!")
onTellMessage
exit function
Dim currentStatus
updateStatus "Rod broke, trying to equip a new one"
currentStatus = getPlayerStatus(serviceObject)
' Wait for player to enter a state where we can equip the rod
do while currentStatus <> statusNone
controlledSleep(200)
currentStatus = getPlayerStatus(serviceObject)
loop
' Sleep a little extra
controlledSleep(1000)
equipRodMacro
end function
function onCantFishHere
Dim startAngle, currentAngle, tries
startAngle = serviceObject.PlayerHeading
currentAngle = startAngle
tries = 0
' Keep turning (and fast) until we can fish, character stops turning before
' state changes so don't stand around waiting for it to change
do while (currentStatus <> statusFishing) and (tries < 100) and scriptRunning and (not scriptPaused)
TurnLeft(50)
quickFishMacro
controlledSleep(200)
currentStatus = getPlayerStatus(serviceObject)
tries = tries + 1
loop
if (currentStatus <> statusFishing) and (not scriptPaused) then
writeLogLine ("Can't fish in this location, forcing pause.")
ForcePause
end if
end function
function PressLeft( pressIT )'Added by WyvernX for 2.23.05 Patch
if (pressIT = true) then
KeyDown(VirtualKey.VK_A)
else
KeyUp(VirtualKey.VK_A)
end if
end function
function PressRight( pressIT )'Added by WyvernX for 2.23.05 Patch
if (pressIT = true) then
KeyDown(VirtualKey.VK_D)
else
KeyUp(VirtualKey.VK_D)
end if
end function
function onFishBite() 'Added by WyvernX for 2.23.05 Patch
'Try to lower the health (stamina) of the fish by countering the line
'NOTE: Pole Functions do not call UpdateData for speed sake! UpdateData is called in Status calls
writeLogLine ("onFishBite - Begin")
Dim TargetHealth
Dim LastKeyPressed 'L,C,R
LastKeyPressed = "C"
updateStatus "Fighting a " & getFishWeight(serviceObject) & " .lbs fish!"
currentStatus = getPlayerStatus(serviceObject)
targetHealth = getTargetHealth(serviceObject)
bTryLeft = true
do while (currentStatus = statusBite and targetHealth > 0)
if (getPoleCenter(serviceObject) = true) then
if (LastKeyPressed = "L") then
PressLeft(false) 'Reset keys
elseif (LastKeyPressed = "R") then
PressRight(false) 'Reset keys
end if
LastKeyPressed = "C"
elseif (getPoleLeft(serviceObject) = true) then
if (LastKeyPressed = "R") then
'Keep pressing it!
elseif (LastKeyPressed = "C") then
PressRight(true)
else 'LastKeyPressed = "L"
PressLeft(false)
PressRight(true)
end if
LastKeyPressed = "R" 'Current Direction we are pressing
elseif (getPoleRight(serviceObject) = true) then
if (LastKeyPressed = "L") then
'Keep pressing it!
elseif (LastKeyPressed = "C") then
PressLeft(true)
else 'LastKeyPressed = "R"
PressRight(false)
PressLeft(true)
end if
LastKeyPressed = "L" 'Current Direction we are pressing
end if
sleep 50
currentStatus = getPlayerStatus(serviceObject)
targetHealth = getTargetHealth(serviceObject)
loop
PressLeft(false) 'Reset keys
PressRight(false) 'Reset keys
writeLogLine ("onFishBite - End")
end function
function onMonsterAttack(turn)
if not useMonsterDetect then
exit function
end if
writeLogLine ("Entering onMonsterAttack.")
' fight monster here
Dim currentAngle
Dim fightStartTime
Dim lastAttackTime
Dim currentStatus
Dim lastBuffTime
Dim usedMana
Dim lastPaeon
Dim colorAttack, colorCheck, colorCheck2, colorCheck3
colorAttack = GetDetectArray("damage detect", colorDetect)
lastPaeon = Now
writeLogLine ("Preparing to fight monster.")
updateStatus "Preparing to fight monster"
currentStatus = getPlayerStatus(serviceObject)
do while currentStatus = statusCatchMonster
Sleep(500)
currentStatus = getPlayerStatus(serviceObject)
loop
writeLogLine ("Cancelling current target.")
updateStatus "Canceling current target"
pressKey(VirtualKey.VK_N)
equipArmorMacro
currentAngle = serviceObject.PlayerHeading
if turn then
writeLogLine ("Turning to face monster.")
updateStatus "Turning to face monster"
faceDirection serviceObject, (currentAngle + 180)
end if
currentStatus = getPlayerStatus(serviceObject)
writeLogLine ("Trying to fight!")
updateStatus "Trying to fight"
lastAttackTime = Now
do while (Second(Now - lastAttackTime) < 20) and (currentStatus <> statusFighting)
waitForUser
doKeyboardCommand("/a")
colorCheck = GetDetectArray("damage detect", colorDetect)
if (not IsNull(colorCheck)) and colorDetectCheck(colorCheck) then
lastAttackTime = Now
end if
Sleep(3000)
currentStatus = getPlayerStatus(serviceObject)
if currentStatus = statusDead then
writeLogLine ("Character has been slain, forcing pause.")
ForcePause
exit function
end if
loop
fightStartTime = Now
' Wait for char to draw weapon
writeLogLine ("Drawing weapon!")
updateStatus "Draw weapon"
Sleep(3000)
if currentStatus = statusFighting then
if not turn then
pressKey(VirtualKey.VK_S)
pressKey(VirtualKey.VK_S)
end if
updateStatus "Fighting"
' Place job specific code here, for example:
' You can make this quite advanced if you want the bot to be able to fight harder mobs
' The example below can safely fight a kraken with a level 55 bard, which is quite dangerous
'waitForUser
'doKeyboardCommand("/equip range ""Cornette {+}1""")
'colorCheck = GetDetectArray("monster hp 85", colorDetect)
'currentStatus = getPlayerStatus(serviceObject)
' updateStatus "Player: " & CInt(serviceObject.PlayerHP) & "hp/" & CInt(serviceObject.PlayerMP) & "mp, Monster: " & CInt(serviceObject.TargetHP) & "%"
'if (currentStatus = statusFighting) and (CInt(serviceObject.TargetHP) > 80) then
' waitForUser
' doKeyboardCommand("/ma ""Carnage Elegy"" <t>")
' Sleep(6000)
'end if
'currentStatus = getPlayerStatus(serviceObject)
'if (currentStatus = statusFighting) then
' ' Lock on target again
' waitForUser
' pressKey(VirtualKey.VK_H)
'end if
'colorCheck = GetDetectArray("monster hp 85", colorDetect)
'currentStatus = getPlayerStatus(serviceObject)
' updateStatus "Player: " & CInt(serviceObject.PlayerHP) & "hp/" & CInt(serviceObject.PlayerMP) & "mp, Monster: " & CInt(serviceObject.TargetHP) & "%"
'if (currentStatus = statusFighting) and (CInt(serviceObject.TargetHP) > 80) then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' Sleep(12000)
' lastPaeon = Now
'end if
'currentStatus = getPlayerStatus(serviceObject)
' updateStatus "Player: " & CInt(serviceObject.PlayerHP) & "hp/" & CInt(serviceObject.PlayerMP) & "mp, Monster: " & CInt(serviceObject.TargetHP) & "%"
'if (currentStatus = statusFighting) and (CInt(serviceObject.TargetHP) > 80) then
' waitForUser
' doKeyboardCommand("/ma ""Valor Minuet III"" <me>")
' Sleep(12000)
'end if
'lastBuffTime = Now
'usedMana = false
writeLogLine ("Entering main fight loop.")
currentStatus = getPlayerStatus(serviceObject)
do while (currentStatus = statusFighting)
' Rebuff if songs are about to fade
'if minuteDiff(Now, lastBuffTime) >= 2 then
' currentStatus = getPlayerStatus(serviceObject)
' if (currentStatus = statusFighting) then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' Sleep(12000)
' lastPaeon = Now
' end if
' currentStatus = getPlayerStatus(serviceObject)
' if (currentStatus = statusFighting) then
' waitForUser
' doKeyboardCommand("/ma ""Valor Minuet III"" <me>")
' Sleep(12000)
' end if
' lastBuffTime = Now
'end if
serviceObject.updateData
if serviceObject.PlayerHP < 250 then
waitForUser
doKeyboardCommand("/ma ""Warp"" <me>")
usedMana = true
Win32API.XUBeep 750,1000
Sleep(500)
Win32API.XUBeep 750,1000
Sleep(7000)
elseif serviceObject.PlayerHP < 450 then
waitForUser
doKeyboardCommand("/ja ""Divine Seal"" <me>")
Sleep(3000)
waitForUser
doKeyboardCommand("/ma ""Cure III"" <me>")
usedMana = true
Win32API.XUBeep 750,1000
Sleep(8500)
end if
Sleep(500)
currentStatus = getPlayerStatus(serviceObject)
updateStatus "Player: " & CInt(serviceObject.PlayerHP) & "hp/" & CInt(serviceObject.PlayerMP) & "mp, Monster: " & CInt(serviceObject.TargetHP) & "%"
loop
writeLogLine ("Leaving main fight loop.")
if currentStatus = statusDead then
writeLogLine ("Character has been slain, forcing pause.")
ForcePause
exit function
end if
' Equipping rod to clear out old battle messages.
equipRodMacro
Sleep(500)
' turn back to void bogus gm detect
if turn then
updateStatus "Turning back"
faceDirection serviceObject, (currentAngle)
end if
writeLogLine ("Resting after battle.")
updateStatus "Resting"
' Place recovery code here, for example:
'serviceObject.updateData
'if serviceObject.PlayerHP < 700 then
' waitForUser
' doKeyboardCommand("/equip range ""Cornette {+}1""")
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' controlledSleep(12000)
' if serviceObject.PlayerHP < 600 then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon III"" <me>")
' if serviceObject.PlayerHP < 300 then
' controlledSleep(90000)
' else
' controlledSleep(30000)
' end if
' end if
'end if
'serviceObject.updateData
'if serviceObject.PlayerMP < 150 then
' waitForUser
' doKeyboardCommand("/ma ""Mage's Ballad II"" <me>")
' controlledSleep(12000)
' serviceObject.updateData
' if serviceObject.PlayerHP < 700 then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' controlledSleep(12000)
' end if
'end if
' Do not modify below this point, the script is trying to resume fishing
end if
if turn then
updateStatus "Turning back"
faceDirection serviceObject, (currentAngle)
end if
controlledSleep(200)
equipRodMacro
' if scriptRunning and (not scriptPaused) then
' updateStatus "Resuming fishing"
' quickFishMacro
' controlledSleep(3000)
' currentStatus = getPlayerStatus(serviceObject)
' if (currentStatus <> statusFishing) then
' onCantFishHere
' end if
' updateStatus "Fishing"
'
' end if
writeLogLine ("Leaving onMonsterAttack.")
end function
06/15/05 06:40:50 AM XUScriptHelper->Executing Script: XUScriptPlugin.staStatus.Text = "Loading libraries... (common variables)"
XUScriptHost.ImportScript("xufish\common_variables.vbs")
function minuteDiff(timeNow, timeThen)
currentTime = (timeNow - timeThen)
minuteDiff = ((Hour(currentTime) * 60) + Minute(currentTime))
end function
function secondDiff(timeNow, timeThen)
currentTime = (timeNow - timeThen)
secondDiff = ((Hour(currentTime) * 60 * 60) + (Minute(currentTime) * 60) + Second(currentTime))
end function
function doKeyboardCommand(line)
pressKey(VirtualKey.VK_SPACE)
SendKeys line
Sleep 200
pressKey(VirtualKey.VK_ENTER)
end function
function pressKey(key)
KeyDown(key)
Sleep 200
KeyUp(key)
end function
function colorDetectMatch(ByRef line)
Dim matchCount
Dim temp_y
Dim temp_x
Dim temp_c
Dim temp_c_red
Dim temp_c_green
Dim temp_c_blue
for temp_y = (win_posy + line(1)) to (win_posy + line(1) + line(3) - 1)
for temp_x = (win_posx + line(0)) to (win_posx + line(0) + line(2) - 1)
temp_c = GetPixelColor (temp_x, temp_y)
temp_c_red = ExtractRGB_Red(temp_c)
temp_c_green = ExtractRGB_Green(temp_c)
temp_c_blue = ExtractRGB_Blue(temp_c)
if (temp_c_red >= line(4)) and (temp_c_red <= line(5)) and (temp_c_green >= line(6)) and (temp_c_green <= line(7)) and (temp_c_blue >= line(8)) and (temp_c_blue <= line(9)) then
matchCount = matchCount + 1
end if
if matchCount >= line(10) then
exit for
end if
next
if matchCount >= line(10) then
exit for
end if
next
if matchCount >= line(10) then
colorDetectMatch = true
else
colorDetectMatch = false
end if
end function
function colorDetectCheck(ByRef list)
if not IsNull(list) then
' List array structure: array(name, custom, check1, check2, check3, ...)
' Basic array structure: array(detectArray, exceptionArray)
' Color detector settings: parameters = (x, y, line_width, line_height, red_min, red_max, green_min, green_max, blue_min, blue_max, min_matches)
Dim success
Dim i, j, k
Dim detectLine, exceptLine
Dim detectCount, exceptCount
success = false
for i = (LBound(list) + 2) to UBound(list)
if not IsNull(list(i)) then
detectCount = 0
exceptCount = 0
detectLine = list(i)(0)
exceptLine = list(i)(1)
if not IsNull(detectLine) then
for j = LBound(detectLine) to UBound(detectLine)
if not IsNull(detectLine(j)) then
if colorDetectMatch(detectLine(j)) then
detectCount = (detectCount + 1)
end if
end if
next
end if
if (detectCount > 0) then
if (detectCount = (UBound(detectLine) + 1)) then
success = true
if not IsNull(exceptLine) then
for j = LBound(exceptLine) to UBound(exceptLine)
if not IsNull(exceptLine(j)) then
if colorDetectMatch(exceptLine(j)) then
success = false
exit for
end if
end if
next
end if
end if
end if
end if
if success then
exit for
end if
next
colorDetectCheck = success
else
colorDetectCheck = false
end if
end function
function GetDetectArray(name, ByRef values)
Dim i
Dim result
result = null
for i = LBound(values) to UBound(values)
if values(i)(0) = name then
result = values(i)
exit for
end if
next
GetDetectArray = result
end function
function getTargetHealth(ByRef obj) 'Added by WyvernX for 2.23.05 Patch
on error resume next
obj.UpdateData
getTargetHealth = obj.TargetHP
if Err.Number <> 0 then
getTargetHealth = 0
end if
on error goto 0
end function
function getPlayerStatus(ByRef obj)
on error resume next
obj.UpdateData
getPlayerStatus = obj.PlayerStatus
if Err.Number <> 0 then
getPlayerStatus = -1
end if
on error goto 0
end function
function getPoleLeft(ByRef obj) 'Added By WyvernX for 2.23 Patch
on error resume next
'obj.UpdateData
getPoleLeft = obj.PoleLeft
if Err.Number <> 0 then
getPoleLeft = false
end if
on error goto 0
end function
function getPoleCenter(ByRef obj) 'Added By WyvernX for 2.23 Patch
on error resume next
'obj.UpdateData
getPoleCenter = obj.PoleCenter
if Err.Number <> 0 then
getPoleCenter = false
end if
on error goto 0
end function
function getPoleRight(ByRef obj) 'Added By WyvernX for 2.23 Patch
on error resume next
'obj.UpdateData
getPoleRight = obj.PoleRight
if Err.Number <> 0 then
getPoleRight = false
end if
on error goto 0
end function
function getFishWeight(ByRef obj) 'Added By WyvernX for 2.23 Patch
on error resume next
obj.UpdateData
getFishWeight = obj.FishWeight
if Err.Number <> 0 then
getFishWeight = -1
end if
on error goto 0
end function
function getTargetItem(ByRef obj)
on error resume next
obj.UpdateData
getTargetItem = obj.TargetItemName
if Err.Number <> 0 then
getTargetItem = ""
end if
on error goto 0
end function
function getTopLeft
XUScriptPlugin.staStatus.Text = "Find red point (move cursor over red dot in topleft corner)"
Dim tempc, tempx, tempy
do while (win_posx = -1)
XUScriptHost.GetCursorPos tempx,tempy
tempc = XUScriptHost.GetPixelColor(tempx,tempy)
if tempc = 255 then
tempc = XUScriptHost.GetPixelColor(tempx-1,tempy)
if tempc = 255 then
tempx = tempx-1
end if
tempc = XUScriptHost.GetPixelColor(tempx,tempy-1)
if tempc = 255 then
tempy = tempy-1
end if
tempc = XUScriptHost.GetPixelColor(tempx-1,tempy)
if tempc = 255 then
tempx = tempx-1
end if
tempc = XUScriptHost.GetPixelColor(tempx,tempy-1)
if tempc = 255 then
tempy = tempy-1
end if
tempc = XUScriptHost.GetPixelColor(tempx-1,tempy)
if tempc = 255 then
tempx = tempx-1
end if
tempc = XUScriptHost.GetPixelColor(tempx,tempy-1)
if tempc = 255 then
tempy = tempy-1
end if
tempc = XUScriptHost.GetPixelColor(tempx-1,tempy)
if tempc = 255 then
tempx = tempx-1
end if
tempc = XUScriptHost.GetPixelColor(tempx,tempy-1)
if tempc = 255 then
tempy = tempy-1
end if
win_posx = tempx
win_posy = tempy
end if
' Must have this sleep here or the script can't be stopped with the Stop button or F12
Sleep 100
loop
XUScriptPlugin.staStatus.Text = "Found red point - please wait"
end function
function readLogLine
if ffxiLogTextFile.AtEndOfStream then
readLogLine = ""
else
readLogLine = ffxiLogTextFile.ReadLine
end if
end function
function writeLogLine (msg)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim FTarget, File, MyDate, MyTime, temp
MyDate = CStr (FormatDateTime (Date, 1))
MyTime = CStr (FormatDateTime (Time, 3))
Set FTarget = CreateObject("Scripting.FileSystemObject")
Set File = FTarget.OpenTextFile(logFilename, ForAppending, True)
temp = "[" + MyDate + " " + MyTime + "] " + msg + vbCrLf
File.Write temp
File.Close
end function
06/15/05 06:40:51 AM XUScriptHelper->Executing Script: Public serviceObject
Public mouse_sort_autox, mouse_sort_autoy, mouse_sort_yesx, mouse_sort_yesy
Public item_textx, item_texty, item_textwidth, item_textheight
Public citem_textx, citem_texty, citem_textwidth, citem_textheight
Public win_posx, win_posy
Public logFilename, ffxiLogFilename, ffxiLogFile, ffxiLogTextFile
Public useTellDetect, useMonsterDetect
Public characterName
' If all 4 variables are set to a value other than -1 the mouse will be used to sort your inventory
mouse_sort_autox = -1
mouse_sort_autoy = -1
mouse_sort_yesx = -1
mouse_sort_yesy = -1
item_textx = 0
item_texty = 0
item_textwidth = 0
item_textheight = 0
citem_textx = 0
citem_texty = 0
citem_textwidth = 0
citem_textheight = 0
' Here's my variables for 640x480 resolution
'mouse_sort_autox = 560
'mouse_sort_autoy = 76
'mouse_sort_yesx = 560
'mouse_sort_yesy = 122
'item_textx = 68
'item_texty = 278
'item_textwidth = 10
'item_textheight = 7
'citem_textx = 69
'citem_texty = 246
'citem_textwidth = 10
'citem_textheight = 7
' Path to the logfiles for the script
logFilename = GetXUnleashedDirectory() + "\scripts\xufish_logfile.txt"
ffxiLogFilename = GetXUnleashedDirectory() + "\FFXILog.txt"
' Init log file reader
set ffxiLogFile = CreateObject("Scripting.FileSystemObject")
set ffxiLogTextFile = ffxiLogFile.OpenTextFile(ffxiLogFilename, 1) ' 1 means ForReading
do while ffxiLogTextFile.AtEndOfStream <> True
ffxiLogTextFile.SkipLine
loop
' If monster detect
Last edited by Guest on June 15th, 2005, 2:12 pm, edited 3 times in total.
|