Background tasks

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Background tasks

#1 Post by ZZZZZ » Thu May 29, 2014 4:04 am

Without starting a 2nd MM and running both on the 1 client, is it possible to set a function to keep repeating (constantly checking for players within memory range) while doing another such as farming mobs? Not sure if GM detect does it, never used it myself.

Currently I have it checking for players on leaveCombat, which works ok, but if it runs for a bit between mobs it takes a while before it detects them.

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

Re: Background tasks

#2 Post by BlubBlab » Thu May 29, 2014 4:39 am

Yeah basically GM detect does that, you can use a timer that runs from time to time while a yrest is called or the loop yield.
checkout here:*deleted*
Edit:AHH sry, that is what you need:

Code: Select all

	registerTimer("GMdetection", secondsToTimer(checkmemory), GMdetection);
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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Background tasks

#3 Post by ZZZZZ » Thu May 29, 2014 8:22 am

Hmm ok. Messed around with it and got it working, how often can you set it to run without causing large delays? Using 2 seconds at the moment, is 1 second the lowest you can go with this function?

Thanks

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

Re: Background tasks

#4 Post by BlubBlab » Thu May 29, 2014 9:56 am

Actually those are ms

Code: Select all

-- Converts seconds to timer value
function secondsToTimer(seconds)
	return math.floor( seconds * 1000 );
end
To say it loud, I'm not sure how the bot will behave, you may make the bot too busy with your function. I did it once with my searchGMList() function, so make sure you don't hit the wall.
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: Background tasks

#5 Post by rock5 » Thu May 29, 2014 10:10 am

The thing you have to be careful with when using timers is not to make code that takes too long like using RoMScripts. If you are reading memory it should be ok as long as you don't make the time too short. Just to clarify, to make it run every 1 second use 1000 or secondsToTimer(1).
  • 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Background tasks

#6 Post by ZZZZZ » Thu May 29, 2014 4:24 pm

Just made a simple function to hide when a player is near if you are a rogue.

Code: Select all

function ZZhideInProximity()
		local objectList = CObjectList()
		objectList:update()
		local objSize = objectList:size()

		for i = 0,objSize do
			local obj = objectList:getObject(i)
			if obj.Type == PT_PLAYER and obj.Name ~= player.Name then
				if not player:hasBuff(500675) and not player.Battling then
					player:cast("ROGUE_HIDE")
					break
				end
			end
		end
	end
	
	if player.Class1 == 3 then
		registerTimer("ZZHIDE", secondsToTimer(1), ZZhideInProximity)
	end

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

Re: Background tasks

#7 Post by lisa » Thu May 29, 2014 5:57 pm

keep in mind that the bot will keep doing what ever it was doing, so you may tell the bot to hide with the timer but the bot will be doing other things at the time, maybe fighting, maybe harvesting, maybe walking and the bot will continue to do those things.
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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Background tasks

#8 Post by ZZZZZ » Thu May 29, 2014 7:38 pm

Yeh that's what I wanted it to do. In most cases players get banned after a player reports them for botting, if you stay in hide pretty much all the time then they are less likely to see you/assume its a bot.

At first I was making it use Hide 24/7...but it was wayyy too slow lol, so I did the obj check. Takes many many hours to farm thousands of daily items for mini game alts xD

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

Re: Background tasks

#9 Post by rock5 » Thu May 29, 2014 8:43 pm

If you want to speed things up maybe you should be turning hide off if there are no players near.
  • 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Background tasks

#10 Post by ZZZZZ » Thu May 29, 2014 8:57 pm

Yeh I did that after I got the registerTimer working :D

Code: Select all

function ZZhideInProximity()
		local objectList = CObjectList()
		objectList:update()
		local objSize = objectList:size()
		local useHide = false

		for i = 0,objSize do
			local obj = objectList:getObject(i)
			if obj.Type == PT_PLAYER and obj.Name ~= player.Name then
				<!-- player:cast("ROGUE_HIDE") -->
				useHide = true
				break
			end
		end
		if useHide == true then
			if not player:hasBuff(500675) and not player.Battling then
				player:cast("ROGUE_HIDE")
			end
		else
			RoMCode('for i=1,100 do n,_,_,id=UnitBuff("player",i) if id==500675 then CancelPlayerBuff(i) break end end;')
		end
	end
	
	if player.Class1 == 3 then
		registerTimer("ZZHIDE", secondsToTimer(1), ZZhideInProximity)
	end

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

Re: Background tasks

#11 Post by rock5 » Thu May 29, 2014 9:43 pm

Have you tried using the bot to cancel the buff? There is no cancel buff function but you could do something like.

Hm... Not so easy.

Code: Select all

for i, buff in pairs(player.Buffs) do
    if buff.Name == "Hide" then
        RoMCode("CancelPlayerBuff("..i..")")
        break
    end
end
It still does 1 RoMCode so it wont be too much faster but even if you use your code you should make sure you have the buff first or it will try to remove the buff and do a RoMScript every time.

Code: Select all

if player:hasBuff("Hide") then
    RoMCode('for i=1,100 do n,_,_,id=UnitBuff("player",i) if id==500675 then CancelPlayerBuff(i) break end end;')
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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Background tasks

#12 Post by lisa » Thu May 29, 2014 10:07 pm

yeah checking if you have the buff first is a good idea.

Code: Select all

RoMCode('for i=1,100 do n,_,_,id=UnitBuff("player",i) if id==500675 then CancelPlayerBuff(i) break end end;')
with that code if you don't have the buff it will do the UniBuff function 100 times, so you could check if you have buff first or you could add in a check if id is 0 or nil (woulod need testing what it returns) because there is no buff and then break.
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Background tasks

#13 Post by rock5 » Thu May 29, 2014 11:05 pm

You're talking about the RoMCode 'for' loop? There is that, but you'll find the slowest part is doing the RoMCode in the first place. The "for 100" loop will probably run very fast. It's the RoMCode overhead that's slow. If you use player:hasBuff then that will use memory searching which is fast and then only do the RoMCode if you do have the buff. So it shouldn't do all 100 anyway.
  • 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: Background tasks

#14 Post by BlubBlab » Fri May 30, 2014 7:19 am

I wouldn't make it that complicate at all I would simple use a bit of code onleavecombat, , to hide the char.
To be true I had that idea myself but didn't do it because cl/ks farming looked much more saver, at that time.

I also wanted to add random waypoints and randomized positions to make it more human and less predictable.
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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Background tasks

#15 Post by ZZZZZ » Fri May 30, 2014 7:23 am

I did have it only checking in the onLeaveCombat, but there was still the odd times when it would get stuck for a bit trying to get to a mob it couldn't reach and would run into a wall etc until it broke combat and went for next waypoint/target.

And for something as simple as farming mobs for daily items, having a timer constantly running a function like that doesn't seem to cause any extra delays/lag at all, not to mention it'll probably put you into hide before a real player even loads you on their screen, which is even better ^.^

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest