 |
| Author |
XUHunter Custom (w/out nav points)![]() |
skylr616
In Training

Regular Member
Joined: 01 May 2004 Posts: 28 4 TUBucks
|
Posted: Wed Oct 20, 2004 4:18 am Post subject:
XUHunter Custom (w/out nav points) |
|
This is pretty primitive, but atleast it works. It is set to use provoke and axe weapon skills, but you can customize if you take the time to look at the fight_target.vbs and see what I changed.
*Fixes
removed waypoints
fixed jerky wait movement
*still needs fixin
locking up when targeting Weak Mobs (no code for these mobs)
hunter_variable.vbs
| Code: |
' Variables intended to be set by the user per script are declared here
' Declare variables
'XUScriptPlugin.staStatus.Text = "Initializing..."
'This is how long to hunt for.
Public scriptTimeInterval
scriptTimeInterval = -1
dim maxTurnsForTarget
maxTurnsForTarget = 6
Dim maxKillsBeforePatrol
maxKillsBeforePatrol = 1000
Dim PatrolArea
PatrolArea = array()
dim bAllowWeakTargets
bAllowWeakTargets = false
dim bAllowEasyTargets
bAllowEasyTargets = true
Dim bAllowEvenTargets
bAllowEvenTargets = true
Dim bAllowDecentTargets
bAllowDecentTargets = true
Dim bAllowToughTargets
bAllowToughTargets = false
' Macro shortcuts
Public nextTarget_macro
Public checkTarget_macro, checkTarget_macroShift
nextTarget_macro = VirtualKey.VK_F8 'Key used to attack
checkTarget_macroShift = VirtualKey.VK_MENU 'Key used to get the Macro Menu
checkTarget_macro = VirtualKey.VK_C 'Key used to Check command
' Set to true to enable statistics window
Public useStatistics
useStatistics = false
' Set to false if you play the game in a window
Public isFullscreen
isFullscreen = false
'This will is called when the script first starts up
function onScriptBegin
' Do nothing
end function |
fight_target.vbs
| Code: |
dim startingHealth
function restToHeal
writeLogLine ("Entering Rest.")
XUScriptPlugin.staStatus.Text = "Preparing to Rest"
Dim currentHealth
currentHealth = getPlayerHealth(serviceObject)
writeLogLine("startingHealth=" & startingHealth)
writeLogLine("currentHealth=" & currentHealth)
if (startingHealth > 0) then
'Heal until our starting value atleast
if (currentHealth < startingHealth) then
doKeyboardCommand("/heal")
do while (true)
Sleep(15000)
currentHealth = getPlayerHealth(serviceObject)
if (currentHealth >= startingHealth) then
exit do
end if
writeLogLine ("Player is still healing at " & currentHealth)
loop
doKeyboardCommand("/heal")
end if
else
'Heal until not moving anymore
doKeyboardCommand("/heal")
do while (true)
Sleep(15000)
newHealth = getPlayerHealth(serviceObject)
if (currentHealth = newHealth) then
exit do
end if
writeLogLine ("Player is still healing at " & currentHealth)
loop
doKeyboardCommand("/heal")
end if
'This is to stop /follow if it is still active.
pressKey(VirtualKey.VK_W)
pressKey(VirtualKey.VK_S)
writeLogLine ("Leaving Rest.")
XUScriptPlugin.staStatus.Text = "Leaving Rest."
end function
function fightTarget
writeLogLine ("Entering fightTarget.")
' fight monster here
Dim currentAngle
Dim fightStartTime
Dim lastAttackTime
Dim currentStatus
Dim lastBuffTime
Dim usedMana
Dim lastPaeon
lastPaeon = 0
writeLogLine ("Preparing to fight monster.")
XUScriptPlugin.staStatus.Text = "Preparing to fight monster"
doKeyboardCommand("/follow")
' currentStatus = getPlayerStatus(serviceObject)
' do while currentStatus = statusNone
' Sleep(500)
' currentStatus = getPlayerStatus(serviceObject)
' writeLogLine("Current Status is: " & currentStatus)
' loop
currentStatus = getPlayerStatus(serviceObject)
writeLogLine ("Trying to fight!")
XUScriptPlugin.staStatus.Text = "Trying to fight"
lastAttackTime = Now
do while ((Second(Now - lastAttackTime) < 20) and (currentStatus <> statusFighting))
waitForUser
XUScriptPlugin.staStatus.Text = "Wait for User"
sleep(6000)
doKeyboardCommand("/ja Provoke <t>")
sleep(500)
doKeyboardCommand("/a <t>")
sleep(3000)
pressKey(VirtualKey.VK_A)
sleep(300)
pressKey(VirtualKey.VK_D)
sleep(2000)
doKeyboardCommand("/ws Raging Axe <t>")
sleep(500)
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!")
XUScriptPlugin.staStatus.Text = "Draw weapon"
Sleep(3000)
if currentStatus = statusFighting then
XUScriptPlugin.staStatus.Text = "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""")
' currentStatus = getPlayerStatus(serviceObject)
' if (currentStatus = statusFighting) and ((not colorDetectDefined(colorDetect(10))) or colorDetectCheck(colorDetect(10))) then
' waitForUser
' doKeyboardCommand("/ma ""Carnage Elegy"" <t>")
' Sleep(6000)
' ' Lock on target again
' pressKey(VirtualKey.VK_H)
' end if
' currentStatus = getPlayerStatus(serviceObject)
' if (currentStatus = statusFighting) and ((not colorDetectDefined(colorDetect(10))) or colorDetectCheck(colorDetect(10))) then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' Sleep(12000)
' lastPaeon = Now
' end if
' currentStatus = getPlayerStatus(serviceObject)
' if (currentStatus = statusFighting) and ((not colorDetectDefined(colorDetect(10))) or colorDetectCheck(colorDetect(10))) then
' waitForUser
' doKeyboardCommand("/ma ""Valor Minuet III"" <me>")
' Sleep(12000)
' end if
' lastBuffTime = Now
' usedMana = false
writeLogLine ("Entering main fight loop.")
currentStatus = getPlayerStatus(serviceObject)
Dim randomTurnCounter
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
'
' if colorDetectDefined(colorDetect(14)) and (not colorDetectCheck(colorDetect(14))) then
' waitForUser
' doKeyboardCommand("/ja ""Divine Seal"" <me>")
' Sleep(3000)
' waitForUser
' doKeyboardCommand("/ma ""Cure III"" <me>")
' usedMana = true
' Win32API.XUBeep 750,1000
' Sleep(500)
' Win32API.XUBeep 750,1000
' Sleep(7000)
' elseif colorDetectDefined(colorDetect(13)) and (not colorDetectCheck(colorDetect(13))) then
' waitForUser
' doKeyboardCommand("/ja ""Divine Seal"" <me>")
' Sleep(3000)
' waitForUser
' doKeyboardCommand("/ma ""Cure III"" <me>")
' usedMana = true
' Win32API.XUBeep 750,1000
' Sleep(8500)
' elseif colorDetectDefined(colorDetect(12)) and (not colorDetectCheck(colorDetect(12))) then
' ' Don't care, it's nothing big
' end if
'Keep Moving Forward
KeyDown(VirtualKey.VK_W)
Sleep(200)
KeyUp(VirtualKey.VK_W)
Sleep(300)
if (randomTurnCounter > 5) then
'If we get stuck behind a tree
TurnLeft(100)
randomTurnCounter = 0
else
randomTurnCounter = randomTurnCounter + 1
end if
currentStatus = getPlayerStatus(serviceObject)
loop
writeLogLine ("Leaving main fight loop.")
if currentStatus = statusDead then
writeLogLine ("Character has been slain, forcing pause.")
ForcePause
exit function
end if
Sleep(500)
' writeLogLine ("Resting after battle.")
' XUScriptPlugin.staStatus.Text = "Resting"
' ' Place recovery code here, for example:
' if minuteDiff(Now, lastPaeon) >= 1 then
' waitForUser
' doKeyboardCommand("/equip range ""Harp {+}1""")
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' controlledSleep(12000)
' lastPaeon = Now
' end if
' if ((not colorDetectDefined(colorDetect(13))) and Minute(Now - fightStartTime) > 1) or (colorDetectDefined(colorDetect(13)) and (not
colorDetectCheck(colorDetect(13)))) then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon III"" <me>")
' controlledSleep(30000)
' end if
' if usedMana = true then
' waitForUser
' doKeyboardCommand("/ma ""Mage's Ballad II"" <me>")
' controlledSleep(12000)
' if Minute(Now - lastPaeon) >= 1 then
' waitForUser
' doKeyboardCommand("/ma ""Army's Paeon IV"" <me>")
' controlledSleep(12000)
' end if
' end if
end if
controlledSleep(200)
writeLogLine ("Leaving fightTarget.")
end function |
The bit of code in the "fight_target.vbs" that relates to what you do after targeting and following a mob is...
| Code: |
function fightTarget
writeLogLine ("Entering fightTarget.")
' fight monster here
Dim currentAngle
Dim fightStartTime
Dim lastAttackTime
Dim currentStatus
Dim lastBuffTime
Dim usedMana
Dim lastPaeon
lastPaeon = 0
writeLogLine ("Preparing to fight monster.")
XUScriptPlugin.staStatus.Text = "Preparing to fight monster"
doKeyboardCommand("/follow")
' currentStatus = getPlayerStatus(serviceObject)
' do while currentStatus = statusNone
' Sleep(500)
' currentStatus = getPlayerStatus(serviceObject)
' writeLogLine("Current Status is: " & currentStatus)
' loop
currentStatus = getPlayerStatus(serviceObject)
writeLogLine ("Trying to fight!")
XUScriptPlugin.staStatus.Text = "Trying to fight"
lastAttackTime = Now
do while ((Second(Now - lastAttackTime) < 20) and (currentStatus <> statusFighting))
waitForUser
XUScriptPlugin.staStatus.Text = "Wait for User"
sleep(6000)
doKeyboardCommand("/ja Provoke <t>")
sleep(500)
doKeyboardCommand("/a <t>")
sleep(3000)
pressKey(VirtualKey.VK_A)
sleep(300)
pressKey(VirtualKey.VK_D)
sleep(2000)
doKeyboardCommand("/wa Raging Axe <t>")
sleep(500)
currentStatus = getPlayerStatus(serviceObject) |
hunter.vbs
| Code: |
' Include libraries
XUScriptPlugin.staStatus.Text = "Loading libraries... (hunter functions)"
XUScriptHost.ImportScript("xuhunt\hunter_functions.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (common)"
XUScriptHost.ImportScript("xuhunt\common.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (fight target)"
XUScriptHost.ImportScript("xuhunt\fight_target.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (navigator)"
XUScriptHost.ImportScript("xuhunt\navigator.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (utils)"
XUScriptHost.ImportScript("xuhunt\utils.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (playerstatus)"
XUScriptHost.ImportScript("xuhunt\playerstatus.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (monster)"
XUScriptHost.ImportScript("xuhunt\monster.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (target)"
XUScriptHost.ImportScript("xuhunt\target.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries... (synth)"
XUScriptHost.ImportScript("xuhunt\synth.vbs")
XUScriptPlugin.staStatus.Text = "Loading libraries done."
'Variables
Dim scriptTime
Dim scriptPaused
scriptPaused = false
Dim scriptRunning
Dim WeakTargetRegExp
set WeakTargetRegExp = New RegExp 'No EXP... not worth your trouble!
WeakTargetRegExp.Pattern = "seems too weak to be worthwhile."
WeakTargetRegExp.IgnoreCase = False
WeakTargetRegExp.Global = True
Dim EasyPreyRegExp
set EasyPreyRegExp = New RegExp 'This is a good target to hunt, but slow!
EasyPreyRegExp.Pattern = "seems like easy prey."
EasyPreyRegExp.IgnoreCase = False
EasyPreyRegExp.Global = True
Dim DecentTargetRegExp
set DecentTargetRegExp = New RegExp 'This is a good target to hunt!
DecentTargetRegExp.Pattern = "like a decent challenge."
DecentTargetRegExp.IgnoreCase = False
DecentTargetRegExp.Global = True
Dim EvenMatchRegExp
set EvenMatchRegExp = New RegExp 'This is a good target to hunt!
EvenMatchRegExp.Pattern = "like an even match."
EvenMatchRegExp.IgnoreCase = False
EvenMatchRegExp.Global = True
Dim SeemsToughRegExp
set SeemsToughRegExp = New RegExp
SeemsToughRegExp.Pattern = "seems tough."
SeemsToughRegExp.IgnoreCase = False
SeemsToughRegExp.Global = True
function checkTargetMacro
KeyDown(checkTarget_macroShift)
pressKey(checkTarget_macro)
KeyUp(checkTarget_macroShift)
Sleep(4000)
end function
function nextTargetMacro
pressKey(nextTarget_macro)
end function
'This is called at every "idle" time that the script is not actully doing something.
function controlledSleep(sleepTime)
Dim currentSleepTime
currentSleepTime = 0
do while sleepTime >= currentSleepTime
Sleep 200
currentSleepTime = currentSleepTime + 200
loop
end function
' Script start, don't touch this either
function runHunter
XUScriptPlugin.staStatus.Text = "Loading FFXIService..."
on error resume next
set serviceObject = XUScriptPlugin.GetService("FFXiService.Service")
if Err.number <> 0 then
' FFXIService didn't load
XUScriptPlugin.staStatus.Text = "FFXIService failed to load"
Sleep 5000
else
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("xuhunt\stats.vbs")
openStatsWindow
end if
scriptRunning = true
'Variables used
Dim currentStatus, lastStatus
dim currentTarget
Dim lastMacroTime
Dim text
Dim regexpMatch
'What stage are we in for hunting?
Dim bLookingForTarget
bLookingForTarget = true
Dim bCheckingTarget
bCheckingTarget = false
dim bFoundWeakTarget
bFoundWeakTarget = false
dim bFoundEasyPrey
bFoundEasyPrey = false
Dim bFoundDecentTarget
bFoundDecentTarget = false
Dim bFoundEvenMatch
bFoundEvenMatch = false
Dim bFoundToughTarget
bFoundToughTarget = false
Dim numberOfTurns
numberOfTurns = 0
Dim currentPatrolPoint
currentPatrolPoint = 0
Dim currentKillsInPatrol
currentKillsInPatrol = 1000
'Init the variables
lastMacroTime = -1
currentStatus = -1
scriptTime = Now
'This is used for healing elsewhere.
startingHealth = getPlayerHealth(serviceObject)
' Generate change event in case the user wants to do something before hunting
onScriptBegin
writeLogLine ("Script now running...")
'doKeyboardCommand("/cm p")
XUScriptPlugin.staStatus.Text = "Let the hunt begin!"
do while scriptRunning ' Main Loop
text = "Hunting (" & (scriptTimeInterval - minuteDiff(Now, scriptTime)) & " minutes until interval!)"
if XUScriptPlugin.staStatus.Text <> text then
XUScriptPlugin.staStatus.Text = text
end if
' Sleep so script can be closed with F12
controlledSleep(200)
lastStatus = currentStatus
currentStatus = getPlayerStatus(serviceObject)
'TODO Lots of status check here!
select case currentStatus
case statusNone
if (bLookingForTarget) then
writeLogLine ("Targeting...")
nextTargetMacro
currentTarget = getTargetIndex(serviceObject)
if ((currentTarget > 0) and (currentKillsInPatrol < maxKillsBeforePatrol)) then
'Con the target
writeLogLine ("Checking target: " & currentTarget)
checkTargetMacro
bLookingForTarget = false
bCheckingTarget = true
else
if ((numberOfTurns < maxTurnsForTarget) and (currentKillsInPatrol < maxKillsBeforePatrol)) then
writeLogLine ("Keep looking for mobs at this patrol point.")
numberOfTurns = numberOfTurns + 1
Dim currentAngle
currentAngle = serviceObject.PlayerHeading
if (currentAngle < 339) then
currentAngle = currentAngle + 20
else
currentAngle = 0
end if
'Turn in a different direction so we can try and find a target
faceDirection serviceObject, currentAngle
else
writeLogLine ("Proceeding to next patrol point.")
numberOfTurns = 0
currentKillsInPatrol = 0
if (UBound(PatrolArea) > 0) then
'Navigate to next point
navigateCheckpoint serviceObject, win_posx, win_posy, PatrolArea, currentPatrolPoint
currentPatrolPoint = currentPatrolPoint + 1
if (currentPatrolPoint >= UBound(PatrolArea)) then
currentPatrolPoint = 0
end if
end if
end if
bCheckingTarget = false
end if
elseif (bCheckingTarget) then
writeLogLine ("Checking...")
'Turn off the previous state
bLookingForTarget = false
elseif (bFoundWeakTarget and bAllowWeakTargets) then
bFoundWeakTarget = false
writeLogLine ("Found Easy Prey...")
'Turn off the previous state
bCheckingTarget = false
'Fight the target
fightTarget
restToHeal
currentKillsInPatrol = currentKillsInPatrol + 1
bLookingForTarget = true
elseif (bFoundEasyPrey and bAllowEasyTargets) then
bFoundEasyPrey = false
writeLogLine ("Found Easy Prey...")
'Turn off the previous state
bCheckingTarget = false
'Fight the target
fightTarget
restToHeal
currentKillsInPatrol = currentKillsInPatrol + 1
bLookingForTarget = true
elseif (bFoundEvenMatch and bAllowEvenTargets) then
bFoundEvenMatch = false
writeLogLine ("Found Even Match...")
'Turn off the previous state
bCheckingTarget = false
'Fight the target
fightTarget
restToHeal
currentKillsInPatrol = currentKillsInPatrol + 1
bLookingForTarget = true
elseif (bFoundDecentTarget and bAllowDecentTargets) then
bFoundDecentTarget = false
writeLogLine ("Found Decent Target...")
'Turn off the previous state
bCheckingTarget = false
'Fight the target
fightTarget
restToHeal
currentKillsInPatrol = currentKillsInPatrol + 1
bLookingForTarget = true
elseif (bFoundToughTarget and bAllowToughTargets ) then
bFoundToughTarget = false
writeLogLine ("Found Tough Target...")
'Turn off the previous state
bCheckingTarget = false
'Fight the target
fightTarget
restToHeal
currentKillsInPatrol = currentKillsInPatrol + 1
bLookingForTarget = true
else
'Something went wrong, so lets start over.
bLookingForTarget = true
bCheckingTarget = false
'Other Commands
writeLogLine ("Waiting for input...")
end if
case else
writeLogLine ("Unknown status code: " & currentStatus)
end select
'Check the log file for updates and set variables accordingly
do while true
Dim regexpFound
Dim count, fish
Dim i
Dim handled
regexpFound = false
text = readLogLine
if text = "" then
exit do
end if
'If we need to con this target
if (bCheckingTarget) then
' Look for "seems like easy prey."
if not regexpFound then
set regexpMatch = WeakTargetRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Found an Easy Prey!")
bFoundWeakTarget = true
bCheckingTarget = false
end if
end if
' Look for "seems like easy prey."
if not regexpFound then
set regexpMatch = EasyPreyRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Found an Easy Prey!")
bFoundEasyPrey = true
bCheckingTarget = false
end if
end if
' Look for "like a decent challenge."
if not regexpFound then
set regexpMatch = DecentTargetRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Found a Decent Target!")
bFoundDecentTarget = true
bCheckingTarget = false
end if
end if
' Look for "like a even match."
if not regexpFound then
set regexpMatch = EvenMatchRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Found a Even Target!")
bFoundEvenMatch = true
bCheckingTarget = false
end if
end if
' Look for "seems tough."
if not regexpFound then
set regexpMatch = SeemsToughRegExp.Execute(text)
if regexpMatch.Count > 0 then
regexpFound = true
writeLogLine ("Found a Tough Target!")
bFoundToughTarget = true
bCheckingTarget = false
end if
end if
'Catch other matches here for target checks
end if
'TODO, search for level up message, and reset startingHealth
'Clean up before we go on
set regexpMatch = nothing
loop
loop
end if
if useStatistics then
closeStatsWindow
end if
set serviceObject = Nothing
set WeakTargetRegExp = Nothing
set EasyPreyRegExp = Nothing
set DecentTargetRegExp = Nothing
set EvenMatchRegExp = Nothing
set SeemsToughRegExp = Nothing
end function
XUScriptPlugin.staStatus.Text = "Done parsing fisher.vbs!" |
navigator.vbs
| Code: |
' Array elements: Type, X, Y, Z, RunTime
' Type list: 0: stop running, 1: run, 2: run and zone, 3: run toward checkpoint for a set amount of time (param RunTime)
' Sample script start point is outside the "House of the Hero" at G-4 in Windurst Walls
' The script will run to the mog house in Windurst Woods
Dim zone_black_posx
Dim zone_black_posy
Dim max_waitZoneColor
Dim max_waitZoning
Dim waitAfterZone
zone_black_posx = 300 ' X pos on the screen where to look for the black color
zone_black_posy = 300 ' Y pos on the screen where to look for the black color
zone_black_color = 0 ' The actual color to check for, 0 = total black
max_waitZoneColor = 120000 ' How long to wait for screen to turn black
max_waitZoning = 120000 ' How long to wait for screen to turn "not black"
waitAfterZone = 7000 ' How long to wait once the char has zoned
function RunForward
KeyDown(VirtualKey.VK_W)
Sleep 100
end function
function StopRunning
KeyUp(VirtualKey.VK_W)
end function
function TurnLeft(time)
KeyDown(VirtualKey.VK_A)
Sleep time
KeyUp(VirtualKey.VK_A)
end function
function TurnRight(time)
KeyDown(VirtualKey.VK_D)
Sleep time
KeyUp(VirtualKey.VK_D)
end function
function waitForZoning
Dim waitTime
' wait for screen to turn black
XUScriptPlugin.staStatus.Text = "Waiting for screen to turn black..."
XUScriptHost.WaitForPixelColor (win_posx+zone_black_posx), (win_posy+zone_black_posy), zone_black_color, max_waitZoneColor
StopRunning
' wait for screen to turn not black ;)
waitTime = 0
XUScriptPlugin.staStatus.Text = "Waiting for screen to turn not black..."
do while (XUScriptHost.GetPixelColor((win_posx+zone_black_posx), (win_posy+zone_black_posy)) = zone_black_color) and (waitTime <
max_waitZoning)
Sleep 100
waitTime = waitTime + 100
loop
' wait preset time for char to be able to move
XUScriptPlugin.staStatus.Text = "Sleeping predefined time..."
Sleep waitAfterZone
end function
function FindHeading (byval x1, byval y1, byval x2, byval y2)
dim x, y, angle, pi
pi = 3.141592
x = (x1 - x2)
y = (y1 - y2)
if x = 0 then
if y < 0 then
angle = 90
else
angle = -90
end if
else
angle = ((Atn(y/x) / pi) * 180)
if x > 0 then
angle = (angle + 180)
end if
end if
angle = ((360-Int(angle))+90) mod 360
FindHeading = angle
end function
function angleDiff(a, b)
Dim temp
temp = a - b
if temp > 180 then
temp = temp - 360
end if
if temp < -180 then
temp = 360 + temp
end if
angleDiff = temp
end function
function distDiff(a, b)
distDiff = Abs(a - b)
end function
function faceDirection(oFFXIService, angle)
KeyDown(VirtualKey.VK_D)
Sleep(400)
KeyUp(VirtualKey.VK_D)
sleep(600)
end function
function faceExactDirection(oFFXIService, angle)
Dim angle_diff, current_angle
angle = (angle + 360) mod 360
do
on error resume next
oFFXIService.UpdateData
if Err.Number = 0 then
on error goto 0
current_angle = CInt(oFFXIService.PlayerHeading)
angle_diff = angleDiff(angle, current_angle)
if angle_diff < 0 then
if angle_diff < -5 then
XUScriptPlugin.staStatus.Text = " L "
TurnLeft(75)
if angle_diff < -60 then
TurnLeft(75)
TurnLeft(75)
TurnLeft(75)
end if
else
TurnLeft(20)
end if
elseif angle_diff > 0 then
if angle_diff > 5 then
XUScriptPlugin.staStatus.Text = " R "
TurnRight(75)
if angle_diff > 60 then
TurnRight(75)
TurnRight(75)
TurnRight(75)
end if
else
TurnRight(25)
end if
end if
else
XUScriptPlugin.staStatus.Text = " ? "
angle_diff = 200
Sleep 50
end if
Sleep 20
loop until angle_diff = 0
end function
function navigateCheckpoints(oFFXIService, winx, winy, checkpoints)
XUScriptPlugin.staStatus.Text = "navigateCheckpoints"
Dim checkpoint, running, angle, newangle, angle_diff
Dim current_x, current_y, target_x, target_y
Dim i, j, k, check_type, runTime
running = false
j = 0
for each checkpoint in checkpoints
j = j + 1
check_type = checkpoint(0)
if check_type = 0 then
StopRunning
running = false
else
target_x = checkpoint(1)
target_y = checkpoint(2)
runTime = checkpoint(4)
i = 0
do
'on error resume next
oFFXIService.UpdateData
if Err.Number = 0 then
on error goto 0
angle = CInt(oFFXIService.PlayerHeading)
current_x = FormatNumber(oFFXIService.PlayerX,0)
current_y = FormatNumber(oFFXIService.PlayerY,0)
newangle = FindHeading(current_x, current_y, target_x, target_y)
angle_diff = angleDiff(newangle, angle)
if (Abs(angle_diff) >= 90) or ((check_type = 3) and (i = 0)) then
if running then
StopRunning
running = false
end if
end if
if angle_diff < -5 then
XUScriptPlugin.staStatus.Text = j & " L, ang:" & FormatNumber(angle, 0) & ", new: " &
FormatNumber(newangle, 0) & ", diff: " & FormatNumber(angle_diff, 0)
'XUScriptPlugin.staStatus.Text = j & " L: " & FormatNumber(angle, 0) & ", " & FormatNumber(newangle,
0) & ", " & FormatNumber(angle_diff, 0) & ", " & FormatNumber(current_x, 0) & ", " & FormatNumber(current_y, 0) & ", " & FormatNumber(target_x, 0) &
", " & FormatNumber(target_y, 0) & ", " & FormatNumber(current_x - target_x, 0) & ", " & FormatNumber(current_y - target_y, 0)
if angle_diff > -10 then
TurnLeft(50)
else
TurnLeft(100)
if angle_diff < -20 then
TurnLeft(100)
end if
if angle_diff < -40 then
TurnLeft(100)
end if
if angle_diff < -60 then
TurnLeft(100)
end if
if angle_diff < -60 then
TurnLeft(100)
end if
end if
elseif angle_diff > 5 then
XUScriptPlugin.staStatus.Text = j & " R, ang:" & FormatNumber(angle, 0) & ", new: " &
FormatNumber(newangle, 0) & ", diff: " & FormatNumber(angle_diff, 0)
'XUScriptPlugin.staStatus.Text = j & " R: " & FormatNumber(angle, 0) & ", " & FormatNumber(newangle,
0) & ", " & FormatNumber(angle_diff, 0) & ", " & FormatNumber(current_x, 0) & ", " & FormatNumber(current_y, 0) & ", " & FormatNumber(target_x, 0) &
", " & FormatNumber(target_y, 0) & ", " & FormatNumber(current_x - target_x, 0) & ", " & FormatNumber(current_y - target_y, 0)
if angle_diff < 10 then
TurnRight(50)
else
TurnRight(100)
if angle_diff > 20 then
TurnRight(100)
end if
if angle_diff > 40 then
TurnRight(100)
end if
if angle_diff > 60 then
TurnRight(100)
end if
if angle_diff > 80 then
TurnRight(100)
end if
end if
else
XUScriptPlugin.staStatus.Text = j & " S, ang:" & FormatNumber(angle, 0) & ", new: " &
FormatNumber(newangle, 0) & ", diff: " & FormatNumber(angle_diff, 0)
'XUScriptPlugin.staStatus.Text = j & " S: " & FormatNumber(angle, 0) & ", " & FormatNumber(newangle,
0) & ", " & FormatNumber(angle_diff, 0) & ", " & FormatNumber(current_x, 0) & ", " & FormatNumber(current_y, 0) & ", " & FormatNumber(target_x, 0) &
", " & FormatNumber(target_y, 0) & ", " & FormatNumber(current_x - target_x, 0) & ", " & FormatNumber(current_y - target_y, 0)
if not running then
RunForward
running = true
end if
if check_type = 2 then
XUScriptPlugin.staStatus.Text = "Waiting to zone over..."
waitForZoning
XUScriptPlugin.staStatus.Text = "Zoning done!"
running = false
on error goto 0
exit do
elseif check_type = 3 then
RunForward
running = true
k = 0
do while (k <= runTime)
k = k + 100
Sleep 100
loop
end if
Sleep 100
end if
else
XUScriptPlugin.staStatus.Text = "Failed to update with error: " & Err.Description
end if
on error goto 0
' Must have this sleep here or the script can't be stopped with the Stop button or F12
Sleep 10
i = i + 1
loop until (distDiff(current_x, target_x) <= 4) and (distDiff(current_y, target_y) <= 4)
end if
next
StopRunning
end function
function navigateCheckpoint(oFFXIService, winx, winy, checkpoints, point)
'Go from here to the next point identified by point (index in array)
XUScriptPlugin.staStatus.Text = "navigateCheckpoint"
Dim checkpoint, running, angle, newangle, angle_diff
Dim current_x, current_y, target_x, target_y
Dim old_x, old_y
Dim i, j, k, check_type, runTime
running = false
j = 0
if (point > UBound(checkpoints)) then
'ErrorMessage
XUScriptPlugin.staStatus.Text = "Checkpoint out of bounds!"
writeLogLine("ERROR: Checkpoint " & point & " is out of bounds")
else
checkpoint = checkpoints(point)
j = j + 1
check_type = checkpoint(0)
if check_type = 0 then
StopRunning
running = false
else
target_x = checkpoint(1)
target_y = checkpoint(2)
runTime = checkpoint(4)
i = 0
do
'on error resume next
oFFXIService.UpdateData
if Err.Number = 0 then
on error goto 0
angle = CInt(oFFXIService.PlayerHeading)
current_x = FormatNumber(oFFXIService.PlayerX,0)
current_y = FormatNumber(oFFXIService.PlayerY,0)
newangle = FindHeading(current_x, current_y, target_x, target_y)
angle_diff = angleDiff(newangle, angle)
if (Abs(angle_diff) >= 90) or ((check_type = 3) and (i = 0)) then
if running then
StopRunning
running = false
end if
end if
if angle_diff < -5 then
XUScriptPlugin.staStatus.Text = j & " L, ang:" & FormatNumber(angle, 0) & ", new: " &
FormatNumber(newangle, 0) & ", diff: " & FormatNumber(angle_diff, 0)
'XUScriptPlugin.staStatus.Text = j & " L: " & FormatNumber(angle, 0) & ", " & FormatNumber(newangle,
0) & ", " & FormatNumber(angle_diff, 0) & ", " & FormatNumber(current_x, 0) & ", " & FormatNumber(current_y, 0) & ", " & FormatNumber(target_x, 0) &
", " & FormatNumber(target_y, 0) & ", " & FormatNumber(current_x - target_x, 0) & ", " & FormatNumber(current_y - target_y, 0)
if angle_diff > -10 then
TurnLeft(50)
else
TurnLeft(100)
if angle_diff < -20 then
TurnLeft(100)
end if
if angle_diff < -40 then
TurnLeft(100)
end if
if angle_diff < -60 then
TurnLeft(100)
end if
if angle_diff < -60 then
TurnLeft(100)
end if
end if
elseif angle_diff > 5 then
XUScriptPlugin.staStatus.Text = j & " R, ang:" & FormatNumber(angle, 0) & ", new: " &
FormatNumber(newangle, 0) & ", diff: " & FormatNumber(angle_diff, 0)
'XUScriptPlugin.staStatus.Text = j & " R: " & FormatNumber(angle, 0) & ", " & FormatNumber(newangle,
0) & ", " & FormatNumber(angle_diff, 0) & ", " & FormatNumber(current_x, 0) & ", " & FormatNumber(current_y, 0) & ", " & FormatNumber(target_x, 0) &
", " & FormatNumber(target_y, 0) & ", " & FormatNumber(current_x - target_x, 0) & ", " & FormatNumber(current_y - target_y, 0)
if angle_diff < 10 then
TurnRight(50)
else
TurnRight(100)
if angle_diff > 20 then
TurnRight(100)
end if
if angle_diff > 40 then
TurnRight(100)
end if
if angle_diff > 60 then
TurnRight(100)
end if
if angle_diff > 80 then
TurnRight(100)
end if
end if
else
XUScriptPlugin.staStatus.Text = j & " S, ang:" & FormatNumber(angle, 0) & ", new: " &
FormatNumber(newangle, 0) & ", diff: " & FormatNumber(angle_diff, 0)
'XUScriptPlugin.staStatus.Text = j & " S: " & FormatNumber(angle, 0) & ", " & FormatNumber(newangle,
0) & ", " & FormatNumber(angle_diff, 0) & ", " & FormatNumber(current_x, 0) & ", " & FormatNumber(current_y, 0) & ", " & FormatNumber(target_x, 0) &
", " & FormatNumber(target_y, 0) & ", " & FormatNumber(current_x - target_x, 0) & ", " & FormatNumber(current_y - target_y, 0)
if not running then
RunForward
running = true
end if
'Check to make sure we are not behind a tree, random turn
if (old_x = current_x and old_y = current_y) then TurnLeft(100)
old_x = current_x
old_y = current_y
if check_type = 2 then
XUScriptPlugin.staStatus.Text = "Waiting to zone over..."
waitForZoning
XUScriptPlugin.staStatus.Text = "Zoning done!"
running = false
on error goto 0
exit do
elseif check_type = 3 then
RunForward
running = true
k = 0
do while (k <= runTime)
k = k + 100
Sleep 100
loop
end if
Sleep 100
end if
else
XUScriptPlugin.staStatus.Text = "Failed to update with error: " & Err.Description
end if
on error goto 0
' Must have this sleep here or the script can't be stopped with the Stop button or F12
Sleep 10
i = i + 1
loop until (distDiff(current_x, target_x) <= 4) and (distDiff(current_y, target_y) <= 4)
end if
end if
StopRunning
end function |
Good Luck!
*fixed typo in fight_target
Last edited by skylr616 on Wed Oct 20, 2004 5:05 am; edited 3 times in total
|
|
Back to top
|
|
 |
lancerx
In Training

Premium Member
Joined: 14 Oct 2004 Posts: 18 0 TUBucks
|
Posted: Wed Oct 20, 2004 4:29 am Post subject:
Re: XUHunter Custom (No Nav Point) |
|
thanks for sharing with us less understanding folks
|
|
Back to top
|
|
 |
detoxifide
Script Kiddy
Regular Member
Joined: 23 Nov 2004 Posts: 2 0 TUBucks
|
Posted: Fri Jun 10, 2005 7:48 am Post subject:
Re: XUHunter Custom (w/out nav points) |
|
Ok I may be totally inept but, what does this do exactly, in terms a stoned 18 year old male can understand?
|
|
Back to top
|
|
 |
no_grip
Lifetime Member (Scripting)

Premium Member
Joined: 04 Jan 2005 Posts: 173 26 TUBucks
|
Posted: Fri Jun 10, 2005 5:06 pm Post subject:
Re: XUHunter Custom (w/out nav points) |
|
it kicks the snizzle out of mizzobs fizzor you.
|
|
Back to top
|
|
 |
fireaga_zen
In Training

Regular Member
Joined: 12 May 2005 Posts: 39 0 TUBucks
|
Posted: Thu Jul 07, 2005 4:22 am Post subject:
|
|
Bwahahaha, it means get a job, and say "I Love Minimum Wage!"
|
|
Back to top
|
|
 |
carrion21
In Advanced Training

Regular Member
Joined: 01 May 2004 Posts: 78 57 TUBucks
|
Posted: Sun Jul 24, 2005 5:10 pm Post subject:
|
|
Does anyone know this script well enough to give me a outline on how to set it up to kill placeholders in one map square, while looking for NM to pop?
|
|
Back to top
|
|
 |
jimifan684
In Training

Regular Member
Joined: 19 Jan 2006 Posts: 14 3 TUBucks
|
Posted: Sun Jan 22, 2006 8:43 pm Post subject:
|
|
i know that a script but how do i get those to work with XU, like how do i set it up im confused
|
|
Back to top
|
|
 |
benoist
In Training

Regular Member
Joined: 21 Mar 2006 Posts: 17 18 TUBucks
|
Posted: Wed Mar 22, 2006 7:57 pm Post subject:
|
|
all new to me where do i put scripts there r 2 folders under unleashed folder? Figured out how to get Norton Antivirus to let it run but it doesen't load all the way
|
|
Back to top
|
|
 |
skittza
Script Kiddy
Regular Member
Joined: 06 Apr 2005 Posts: 1 1 TUBucks
|
Posted: Mon Sep 04, 2006 8:35 pm Post subject:
|
|
Is this script working for anyone else? I can't seem to get it to work and I just wanted to see if it was working for other people so I knew if I was doing something wrong or not.
thanks
|
|
Back to top
|
|
 |
fourth81
Script Kiddy
Regular Member
Joined: 12 Jun 2007 Posts: 2 2 TUBucks
|
Posted: Fri Jun 15, 2007 3:20 am Post subject:
|
|
This may be a really stupid question, but looking at that script does nothing for me. Are there files available to download that load into XUnleashed? Or...what else can I do with these scripts listed?
|
|
Back to top
|
|
 |
xrythx
Script Kiddy
Regular Member
Joined: 19 Aug 2006 Posts: 6 5 TUBucks
|
Posted: Wed Feb 06, 2008 5:25 pm Post subject:
|
|
this is old.
|
|
Back to top
|
|
 |
Tault_admin
Admin

Regular Member
Joined: 09 Nov 2002 Posts: 26927 31984 TUBucks
|
Posted: Wed Feb 06, 2008 7:45 pm Post subject:
|
|
locked
_________________

|
|
Back to top
|
|
 |
|
|
 |