Background tasks
Background tasks
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.
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.
Re: Background tasks
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:
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
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

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
Re: Background tasks
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
Thanks
Re: Background tasks
Actually those are ms
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.
Code: Select all
-- Converts seconds to timer value
function secondsToTimer(seconds)
return math.floor( seconds * 1000 );
end
Jack-of-all-trades, but master-of-only of a few
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

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
Re: Background tasks
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
Re: Background tasks
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
Re: Background tasks
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

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Background tasks
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
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
Re: Background tasks
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
Re: Background tasks
Yeh I did that after I got the registerTimer working 

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
Re: Background tasks
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.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.
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
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
Re: Background tasks
yeah checking if you have the buff first is a good idea.
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.
Code: Select all
RoMCode('for i=1,100 do n,_,_,id=UnitBuff("player",i) if id==500675 then CancelPlayerBuff(i) break end end;')
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

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Background tasks
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
Re: Background tasks
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.
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
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

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
Re: Background tasks
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 ^.^
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 ^.^
Who is online
Users browsing this forum: No registered users and 1 guest