|
 Harvest Bot : EverQuest 2 Premium Discussions - Page 9
|
|
Posted: February 25th, 2005, 12:41 am
|
|
|
|
blueknight
Total Posts: 136
Location: So Cal.
Joined: January 24th, 2005, 2:06 pm
blueknight's Reps: 2
|
yeah, I was more refering to running into walls or under a bridge. I let it try for a while (60 sec or longer) and it seemed to not resolve itself. I think the simplest solution would be to make a set of player defined locs that it will not travel outside of. Maybe that could be an alternative to wandering distance (maybe use a click boxed flag to decide wether to use loc definition or wander distance).
But I have to say, I am continually impressed by the quality of your work. Thanks!
|
|
|
|
|
Posted: February 25th, 2005, 9:04 am
|
|
|
|
zippoman
zippoman's Reps:
|
I like the idea of player defined LOCs. Personally, I'd rather it had my guy run back to my starting point than a "random spot near origin". Often it picks a place inside a tree, or another unreachable destination.
|
|
|
|
|
Posted: February 25th, 2005, 1:32 pm
|
|
|
|
wyvernx
Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
|
zippoman, then just customize your script. Remove the random offsets and it will take you to where you want it to go.
_________________
Use Search first, ask questions later!
|
|
|
|
|
Posted: February 27th, 2005, 8:15 pm
|
|
|
|
barl55
barl55's Reps:
|
The problem with the stuck code is that its too precise, it checks if you're in precisely the same spot. Often with a harvest script you're jumping around very small amounts (stuck against a wall).
I changed it so it checks within 0.18 of old coords (+/- 0.09) and it seems to work better. I also added a reverse before the turns/jumping and a forward afterwards (so it won't turn back into the same spot.
Line 513 Navigator.vbs
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))): if if (old_x > current_x-0.09 and old_y > current_y-0.09 and old_y < current_y +0.09 and old_x < current_x+0.09) then RunBackward() sleep 1000 StopRunningBackward() TurnLeft(800) RunForward() sleep 1000
Jump(200) StopRunning() numberRandomTurnsAllowed = numberRandomTurnsAllowed - 1
Last edited by Guest on February 27th, 2005, 8:26 pm, edited 1 time in total.
|
|
|
|
|
Posted: February 27th, 2005, 8:18 pm
|
|
|
|
wyvernx
Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
|
You would probably want to put the jump before the StopRunning. The whole point of the jump was to try to get over small obsticles like rocks, etc that you may be up against.
_________________
Use Search first, ask questions later!
|
|
|
|
|
Posted: February 27th, 2005, 8:26 pm
|
|
|
|
barl55
barl55's Reps:
|
Good point, I've altered my values a bit, it was getting into an infinite loop with itself. Post is corrected above
|
|
|
|
|
Posted: February 28th, 2005, 12:48 pm
|
|
|
|
zippoman
zippoman's Reps:
|
Awesome job, modified code works great.
There's only one problem that I have noticed while harvesting. Sometimes a node will be inside a tree and when tried to harvest you get the message "too far away" or something like that. Anyway to add some code that would somehow add this node to an "ignore" list? I notice that my harvest bot will sit at the same bugged node forever if I don't move it.
If anyone gets a chance to add this, or can give me some tips on where I can add some code, please let me know. Thanks 
|
|
|
|
|
Posted: February 28th, 2005, 1:36 pm
|
|
|
|
wyvernx
Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
|
If it is in a tree and you can target it, you should be able to harvest it.
Right?
_________________
Use Search first, ask questions later!
|
|
|
|
|
Posted: February 28th, 2005, 1:51 pm
|
|
|
|
zippoman
zippoman's Reps:
|
wyvernx";p="56955 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))): If it is in a tree and you can target it, you should be able to harvest it.
Right?
Nope. The node isn't totally INSIDE the tree, it'll be next to a tree so it's targetable but cannot be harvested.
I've seen this on more than one occassion in Feerott, only way I can get around it is to delete the array for that node name in the VBS file since I know in 5 minutes it'll just be stuck in the bugged node again.
|
|
|
|
|
Posted: February 28th, 2005, 3:36 pm
|
|
|
|
barl55
barl55's Reps:
|
Some things in EQ2 are targettable but not gatherable, it happens quite often with ? in dungeons.
This might work:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))): 'EQ2Harvest Bot. version 1.1 'By WyvernX ' Install Instructions '1. You MUST install the EQ2Service plugin. Get it from the downloads on the web page. '2. Configure your data below 'Various Varying Variables Dim oServiceObject, File, temp, FTarget, TargetID Dim ResourceIndex, SpawnID, Resources, MobName, ResourceName, NothingClose Dim ClosestResourceDist, ClosestSpawnID, CurrentResourceDist Dim HarvestCounter, MaxHarvests, MaxWanderDistance, NumAttempts, MaxAttempts Dim bQuitOnMaxHarvests, WanderDistance, bIgnoreWanderDistanceIfResourceFound Dim BadSpawnArray, NumberOfBadSpawns Dim RX, RY, PX, PY, RH, PH, IX, IY, ClosestSpawnRX, ClosestSpawnRY 'Resource, Player, Initial X and Y values XUScriptHost.ImportScript "MessageBoxLibrary.vbl" Dim MessageBoxSample Set MessageBoxSample = New MessageBoxClass
'Notes: If using patrol route, use a tight/small WanderDistance. If using wander method, use a larger one. Just remember you will wander any where in a square - distance away from the origin!!! bIgnoreWanderDistanceIfResourceFound = true 'If a resource is outside of our wander area, harvest it anyway. (This could cause to you to move FAR away from home point!) WanderDistance = 200 'How far the char is allowed to wander around MaxWanderDistance = 300 'How far to stray away from starting point (if bIgnoreWanderDistanceIfResourceFound is true) MaxHarvests = 10000 'Will attempt to harvest MaxHarvests times. bQuitOnMaxHarvets = false 'Log out after MaxHarvests is reached. MaxAttempts=5 'Max number of tries to gather
'Resources to look for. Syntax: HOTKEY, ResourceName 'Notice, last array has no trailing comma! Resources = array( _ array("1", "cloven ore"), _ array("1", "wind swept rock"), _ array("2", "armadillo den"), _ array("3", "desert roots"), _ array("4", "wind felled tree") _ ) ClosestResources = array( _ array("0", "NULL") _ )
'//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// ' DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!!! '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '//////////////////////////////////////////////////////////////////////////// '////////////////////////////////////////////////////////////////////////////
'Set the Log file for our output if necessary logFilename = GetXUnleashedDirectory() + "\Scripts\EQ2Test.txt" 'debug log file
'Simple Log writing 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
function WithinRoamArea() 'Check Distance if (bIgnoreWanderDistanceIfResourceFound = true) then if (distDiff(IX,RX) < MaxWanderDistance AND distDiff(IY,RY) < MaxWanderDistance) then WithinRoamArea = true else WithinRoamArea = false end if else if (distDiff(IX,RX) < WanderDistance AND distDiff(IY,RY) < WanderDistance) then WithinRoamArea = true else WithinRoamArea = false end if end if end function
sub HandleNoResourcesNearby writeLogLine("No Resources in this area. Taking a nap!") for s = 1 to 30 XUScriptPlugin.staStatus.Text = "No Resources nearby. Sleeping " & 30 - s sleep 100 'Sleep for 30 seconds. next XUScriptPlugin.staStatus.Text = "Going to random spot near origin" for b = LBound(BadSpawnArray) to UBound(BadSpawnArray) BadSpawnArray(b)=0 next NavigateXY oServiceObject, IX - WanderDistance + Random(0,WanderDistance * 2), IY - WanderDistance + Random(0,WanderDistance * 2) end sub
sub HandleBadResource() 'This will take us back to "near" our starting point. writeLogLine("HandleBadResource Called. Avoid that resource node.") XUScriptPlugin.staStatus.Text = "Bad Resource/Target! Avoiding it for now. . ." 'NavigateXY oServiceObject, IX - WanderDistance + Random(0,WanderDistance * 2), IY - WanderDistance + Random(0,WanderDistance * 2) BadSpawnArray(NumberOfBadSpawns) = SpawnID NumberOfBadSpawns = NumberOfBadSpawns + 1 end sub
'How to find Resources. 'Note, it looks for preference items (lower index in the array) first. 'Might customize this later to look for nearest resources first. sub FindResource() NothingClose = "TRUE" ClosestResourceDist = 9999 writeLogLine("Finding Resource...") XUScriptPlugin.staStatus.Text = "Looking. . ." for i = LBound(Resources) to UBound(Resources) SpawnID = findNearestMob(oServiceObject,Resources(i)(1)) for b = LBound(BadSpawnArray) to UBound(BadSpawnArray) if (BadSpawnArray(b) = SpawnID) then writeLogLine("Avoiding this resource, we couldnt get it last time!") SpawnID = findNextNearestMob(oServiceObject) if (SpawnID < 0) then 'No more of that type of resource! exit for end if end if next if (SpawnID > -1) then '****************************MODIFIED*************************** ResourceIndex = i writeLogLine("Found Something...") RX = getMobX(oServiceObject,SpawnID) RY = getMobY(oServiceObject,SpawnID) PX = getPlayerX(oServiceObject) PY = getPlayerY(oServiceObject) if (WithinRoamArea) then writeLogLine("Woot! Found a " & Resources(i)(1)) XUScriptPlugin.staStatus.Text = "Found " & Resources(i)(1) if distDiff(IX,RX) > distDiff(IY,RY) then CurrentResourceDist = distDiff(IY,RY) 'The goto & harvesting functions will now reference the 'ClosestOLDSTRINGNAME' version of the 'variables as they should always point to the closest resource in the array. if ClosestResourceDist > CurrentResourceDist then ClosestResourceDist = CurrentResourceDist ClosestSpawnRX = RX ClosestSpawnRY = RY ClosestResources(0)(0) = Resources(i)(0) ClosestResources(0)(1) = Resources(i)(1) ClosestSpawnID = SpawnID end if else CurrentResourceDist = distDiff(IX,RX) if ClosestResourceDist > CurrentResourceDist then ClosestResourceDist = CurrentResourceDist ClosestSpawnRX = RX ClosestSpawnRY = RY ClosestResources(0)(0) = Resources(i)(0) ClosestResources(0)(1) = Resources(i)(1) ClosestSpawnID = SpawnID end if end if NothingClose = "FALSE" else writeLogLine("Nope, too far away!") SpawnID = -1 end if end if next
if NothingClose = "TRUE" then '****************************END MODIFIED*************************** HandleNoResourcesNearby else SpawnID = ClosestSpawnID end if end sub
sub GotoResource() writeLogLine("Moving to it...") If (Index > -1) then if (ClosestSpawnRX = 0 and ClosestSpawnRY = 0) then '************* MODIFIED writeLogLine("Bad location?") XUScriptPlugin.staStatus.Text = "Skipping, bad location?" Sleep 2000 else NavigateXY oServiceObject, ClosestSpawnRX, ClosestSpawnRY '************* MODIFIED end if end if end sub
sub HarvestResource() if (ClosestSpawnID > 0) then 'Make sure we still got a target '************* MODIFIED writeLogLine("Harvesting...") XUScriptPlugin.staStatus.Text = "Harvesting. . .Only " & MaxHarvests - HarvestCounter & " more!!!" SendKeys(ClosestResources(0)(0)) '************* MODIFIED HarvestCounter = HarvestCounter + 1 'One down! sleep 5000 + Random(500,1500) 'Wait 5 seconds to harvest + a random delay of .5 to 1.5 seconds end if end sub
'Load in the helper functions writeLogLine("Loading in Library: Navigator") XUScriptPlugin.staStatus.Text = "Loading libraries... (EQ2Harvest-Navigator)" XUScriptHost.ImportScript("EQ2Harvest\navigator.vbs")
writeLogLine("Loading in Library: EQ2Service") XUScriptPlugin.staStatus.Text = "Loading libraries... (EQ2Harvest-EQ2Service)" XUScriptHost.ImportScript("EQ2Harvest\EQ2Service.vbs")
writeLogLine("Creating EQ2Service Object") XUScriptPlugin.staStatus.Text = "Loading EQ2Service..." set oServiceObject = XUScriptPlugin.GetService("EQ2Service.Service") if Err.Number <> 0 then XUScriptPlugin.staStatus.Text = "EQ2Service Failed to load!" Sleep 5000 else
writeLogLine("Doing 1 time init.") 'Any and All initialization HarvestCounter = 0 IX = getPlayerX(oServiceObject) IY = getPlayerY(oServiceObject) NumberOfBadSpawns = 0 redim BadSpawnArray(MaxHarvests)
writeLogLine("Lets do this.") 'Heart of the Script. Do while HarvestCounter < MaxHarvests FindResource if (SpawnID > 0) then Sleep 2000 GotoResource writeLogLine("Targeting Resource") SendKeys("{TAB}") 'To Target the Resource TargetID = getTargetID(oServiceObject) if (TargetID > 0) then MobName = getMobName(oServiceObject, TargetID) writeLogLine("Targeted Resource: " & MobName) end if ResourceName = ClosestResources(0)(1) '************* MODIFIED if (TargetID <> ClosestSpawnID) then '************* MODIFIED 'Try backing up a little and try again: writeLogLine("Wrong Target! Trying to back up a little...") RunBackward StopRunningBackward SendKeys("{ESCAPE}") SendKeys("{TAB}") 'To Target the Resource TargetID = getTargetId(oServiceObject) if (TargetID > 0) then MobName = getMobName(oServiceObject, TargetIndex) writeLogLine("Targeted Resource: " & MobName) end if ResourceName = ClosestResources(0)(1) '************* MODIFIED if (TargetID <> ClosestSpawnID) then '************* MODIFIED HandleBadResource writeLogLine("ARG!!! Could not target the resource!!!") end if end if TargetID = getTargetID(oServiceObject) NumAttempts=0 Do While NumAttempts < MaxAttempts if (TargetID = ClosestSpawnID) then HarvestResource '************* MODIFIED TargetID = getTargetID(oServiceObject) NumAttempts=NumAttempts+1 loop if (TargetID = ClosestSpawnID) then HandleBadResource end if sleep 200 loop
if (bQuitOnMaxHarvets = true) then SendKeys("/quit{ENTER}") end if
set File = Nothing set FTarget = Nothing set oServiceObject = Nothing end if
Main changes are: (!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))): NumAttempts=0 Do While NumAttempts < MaxAttempts if (TargetID = ClosestSpawnID) then HarvestResource '************* MODIFIED TargetID = getTargetID(oServiceObject) NumAttempts=NumAttempts+1 loop if (TargetID = ClosestSpawnID) then HandleBadResource
Last edited by Guest on February 28th, 2005, 3:44 pm, edited 1 time in total.
|
|
|
|
|
Posted: February 28th, 2005, 3:44 pm
|
|
|
|
barl55
barl55's Reps:
|
I just did some more testing on my changes to the navigate script. It doesn't stop it running into zone walls by the looks of things.
I'll have a play around with that tomorrow, there are ways to fix it I'm sure
|
|
|
|
|
Posted: February 28th, 2005, 5:43 pm
|
|
|
|
zippoman
zippoman's Reps:
|
barl55";p="56975 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))): I just did some more testing on my changes to the navigate script. It doesn't stop it running into zone walls by the looks of things.
I'll have a play around with that tomorrow, there are ways to fix it I'm sure
I haven't been having trouble running into zone walls. I edited out the "returning to random point near origin" crap and made it run back to the starting point.
In regards to not being able to harvest things that are targetable, could we make some type of timer maybe? Like if you're in the same area for more than 1 minute then it skips that node.
|
|
|
|
|
Posted: February 28th, 2005, 6:05 pm
|
|
|
|
wyvernx
Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
|
zippoman, the reason that "crap" is in there is to make it look more human. It is very detectable if a bot runs to the exact same point over and over during the course of an hour.
_________________
Use Search first, ask questions later!
|
|
|
|
|
Posted: February 28th, 2005, 10:37 pm
|
|
|
|
zippoman
zippoman's Reps:
|
wyvernx";p="56993 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))): zippoman, the reason that "crap" is in there is to make it look more human. It is very detectable if a bot runs to the exact same point over and over during the course of an hour.
Not really. If you're in an area full of nodes, you rarely return to the starting point. The reason I removed it is because 80% of the time it tried to move me into a mountian. Returning to the home point two or three times an hour is not detectable IMO because you're simply "passing through" the same spot you started.
|
|
|
|
|
Posted: February 28th, 2005, 10:39 pm
|
|
|
|
wyvernx
Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
|
each to his own.
In future versions I'll add the random offset as a variable so you can set yours to 0 (in effect no random offset from starting point).
That way both of us will be happy. 
_________________
Use Search first, ask questions later!
|
|
|
|
|
Who is online |
|
Users browsing this forum: No registered users and 90 guests |
|
|
|