Fly over Waypoint with no Stop

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Fly over Waypoint with no Stop

#1 Post by BlubBlab » Mon Jan 07, 2013 4:46 pm

Like I promised I searched deeper for solution. I found out that in the past someone seems to tried it already.
I work with Rock´s RC3 so I found "WP_NO_STOP" in the player.lua on the bottom of "moveTo".

Wasn't declared so I had to add it in Setting.lua that I changed:

player.lua:
Bottom of moveTo

Code: Select all


if (settings.profile.options.WP_NO_STOP ~= false) then
		if (dontStopAtEnd ~= true) --[[or (settings.profile.options.QUICK_TURN == false)]] then
			keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
		end
		
	else
		keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
	end
So it will work even it has no quick-turn on

bot.lua:
When a point Is reached it would be nice he didn't need to stop for code execution my solution
about Line 909

Code: Select all


					-- Execute it's action, if it has one.
					if (settings.profile.options.WP_NO_STOP ~= false) then
						if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
							local actionchunk = loadstring(wp.Action);
							assert( actionchunk,  sprintf(language[150], __RPL.CurrentWaypoint) );
							local co = coroutine.create(function () actionchunk(); end);
							coroutine.resume(co);
						end
					else
						if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
							keyboardRelease( settings.hotkeys.MOVE_FORWARD.key ); yrest(200) -- Stop moving
							local actionchunk = loadstring(wp.Action);
							assert( actionchunk,  sprintf(language[150], __RPL.CurrentWaypoint) );
							actionchunk();
						end
					end
				else
					__WPL:advance();
				
					-- Execute it's action, if it has one.
					if (settings.profile.options.WP_NO_STOP ~= false) then
						if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
							local actionchunk = loadstring(wp.Action);
							assert( actionchunk,  sprintf(language[150], __WPL.CurrentWaypoint) );
							local co = coroutine.create(function () actionchunk(); end);
							coroutine.resume(co);
						end
					else
						if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
							keyboardRelease( settings.hotkeys.MOVE_FORWARD.key ); yrest(200) -- Stop moving
							local actionchunk = loadstring(wp.Action);
							assert( actionchunk,  sprintf(language[150], __WPL.CurrentWaypoint) );
							actionchunk();
						end
					end
				end
This has its limit you can't load a new file or make "GoThroughPortal" or leave the instance(by end of the file) but changing profile or inviate a other player/bot seems to be okay

By the way this thing works the bot run much less like a puppet and is a littel bit faster too, but this isnt finished I still need to add something in the waypoint tags, because at the moment I need turn off the feature one waypoint befor so I need:

Code: Select all

<waypoint x="4340" z="1026" y="679" WP_NO_STOP="false" >	</waypoint>
to stop it befor execute the code and "moveTo".
also need a Zone to setup the point easier , because hitting the wall is very likly if you run this in Quick-Turn off so the bot needs may turn sooner, so I may pass to moveTo a extra buffer for the position that would be make setup old WP easier.

Code: Select all

<waypoint x="4340" z="1026" y="679" WP_NO_STOP="true" WP_ZONE="20" >	</waypoint>
Last edited by BlubBlab on Wed Jan 09, 2013 9:56 am, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#2 Post by rock5 » Mon Jan 07, 2013 11:52 pm

If QUICK_TURN is off then it has to stop to turn or you will get too much unpredictable behaviour. We could probably have it keep moving if the angle is small, say less than 45 degrees. But if it's more than that it would have to stop. But to tell you the truth, I recommend using QUICK_TURN. I think it looks less bottish.
BlubBlab wrote:

Code: Select all

<waypoint x="4340" z="1026" y="679" WP_NO_STOP="false" >   </waypoint>
I thought of this before as a good way of bypassing the stopping for code but have never implemented it. It is needed.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Fly over Waypoint with no Stop

#3 Post by lisa » Tue Jan 08, 2013 12:49 am

you can simply add any code at the waypoint and the bot stops to do the code, no matter what it is.

Code: Select all

<waypoint x="4340" z="1026" y="679" > local stop = true  </waypoint>
the code itself means nothing but the bot will stop to do it.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#4 Post by BlubBlab » Tue Jan 08, 2013 1:23 am

Lisa take a closer look at the code that I posted my bot wouldn't stop ....I tested it. The code will run in an extra coroutine until I say otherwiese.( what isnt need but I like it that way)

Rock 45 degrees? I tested it with 90 degree and it worked O.O, but yes it is very random how the bot acts but its seems very Human this way, but also true 100 or more is better with Quick_Turn true even a human would turn this way.

Code: Select all

local wp = nil; local wpnum = nil; local nostopoption = nil;local zoneoption = nil;

			if( player.Returning ) then
				wp = __RPL:getNextWaypoint();
				wpnum = __RPL.CurrentWaypoint;
				cprintf(cli.green, language[13], wpnum, wp.X, wp.Z);	-- Moving to returnpath waypoint
			else
				wp = __WPL:getNextWaypoint();
				wpnum = __WPL.CurrentWaypoint;
				cprintf(cli.green, language[6], wpnum, wp.X, wp.Z);	-- Moving to waypoint
			end;

			player.Current_waypoint_type = wp.Type;		-- remember current waypoint type
			
			nostopoption = wp.WP_NO_STOP;
			if( nostopoption ~= nil) then
				changeProfileOption("WP_NO_STOP", nostopoption);
			end
			zoneoption = wp.WP_ZONE;
			if( zoneoption == nil)then
				zoneoption = 0;
			end
			local success, reason = player:moveTo(wp,nil,true,nil,zoneoption);

			player:updateMounted()
			if not player.Mounted then
				player:checkPotions();
				player:checkSkills( ONLY_FRIENDLY );	-- only cast hot spells to ourselfe
			end
			if( success ) then
				-- if we stick directly at a wp the counter would reseted even if we are sticked
				-- hence we reset the counter only after 3 successfull waypoints
				player.Success_waypoints = player.Success_waypoints + 1;
				if( player.Success_waypoints > 3 ) then
					player.Unstick_counter = 0;	-- reset unstick counter
				end;

				if( player.Returning ) then
					-- Completed. Return to normal waypoints.
					if( __RPL.CurrentWaypoint >= #__RPL.Waypoints ) then
						__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X, player.Z, player.Y));
						if( __WPL.Mode == "wander" ) then
							__WPL.OrigX = player.X;
							__WPL.OrigZ = player.Z;
						end
						player.Returning = false;
						cprintf(cli.yellow, language[7]);

					else
						__RPL:advance();
					end

					-- Execute it's action, if it has one.
					if (settings.profile.options.WP_NO_STOP ~= false) then
						if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
							local actionchunk = loadstring(wp.Action);
							assert( actionchunk,  sprintf(language[150], __RPL.CurrentWaypoint) );
							local co = coroutine.create(function () actionchunk(); end);
							coroutine.resume(co);
						end
					else
						if( wp.Action and type(wp.Action) == "string" and string.find(wp.Action,"%a") ) then
							keyboardRelease( settings.hotkeys.MOVE_FORWARD.key ); yrest(200) -- Stop moving
							local actionchunk = loadstring(wp.Action);
							assert( actionchunk,  sprintf(language[150], __RPL.CurrentWaypoint) );
							actionchunk();
						end
					end

Code: Select all

function CPlayer:moveTo(waypoint, ignoreCycleTargets, dontStopAtEnd, range, zone)

	local function passed_point(lastpos, point)
		point.X = tonumber(point.X)
		point.Z = tonumber(point.Z)

		local posbuffer = 10 + zone;
I done some work but I have still some error the bot dont stop at the end of the waypoint list he want to go to the first again, but the Setting changed befor he reached the last WP

Code: Select all

	
Code:
<waypoint x="4340" z="1026" y="679" WP_NO_STOP="false" >   </waypoint>
I will continue tomorrow
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#5 Post by BlubBlab » Tue Jan 08, 2013 8:49 pm

I modified already for the purpose both Waypoint and Waypointlist

I did finde out that:

Code: Select all

	local nostopoption  = wp.WP_NO_STOP;
returns always nil;
But I don't see where the probleme is, perhaps is there a master plate for the xml ?
Attachments
waypointlist.lua
(11.67 KiB) Downloaded 143 times
waypoint.lua
(1009 Bytes) Downloaded 141 times
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#6 Post by rock5 » Tue Jan 08, 2013 11:22 pm

Looking at your code it looks like wp.WP_NO_STOP will only be "true" or nil. If you want it to save a false value then you need to change this line

Code: Select all

if ( wpstop ) then tmp.WP_NO_STOP = wpstop; end;
to something like

Code: Select all

if ( wpstop ~= nil) then tmp.WP_NO_STOP = wpstop; end;
If you want to make sure they don't use invalid value then you would have to do

Code: Select all

if ( wpstop == true or wpstop == false ) then tmp.WP_NO_STOP = wpstop; end;
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#7 Post by BlubBlab » Tue Jan 08, 2013 11:38 pm

Yeah that was it I found in the time you wrote it myself :D
I'm finished it.
For the purpose that I can run into the Portal I added one thing more WP_NO_COROUTINE.
The bot will not stop but this way I can call GoThroughPortal with out running 2te "MoveTo", what will result in big problems.

Code: Select all

<waypoint x="-18576" z="12399" WP_NO_COROUTINE="true" > -- In front of KS
You could write a whole freed about what is better WP_NO_COROUTINE true or false?

I added the post all the changes I did
By the way there some other changes that I made in the post ignore it^^

You need only stop now when needed at the end of a waypoint file in KS on the WP where you leave and at the NPC
Attachments
WPNOSTOP.zip
(55.18 KiB) Downloaded 151 times
Last edited by BlubBlab on Wed Jan 09, 2013 9:55 am, edited 1 time in total.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
lolita
Posts: 139
Joined: Thu Oct 20, 2011 5:39 am
Location: Serbia

Re: Fly over Waypoint with no Stop

#8 Post by lolita » Wed Jan 09, 2013 6:09 am

you have error in bot.lua

Code: Select all

scripts\rc3/bot.lua:282: attempt to call global 'getGameVersion' (a nil value)]]
i gues you have that "getGameVersion" function somewhere, but i dont :P.
i just deleted that line, and it work so far.
Life is a journey, not destination :D

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#9 Post by rock5 » Wed Jan 09, 2013 8:40 am

He mentioned that he was using RC3. getGameVersion is in RC3.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#10 Post by BlubBlab » Sat Jan 12, 2013 1:22 pm

Yeah you are right rock^^

I have wrote an update because when you running in Quick_Turn false mode with WP_NO_STOP you may haven't enough space to unstick your bot. With this the bot will leave WP_NO_STOP until he unstick.

But I have a ask Rock why does the bot wait when he is finish looting until the mob disappeared?
I mean if you have multiple targets to loot the bot jumps to one by one with out pause but when he is at the last one and he loot it after it he make a break. (it does it at any version)

I have made sure that he didn't need any thing calculate besides go to the next WP todo on my personal higly experimental version but it does it still making the break.
Didn't finde the clou in the code until now.
Attachments
WBNOSTOP1.1.zip
(74.63 KiB) Downloaded 135 times
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#11 Post by rock5 » Sat Jan 12, 2013 2:29 pm

BlubBlab wrote:But I have a ask Rock why does the bot wait when he is finish looting until the mob disappeared?
I noticed something like that when using RBAssist in an older version. It was because it thought it had aggro because the dead mob still had the player targeted. But it is fixed in RC3. I'm not aware of it still doing that.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#12 Post by BlubBlab » Sun Jan 13, 2013 2:14 am

Okay I found the real reason 1the was a small bug in my bot the other is the Game<-> bot the Game delete the mob only after 2-3 sec in its memory as workaround I but them on the IgnoreList and clear the Target due this the bots "LootAgain" will not work right anymore.

Code: Select all


			while target.Lootable == true and self.Stance == 0 and deltaTime(getTime(), startWait) < maxWaitTime do
				self:updateActualSpeed()
				if self.ActualSpeed == 0 then Attack() yrest(100) end
				yrest(100)
				target:updateLootable()
				self:updateStance()
			end

			-- Wait for character to finish standing
		--	local starttime = os.clock()
		--	self:updateStance()
			--[[while self.Stance ~= 0 and 0.5 > (os.clock() - starttime) do
				yrest(50)
				--self:updateStance()
			end]]--
				lootIgnoreListPos = lootIgnoreListPos + 1
				if lootIgnoreListPos > settings.profile.options.LOOT_IGNORE_LIST_SIZE then lootIgnoreListPos = 1 end
				lootIgnoreList[lootIgnoreListPos] = target.Address
				self:clearTarget();
What I need would be a "IgnoreTagetfor4sec List" I will implement this when I find time or someone else do it.
I can only tell my bot is now fast as a human being with speedhack even faster^^
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#13 Post by BlubBlab » Wed Jan 16, 2013 4:37 pm

rock5 wrote:
BlubBlab wrote:But I have a ask Rock why does the bot wait when he is finish looting until the mob disappeared?
I noticed something like that when using RBAssist in an older version. It was because it thought it had aggro because the dead mob still had the player targeted. But it is fixed in RC3. I'm not aware of it still doing that.
It's more like the propleme mentioned here : http://www.solarstrike.net/phpBB3/viewt ... n+Teleport
(Okay I should may run update.lua)
I did found this because I had the same idear mentioned in it so I did.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#14 Post by rock5 » Thu Jan 17, 2013 3:13 am

RC3 definitely doesn't wait for mobs to clear. It must be something else.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#15 Post by BlubBlab » Fri Jan 18, 2013 1:27 pm

Okay I got it now the probleme is I don't wait until the bot stand up completely by that I create some errors sometimes but on the other hand I'm faster with this 0.5 until 1.0 sec.
Maybe the bot targeting the pawn lay bevor it or targeting another pawn and can't move the true is I don't know but I have an idear I will use a coroutine with some vars as flag and supress the errors.(yes dirty I will report if that work)
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#16 Post by BlubBlab » Mon Jan 28, 2013 5:19 pm

Okay first I forgot it, it works^^

Somebody asked me to post an update how far I came.
Explanatory notes(new and old Options):

Code: Select all

changeProfileOption("WP_NO_STOP",true);
--or
<waypoint x="-16684" z="11339" y="155"   WP_NO_STOP="true"></waypoint> 
Activates that the bot will not stop running until he find WP_NO_STOP="false" he skipping the WP and run it code, you can run it in a coroutine(I set it to false default now) if needed for that you can use:

Code: Select all

--false means COROUTINE on and true means  COROUTINE off
<waypoint x="-18576" z="12399" WP_NO_COROUTINE="false"  type="TRAVEL"></waypoint> 
--or
 changeProfileOption("WP_NO_COROUTINE", false);
This makes a WP in a Waypoint Zone easy or?

Code: Select all

<waypoint x="-18296" z="11064"  WP_ZONE="30" type="TRAVEL" ></waypoint>
NEW onBagFull Event I trigger a event when my Bag is Full, I was tired of waiting until onLeaveCombat trigger.

Code: Select all

<onBagFull>
	RoMScript("LeaveParty()"); 
	 waitForLoadingScreen();
	loadPaths("ks-res-to-pancer");
	
</onBagFull>
NEW TELE-FLY-LOOT/ATTACK
You need the Swimhack and the Teleport userfunction if not the bot will ignore it the settings, to loot I go flying and teleport to the mob/pawn then this way it ist much faster, I wasn't the fist who had this idear http://www.solarstrike.net/phpBB3/viewt ... T&start=20.
But I have added teleport to came in attack range, for that I did some math ^-^

Code: Select all

changeProfileOption("FLYLOOT", true);
NEW Something what don't work(perfect) until now, I tried the re targeting so I find the "Mean" one in a group of Mob/Pawns
Available are : CLOSEST, MEAN, FURTHEST, DEFAULT:CLOSEST

Code: Select all

changeProfileOption("ATTACK_MODE", "MEAN");
NEW there was something not right(or I don't know) with the code form bot.lua there is a part which skip a WP in front of the bot but to be more correct it skipped everything in range only the left front quarter not If my math is correct and I hope it is.
I totally altered the way it works for degree use WAYPOINT_DEG_SET available numbers a 0 to 90, the bot will check the front and the back in that degree when start fighting mobs/pawns
DEFAULT: 15

Code: Select all

	changeProfileOption("WAYPOINT_PASS", 150); -- range
	changeProfileOption("WAYPOINT_DEG_SET", 45); -- degree
Attachments
WPNOSTOP1.2.zip
(76.27 KiB) Downloaded 159 times
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: Fly over Waypoint with no Stop

#17 Post by Ego95 » Sat Feb 16, 2013 6:23 pm

Tryed your bot changes but get an error :(

Code: Select all

0:21am - ...s Rom Bot/micromacro/scripts/rom2/classes/player.lua:92: attempt to
perform arithmetic on field 'Class3' (a nil value)
AlterEgo95

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#18 Post by rock5 » Sun Feb 17, 2013 3:58 am

That was for an older version of the bot. It probably wont work with the current version.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Fly over Waypoint with no Stop

#19 Post by BlubBlab » Sat Nov 23, 2013 8:44 am

yeah rock5 was right back than.

Here is something new I use since a few months I was able to solve the bugs
I. If the distance between 2 waypoints is too short the bot stops now for changing the angle .
II. If the second waypoint is behind the first the bot stops now for changing the angle .

I was also able to solve any overcontrol probleme through less yrest times and using MM 1.03 beta 1.

I did change additional to that the way quickturn = false behave, It now simulate rotating the char with the camera like before it does but only to a point and then simulate a click in front of you. I tried to model it the way I play the game I also added some randomization to it so that it will also look a bit different each time, but that a only ably on when you are on foot, on a mount the bot will move like a car.

Code: Select all

function CPlayer:moveTo(waypoint, ignoreCycleTargets, dontStopAtEnd, range, zone)

	if settings.profile.options.PARTYLEADER_WAIT and GetPartyMemberName(1) then
		if not checkparty(150) then
			releaseKeys()
			repeat yrest(500) self:updateBattling() until checkparty(150) or self.Battling
		end
	end
	if(zone == nil) then  zone = 0; end;

	local function passed_point(lastpos, point)
		point.X = tonumber(point.X)
		point.Z = tonumber(point.Z)

		local posbuffer = 20 + zone;

		local passed = true
		if lastpos.X < point.X and self.X < point.X - posbuffer then
			return false
		end
		if lastpos.X > point.X and self.X > point.X + posbuffer then
			return false
		end
		if lastpos.Z < point.Z and self.Z < point.Z - posbuffer then
			return false
		end
		if lastpos.Z > point.Z and self.Z > point.Z + posbuffer then
			return false
		end

		return true
	end

	self:updateXYZ();

	local angle = math.atan2(waypoint.Z - self.Z, waypoint.X - self.X);
	local yangle = 0
	if waypoint.Y ~= nil then
		yangle = math.atan2(waypoint.Y - self.Y, ((waypoint.X - self.X)^2 + (waypoint.Z - self.Z)^2)^.5 );
	end
	self:updateDirection()
	local angleDif = angleDifference(angle, self.Direction);
	local startTime = os.time();
	ignoreTargets = ignoreTargets or false;

	if( ignoreCycleTargets == nil ) then
		ignoreCycleTargets = false;
	end;
	local distNextWP = distance(self.X, self.Z, self.Y, waypoint.X, waypoint.Z, waypoint.Y);
	
	if (settings.profile.options.WP_NO_STOP == true and player.Mounted and (distNextWP <= 80 or angleDif >= math.rad(135) )) then
		if (dontStopAtEnd == true) then
			keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
		end
	end
	
	if( waypoint.Type == WPT_TRAVEL or waypoint.Type == WPT_RUN ) then
		if( settings.profile.options.DEBUG_TARGET ) then
			cprintf(cli.yellow, "[DEBUG] waypoint type RUN or TRAVEL. We don't target mobs.\n");
		end
		ignoreCycleTargets = true;	-- don't target mobs
	end;

	-- Make sure we don't have a garbage (dead) target
	self:updateTargetPtr()
	if( self.TargetPtr ~= 0 ) then
		local target = CPawn.new(self.TargetPtr)
		if target:exists() then -- Target exists
			target:updateHP()
			if( target.HP <= 1 ) then
				self:clearTarget();
			end
		end
	end

	-- no active turning and moving if wander and radius = 0
	-- self direction has values from 0 til Pi and -Pi til 0
	-- angle has values from 0 til 2*Pi
	if(__WPL:getMode()   == "wander"  and
	   __WPL:getRadius() == 0     )   then
	   	self:restrnd(100, 1, 4);	-- wait 3 sec

		self:updateDirection()
		angle = self.Direction

		-- we will not move back to WP if wander and radius = 0
		-- so one can move the character manual and use the bot only as fight support
		-- there we set the WP to the actual player position
		self:updateXYZ()
		waypoint.Z = self.Z;
		waypoint.X = self.X;

	end;

	-- QUICK_TURN only
	if( settings.profile.options.QUICK_TURN == true ) then
		self:faceDirection(angle, yangle);
		camera:setRotation(angle);
		angleDif = angleDifference(angle, self.Direction);
	else
		self:faceDirection(self.Direction, yangle); -- change only 'Y' angle with 'faceDirection'.
	end
	if( settings.profile.options.QUICK_TURN == false and not player.Mounted) then
		angleDif2 = angleDifference(angle, self.Direction);
		if(angleDif2 < math.rad(65 + math.random(-5,5)) and angleDif2 > math.rad(15)  ) then
			self:faceDirection(angle, yangle);
			camera:setRotation(angle);
			self:updateDirection()
			angleDif = angleDifference(angle, self.Direction);
		end
	end 
	-- If more than X degrees off, correct before moving.
	local rotateStartTime = os.time();
	local turningDir = -1; -- 0 = left, 1 = right
	local randomAngle = math.rad(65 + math.random(-5,5));
	while( angleDif > math.rad(65) ) do
		self:updateHP()
		self:updateAlive()
		if( self.HP < 1 or self.Alive == false ) then
			return false, WF_NONE;
		end;
		if( (angleDif <  randomAngle and angleDif >  math.rad(20)) and not player.Mounted ) then
				self:faceDirection(angle, yangle);
				camera:setRotation(angle);			
		end
		if( os.difftime(os.time(), rotateStartTime) > 3.0 ) then
			-- Sometimes both left and right rotate get stuck down.
			-- Press them both to make sure they are fully released.
			keyboardPress(settings.hotkeys.ROTATE_LEFT.key);
			keyboardPress(settings.hotkeys.ROTATE_RIGHT.key);

			-- we seem to have been distracted, take a step back.
			keyboardPress(settings.hotkeys.MOVE_BACKWARD.key);
			rotateStartTime = os.time();
		end

		if( angleDifference(angle, self.Direction + 0.01) < angleDif ) then
			-- rotate left
			keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
			keyboardHold( settings.hotkeys.ROTATE_LEFT.key );

			--self:faceDirection( angle );
		else
			-- rotate right
			keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
			keyboardHold( settings.hotkeys.ROTATE_RIGHT.key );

			--self:faceDirection( angle );
		end

		yrest(50);
		self:updateDirection();
		angleDif = angleDifference(angle, self.Direction);
	end

	keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
	keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
	self:updateXYZ()
	-- look for a target before start movig
	self:updateBattling()
	if((not self.Fighting) and (not ignoreCycleTargets)) then
		if self:target(self:findEnemy(false, nil, evalTargetDefault, self.IgnoreTarget)) then	-- find a new target
			cprintf(cli.turquoise, language[86]);	-- stopping waypoint::target acquired before moving
			success = false;
			failreason = WF_TARGET;
			return success, failreason;
		end;
	end;

	-- Direction ok, start moving forward
	local success, failreason = true, WF_NONE;
	local dist = distance(self.X, self.Z, self.Y, waypoint.X, waypoint.Z, waypoint.Y);
	local lastDist = dist;
	local lastpos = {X=self.X, Z=self.Z, Y=self.Y}
	self.LastDistImprove = os.time();	-- global, because we reset it whil skill use

	local turning = false

	local loopstart
	local loopduration = 100 -- The duration we want the loop to take
	local successdist = 10
	repeat
		player:checkAddress()
		loopstart = os.time()

		dist = distance(self.X, self.Z, self.Y, waypoint.X, waypoint.Z, waypoint.Y);
		angle = math.atan2(waypoint.Z - self.Z, waypoint.X - self.X);

		self:updateHP()
		self:updateAlive()
		if( self.HP < 1 or self.Alive == false ) then
			return false, WF_NONE;
		end;

		-- stop moving if aggro, bot will stand and wait until to get the target from the client
	 	-- only if not in the fight stuff coding (means self.Fighting == false )
		self:updateBattling()
		self:updateXYZ()
	 	if( self.Battling and 				-- we have aggro
	 	    self.Fighting == false  and		-- we are not coming from the fight routines (bec. as melee we should move in fight)
			waypoint.Type ~= WPT_TRAVEL ) then	-- only stop if not waypoint type TRAVEL
			if self:target(self:findEnemy(true, nil, evalTargetDefault)) then
				keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
				keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
				keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
				success = false;
				failreason = WF_COMBAT;
				break;
			end
		end;
		self:updateXYZ()
		-- look for a new target while moving
		if((not ignoreCycleTargets) and (not self.Fighting)) then
			if self:target(self:findEnemy(false, nil, evalTargetDefault, self.IgnoreTarget)) then
				cprintf(cli.turquoise, language[28]);	-- stopping waypoint::target acquired
				success = false;
				failreason = WF_TARGET;
				break;
			end;
		end

		-- We're still making progress
		if( dist < lastDist ) then
			self.LastDistImprove = os.time();
			lastDist = dist;
			lastpos = {X=self.X, Z=self.Z, Y=self.Y}
		elseif(  dist > lastDist + 40 ) then
			-- Check if pulled back before last waypoint
			local lastwp = __WPL:getNextWaypoint(-1)
			if (lastwp.X ~= 0 or lastwp.Z ~= 0 or lastwp.Y ~= nil) and distance(player, lastpos) > distance(lastwp, lastpos) then
				print("Was pulled back. Reseting waypoint.")
				success = false
				failreason = WF_PULLBACK
			else
				-- Make sure we didn't pass it up
				printf(language[29]);
				success = false;
				failreason = WF_DIST;
			end
			break;
		end;

		if( os.difftime(os.time(), self.LastDistImprove) > 3 ) then
			-- We haven't improved for 3 seconds, assume stuck
			success = false;
			failreason = WF_STUCK;
			break;
		end

		-- while moving without target: check potions / friendly skills
		self:updateMounted()
		if not self.Mounted and ( self:checkPotions() or self:checkSkills(ONLY_FRIENDLY) ) then	-- only cast friendly spells to ourselfe
			-- If we used a potion or a skill, reset our last dist improvement
			-- to prevent unsticking
			self.LastDistImprove = os.time();

			-- Wait for casting to finish if still casting last skill
			self:updateCasting()
			while self.Casting do
				yrest(50)
				self:updateCasting()
			end

		end

		-- Check if within range if range specified
		if range and range > dist then
			-- within range
			break
		end

		-- Check if past waypoint
		if passed_point(lastpos, waypoint) then
		   -- waypoint reached
		   break
		end

		-- Check if close to waypoint.
		if dist < successdist then
			break
		end

		if waypoint.Y ~= nil then
			yangle = math.atan2(waypoint.Y - self.Y, ((waypoint.X - self.X)^2 + (waypoint.Z - self.Z)^2)^.5 );
		end
		self:updateDirection()
		angleDif = angleDifference(angle, self.Direction);

		yrest(1) -- This is to fix a bug that causes the bot to continue moving forward after it has been paused.
	
		-- Continue to make sure we're facing the right direction
		if( settings.profile.options.QUICK_TURN and angleDif > math.rad(1) ) then
			self:updateDirection()
			angle = math.atan2(waypoint.Z - self.Z, waypoint.X - self.X);
			self:faceDirection(angle, yangle);
			camera:setRotation(angle);
			angleDif = angleDifference(angle, self.Direction);
			keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
		else
			self:faceDirection(self.Direction, yangle); -- change only 'Y' angle with 'faceDirection'.
			if( (angleDif <  randomAngle and angleDif >  math.rad(20)) and not player.Mounted ) then
				camera:setRotation(angle);
				self:faceDirection(angle, yangle);
			end
			self:updateDirection()
			angle = math.atan2(waypoint.Z - self.Z, waypoint.X - self.X);
			angleDif = angleDifference(angle, self.Direction);
			if( angleDif > math.rad(15) ) then
				--keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
				--keyboardRelease( settings.hotkeys.MOVE_BACKWARD.key );

				if( angleDifference(angle, self.Direction + 0.01) < angleDif ) then
						keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
						keyboardHold( settings.hotkeys.ROTATE_LEFT.key );
						yrest(50);
				else
						keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
						keyboardHold( settings.hotkeys.ROTATE_RIGHT.key );
						yrest(50);
				end
				turning = true
			elseif( angleDif > math.rad(1) ) then
				if( settings.profile.options.QUICK_TURN ) then
					camera:setRotation(angle);
				end

				self:faceDirection(angle, yangle);
				keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
				keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
				keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
				turning = false
			else
				keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
			end
		end

		--keyboardHold( settings.hotkeys.MOVE_FORWARD.key );
		local pausetime = loopduration - (os.time() - loopstart) -- minus the time already elapsed.
		if pausetime < 1 then pausetime = 1 end
		yrest(pausetime);
		self:updateXYZ()
		waypoint:update();
	
	until false
	--cprintf(cli.green,"We are in moveTo  \n ");
	if (settings.profile.options.WP_NO_STOP ~= false) then
		--cprintf(cli.green,"WP_NO_STOP = true \n ");
		if (dontStopAtEnd ~= true) --[[or (settings.profile.options.QUICK_TURN == false)]] then
			
			keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
		end
		
	else
		--cprintf(cli.green,"WP_NO_STOP = false \n ");
		keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
	end

	keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
	keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );

	return success, failreason;
end

Their is/was also a drop out/drop in of the mode when stuck in bot.lua, it will/would take some time until I made a integration in the common romBot but perhaps rock find some time since all problems are solved this time.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Fly over Waypoint with no Stop

#20 Post by rock5 » Sat Nov 23, 2013 10:41 am

I'm not sure I understand everything this changes but I don't think I would make it part of the bot. The bot is better being accurate than more human. You could always post it as a userfunction that would overwrite the bots moveto but then it would have to be updated whenever the bots moveto got changed.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 10 guests