Last edited by slacky; 05-30-2016 at 08:04 PM.
!No priv. messages please
No, the order is correct. The idea is simply that it should never wait longer than 60ms, if the peroson who hooked onMoveEvent also added a wait, or did a lot of processing (going beyond 60ms) then we should not wait more than 1ms.
Currently it's only waiting 1ms (at best) for the normal cases, which is a big oops, and in the case of negative numbers it waits for A LONG time, because using Min :P
Simba Code:start := GetTimeRunning() + 60; // time plus 60ms
<user inserts whatever code> // takes unknown amount of time
Wait( Max(1, start-GetTimeRunning())); // wait at most 60ms from when timer started, and at min 1ms.
If I just changed the order of subtraction it would go negative for all the cases when onMoveEvent doesn't take up 60ms or more. That would really go to hell.
Last edited by slacky; 05-30-2016 at 08:33 PM.
!No priv. messages please
Hey Slacky,
i've been lurking on this for a while and u seem very knowledgable about opencv..
Im making my own rs bot to learn how to code, and have been learning opencv this week.
Ive managed to succesfully detect my minimap pos using matchtemplate, but have alot of difficulties finding things on the mainscreen specifically sand crabs, as there is too much rotation etc involved.
Do you think this is doable with opencv?or should i just scan for pixel colors and do some sort of clustering based on that.
Would love some input!
thx
Obviously I'm not slacky, but you may be able to find the sand crabs based on color separation. I haven't actually went and looked at the sand crabs yet, but if they are like the rock crabs they probably have darker shading around the bottom (and possibly one side) for the rounding of the model. I'd guess that that coloring is probably relatively unique compared to the rest of the sand in the area, so you may be able to locate them based on that.
Basically, the color at the bottom of the sand crab, once converted from RGB color to HSV, will have a lower V than the surrounding sand since it's shaded darker. If you can find a good threshold, I would think you could probably find the crab.
It may be a little bit tricky though, because the shading sometimes isn't very apparent at every compass angle and you'd have to ensure the area of shading is big enough to not detect little rounded sandy pebbles that I'm sure they probably placed on the beach. In my head this idea sounds reasonable, although I'm not 100% confident it would work well enough to be practical, but like I said, I'm not slacky and I haven't used opencv for a little while, so my opinion very well might not carry any weight.
If you did want to try to find them based on color separation, this link may be a good place to look at for reference:
http://opencv-srf.blogspot.ro/2010/0...eperation.html
And even if it doesn't work out, never hurts to learn new things!
Also, maybe I'm wrong, but it may be best to create a new thread if you wanted to have a discussion on this just so this thread doesn't get caught up in a discussion that isn't entirely on the topic of the original post.
Last edited by Polar Xpress; 06-01-2016 at 07:36 PM.
Thanks alot for the answer. ill go try it out now!
And yeah ur right i should probably create my own thread..initially i just wanted to pm slacky but i am not allowed to pm yet .
This is very cool, great you share the code! Much respect!
This is amazing!
I just have one problem that I can't seem to fix or figure out why. I have two areas, a dark/underground area and a light green area in a custom map. When I run my script for 4h+, they'll be a point where .getMyPos will return a pos that is completely off and cause my bot to die. For example, if I am in the underground area, it will say I am in the above ground area.
- The map is large and takes in account fort the non-walkable area.
- I've also set minmatch to around 0.8 and logged for incorrect positions.
I'm still unable to figure out what's wrong? Any idea? Thanks!
Does your map include the underground area? it might cause some bad matches due to the border between normal level and underground
Feel free to ask me any questions, I will do my best to answer them!
Previously known as YouPee.
Hi all,
I am trying to get this working on a script, but every time I run the script, I get this error:
Simba Code:Error: Exception ('TRSPosFinder.UpdateAddr: Unable to locate bitmap') at line 231
I have tried using the Walker include that is built into Aerolib and downloading the walker from this thread, both with the same result.
Any ideas on what could be triggering it?
Sample map below:
Simba Code:program WalkerExample;
{$DEFINE WALKER}
{$i AeroLib/AeroLib.Simba}
procedure w_ClickMouse(box:TBox; btn:Int32); override;
begin
MouseBox(box, btn); //call a click-mousefunction from the include you use
end;
var
RSW:TRSWalker;
path:TPointArray;
begin
initAL;
RSW.Init('WorldMap');
WriteLn('RSW is setup!');
WriteLn(RSW._GetPos());
RSW.Free();
end.
I also tried pasting the example script from the first post into Simba with the same result.
Are you on linux, or any other OS than windows?
I don't think memoryscanning will work on any of those, atleast not yet.
Also try loading "YourMapName.png" instead of "YourMapName"
Feel free to ask me any questions, I will do my best to answer them!
Previously known as YouPee.
Stop using _GetPos and check what PID rswalker is targeting.
Edit: and make sure you selected the client since you're not using SMART
Last edited by Harrier; 12-21-2016 at 01:28 PM.
#slack4admin2016
<slacky> I will build a wall
<slacky> I will ban reflection and OGL hooking until we know what the hell is going on
Tried WorldMap and WorldMap.png on both the Aerolib and stand alone include with the same result.
I am running Windows 7 64bit.
I was actually using GetMyPos() with the same result. The script up there is the last attempt, and I thought I would try something else.
I have also ensured the client is selected in all of my tests.
Could external factors have something to do with this?
I am running it from my office at work, but the network has network blocks to certain websites. Example: I can load up OSBuddy, but I cannot access any world menu (in login screen or ingame).
#slack4admin2016
<slacky> I will build a wall
<slacky> I will ban reflection and OGL hooking until we know what the hell is going on
I get this error after a while:
Error while reading stream: Unable to open file.
Is this because i use the script twice at the same time?
~Fre
Yes i am loading and freeing RSWalker. Because i use different regions and floors.
This error popped up.
refers to this lineError: Exception ('TRSPosFinder.UpdateAddr: Unable to locate bitmap') at line 231
Simba Code:RaiseException(erException, 'TRSPosFinder.UpdateAddr: Unable to locate bitmap');
~Fre
Just don't do that. Create several instances of RSW instead.
I believe the issue comes from Simba trying to load the map in both your scripts at the exact same time.
Just have two walkers (or more) in your script, create the walkers you need only once, and free them only once.
!No priv. messages please
First, I assume you have two or more maps, since you talk about "regions". So yeah, 1 RSW instance per map you load. Setup both walkers in the initialization part of your script, store the variables globally, so that you can use it anywhere in your script..
A prototype example (written on the go):
Simba Code:var
WalkUG, Walk: TRSWalker;
procedure OnTerminate();
begin
WriteLn('Script terminated');
WalkUG.Free();
Walk.Free();
end;
procedure DoStuffUnderground();
begin
** do stuff **
WalkUG.WalkPath([Point(123, 123), Point(111, 111)]);
end;
procedure DoStuffElsewhere();
begin
** do stuff **
Walk.WalkPath([Point(333, 333), Point(366, 366)]);
end;
procedure InitWalkers();
begin
Walk.Init('world.png');
Walk.walkStyle := wsSPS;
Walk.anyAngle := True;
WalkUG.Init('underground.png');
WalkUG.walkStyle := wsSPS;
WalkUG.anyAngle := True;
AddOnTerminate('OnTerminate');
end;
begin
InitWalkers();
repeat
** do stuff **
DoStuffUnderground();
DoStuffElsewhere();
end;
end.
Last edited by slacky; 12-31-2016 at 01:29 AM.
!No priv. messages please
So, i took your advice.
I made multiple RSW instances and defined them globally.
Works so far.
Thx for the help.
Last edited by fre; 01-01-2017 at 09:41 PM.
~Fre
So walking to paths works if the minimap is the same as the one i used to make my maps.
I noticed jagex has 2 or 3 versions of the world map with few pixels difference.
So when my player is walking a path and cannot get it's location i want to save the piece of the map.
Then i can add this piece to my collection
Simba Code:if not Result then
begin
Debug('Failed to walk path, setting compas north.');
setCompass('n');
Inc(Loop);
//self.blindWalk(Path[0]);
if Loop > 1 then
begin
//While 1 = 1 do
Debug('Failed to walk path again, taking snap of memory map.');
finder.Init(w_GetClientPID());
finder.GetLocalPos();
bmp := CreateBitmap(1,1);
DrawMatrixBitmap(bmp, finder.localMap);
CropBitmap(bmp, 52,52, 511-52,511-52);
//ShowBitmap(bmp);
Wait(100);
//action := WaitKey([VK_RETURN,VK_BACK], 1500);
//if (Action = VK_RETURN) then
begin
SaveBitmap(bmp,FILEPATH+PREFIX+ToStr(i)+'.png');
WriteLn('Saved '+FILEPATH+PREFIX+ToStr(i)+'.png');
inc(i);
end;
FreeBitmap(bmp);
//WS_switchWorlds(randomWorld(Players[currentPlayer].Member));
end;
GoTo Start;
end;
i get this error
Error: TMemScan.Init -> The parameter is incorrect.
at line 159
Last edited by fre; 01-16-2017 at 11:05 PM.
~Fre
Hey Slacky I've got a question for you: have you compiled this with the newest version of Simba? If so, what have you changed? I'm having errors (Variable expected) particularly at this line in Base.pas:
Or any time referring to LibCV. I figure this is just an issue with Lape in the most recent Simba but I've tried everything I can think of to no avail. Do you have any suggestions to point me in the right direction?Simba Code:LibCV.MatchTemplate(large, sub, self.matchAlgo);
Edit:
I've made progress and have it working now for the most part through a bit of sloppy modification. However I believe I have a memory leak somewhere as over time while the walker is in use Simba accumulates memory. And after X amount of times ran and stopped the map file cannot be loaded, as if it's still in use, AKA something is not being freed. I'll continue how I can but as I said before, my knowledge with Lape is quite limited.
Last edited by Flight; 01-21-2017 at 05:33 PM.
Current projects:
[ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]
"I won't fall in your gravity. Open your eyes,
you're the Earth and I'm the sky..."
There are currently 2 users browsing this thread. (0 members and 2 guests)