tweakmeup Posted December 1, 2012 Share Posted December 1, 2012 When taking a bitmap of say, a piece of road or road and house, scar never recognizes it. Even if I don't move at all after taking the bitmap. Bitmaps seems like the only way to properly walk in rsc, but they aren't working. Quote Link to comment Share on other sites More sharing options...
FHannes Posted December 1, 2012 Share Posted December 1, 2012 If the colors change, FindBitmap won't find it either. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 Can you show us your bitmaps + what you are making them for (images of minimap)? Minimap colors doesn't change in Project RSC, but you need to filter out ALL the players, items, objects and then you would have to use FindDeformedBitmapToleranceRotationIn(). I can tell you, its not the easiest thing to get working. It would help a lot, if we had the map of full RuneScape Classic (with this I don't mean maps that can be found with Google, those maps always contain texts, symbols and other crap with them). - - - Updated - - - Also, remember the fact that even if you set compass to perfect position (example: north), map wont be facing the direction. It randomly switches the angle, inside certain range (I believe something like -5 - 5 degrees or so). You can notice this if you do this: 1. Open map 2. Open inventory 3. Open map 4. Open inventory 5. Open map 6. ..etc... If you take a close look at it, you can see the map keeps "rotating" to random angle (even though compass doesn't change). This is 1 of the reasons why you need to use FindDeformedBitmapToleranceRotationIn(). Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 (edited) Okay so how do u go about filtering them out? Also, is it possible to just take s/s of the minimap in a bunch of different places, crop them, and combine them? I guess you would have to filter the npc dots as well? Also, maybe if I knew what the reason was that you can't have text on the map, I could help devise a strategy to get or make a map. One last thing. What if the path you take, say along a road, has no text or legends on it. I mean, they are near it, just not on it. Edited December 1, 2012 by tweakmeup Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 (edited) Use ReplaceColors(). Like this (only an example): {$IFNDEF SCAR338_UP} procedure ReplaceColors(var Bmp: TSCARBitmap; Colors: TIntArray; NewColor: Integer); var h, i: Integer; begin h := High(Colors); for i := 0 to h do try ReplaceColor(Bmp, Colors[i], NewColor); except end; end; {$ENDIF} var original: TSC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Qkwjbzo/CfL9rDrx6nV1IyyH' + 'OqCNw/q69Du1hfecViWZs5VrMnl3t37Ia3o3CPnM7YvTyNPdapNX9s50/q503u' + 'z8hMgLFfjCDjmcYNgbBKdIOy0JWYR8pltY0KssTp72Y+yTvCY//5QdCpWNpMqS' + 'xz1IeyOvnJMynR9Q50f7HvBg6gpHW2T4wgvW4/1Q0+7BzndOS+Xv3VeWvHuQhj' + 'ytg6hKPqHXSvL5+1WWJU8Pksnj2p965JN7zcE3na+q8wJ8s/NV7fwUyQczbhud' + 'oDskLF/CQLUHne/kP2byOMs8OPn80c103nQ+eb3PUOTLWvvliIMp5dvDuRoSJd' + '56qI38OMn/D1JLvdY='); DebugBitmap(original); Wait(2000); ReplaceColors(original, [16777215, 16711422, 16776960, 65535, 255, 6316128], 0); DebugBitmap(original); original.Free; end. - - - Updated - - - ..or code for in-game use (with game minimap): {$DEFINE PRSC} {$I MSSL\MSSL.scar} {$IFNDEF SCAR338_UP} procedure ReplaceColors(var Bmp: TSCARBitmap; Colors: TIntArray; NewColor: Integer); var h, i: Integer; begin h := High(Colors); for i := 0 to h do try ReplaceColor(Bmp, Colors[i], NewColor); except end; end; {$ENDIF} procedure ScriptTerminate; begin MSSL_Unsetup; end; var minimap: TSCARBitmap; bx: TBox; begin MSSL_Setup; if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then begin bx := PRSC_MinimapBx; MSSL_Wait(100); minimap := PRSC_Client.CaptureEx(bx.X1, bx.Y1, bx.X2, bx.Y2); ReplaceColors(minimap, [16777215, 16711422, 65535, 16776960, 65535, 255, 6316128], 0); DebugBitmap(minimap); minimap.Free; end; end. - - - Updated - - - ..and you of course would set 0 as TranspColor for the TSCARBitmap you are using for searching your position. With compass area filtering: {$DEFINE PRSC} {$I MSSL\MSSL.scar} {$IFNDEF SCAR338_UP} procedure ReplaceColors(var Bmp: TSCARBitmap; Colors: TIntArray; NewColor: Integer); var h, i: Integer; begin h := High(Colors); for i := 0 to h do try ReplaceColor(Bmp, Colors[i], NewColor); except end; end; {$ENDIF} procedure ScriptTerminate; begin MSSL_Unsetup; end; var minimap: TSCARBitmap; bx: TBox; compass: TPointArray; begin MSSL_Setup; if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then begin bx := PRSC_MinimapBx; compass := TPAFromCircle(Point(19, 20), 19); MSSL_Wait(50); minimap := PRSC_Client.CaptureEx(bx.X1, bx.Y1, bx.X2, bx.Y2); minimap.SetPixels(compass, 0); SetLength(compass, 0); ReplaceColors(minimap, [16777215, 16711422, 65280, 16776960, 65535, 255, 6316128], 0); DebugBitmap(minimap); minimap.Free; end; end. Edited December 1, 2012 by Janilabo Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 Does it automatically adjust the colors out, or do I need to filter them to make the surroundings, like the brown that's inside the building on the minimap? Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 You must only remove the objects. If you'd remove every color out, it wouldn't work at all. Floor/ground colors (green, gray, brown, red, etc.) are there already.. So you just need to remove NPCs, yourself and other players (friends aswell), items, objects and walls. Just like I did in the example. Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 Wait I don't understand, why would you need to remove objects and walls, aren't they a part of the minimap that are stationary? And I understand what you're saying but thats not what I meant. I meant does the program you posted changed the (whatever color I out in (npc for example (clyellow))) color and filter it out, or do I need to take the color of the ground and put that in to replace the clyellow from the npc in the script? Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 Remember, if you make a fire in Project RSC, it turns into an object that is not stationary at all. Also, walls/fences deform, whereas ground colors doesn't (as far as I know).. Thats why it's good to filter em out. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 1, 2012 Share Posted December 1, 2012 (edited) This is why I said DTM's would be easier. But only at first. What his code does is changes those colors([16777215, 16711422, 65280, 16776960, 65535, 255, 6316128]) on the minimap bitmap to black. Then with TSCARBitmap you can set TranspColor property to whatever color you don't want included in the FindBitmap search. This sounds confusing but maybe it helps because then you can set that bitmap as the client and search it using the minimap bitmaps you've collected (also set those colors on there to black and transpcolor). As to whether all this helps ALOT i have no idea. The big part of this that matters...is the FindDeformedBitmapToleranceIn function. Documentation for it is in the old manual...here If you can get a system down that will work.... As for filtering out stationary objects, I guess that will help the accuracy of the search... Might try to make a tutorial on this stuff this weekend Edited December 1, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 I don't have any sort of grasp on the deformed functions, and I don't know what it even means to deformed, so youll have to explain that to me . Also, what is the portion h =high(color) and I =0 to h etc. For? I'm guessing the replace colors ( this is where I put the colors i want replaced?) And then put in the color that would be underneath it, such as brown ground afterwards? I hope I'm making sense - - - Updated - - - The old manual seems so much better with the explanations than the new manual. It has pictures, gives examples of the actual functions, and the values you would put in... Thanks for that just wish I could view this Crap on my computer!!! Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 1, 2012 Share Posted December 1, 2012 Well if you looked at the pictures in the old manual (that I even posted) you can see it shows the original bitmap. Then it shows the same thing but it is really distorted, and weird looking compared to the original. Deformed means just that. Now what does this function do? Well it tries to find the bitmap you give it (the original one) and will find it...EVEN IF it is deformed. Thus FindDeformedBitmap can find the original bitmap, or the one that is deformed from the original.. How does this fit in with Mini maps? Well if one minimap is rotated, and has different pixels colored and stuff but has a degree of similarity. Then FindDeformed can find that bitmap still. Then I'm guessing the Accuracy is how similar the bitmap it found is to the original? Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 Yeah I understood what it meant by taking a look at the old manual (thanks), but sometimes its difficult for me to know what to put in the function ( ). Like in the example they have finddeformedbitmapln(b, x, y etc.) There is a b in there, I have no clue what that is for. Also I was using another function in the past, I don't remember what it was, but it had Sx, Sy and I wanted to know what those were for as well. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 1, 2012 Share Posted December 1, 2012 I think SX, and SY are short for...StartX, and StartY XS YS, XE, YE - I think those stand for - XStart, YStart, XEnd, YEnd - but not totally sure. Conflicting here Anyway. In SPIRAL functions you can tell the function where to start its search. Otherwise it searches in a scanline method from left to right starting at the top. That's what the SX, and SY is. Look at the wiki - http://wiki.scar-divi.com/index.php?title=FindColorSpiral Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 So I put the purple includes he has listed there in my script, but when I run it, it gives me a compile error with the message unknown identifier prsc_opengametab. I thought this would recognize it since I put ($define prsc). Also, where do I put the tscarbitmap.transpcolor in my script? Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 You need to include MSSL. Only defining wont include PRSC stuff.. {$DEFINE PRSC} {$I MSSL\MSSL.scar} procedure ScriptTerminate; begin MSSL_Unsetup; end; { SCRIPT STUFF HERE, PROCEDURES / FUNCTIONS / VARIABLES / ETC! } begin MSSL_Setup; // Script stuff goes here (below MSSL_Setup)! end. I am still saying that, you really should learn the basics (there's plenty of good tutorials that explain the basic stuff - even video ones @YouTube) before jumping to projects like this (this is advanced stuff, I can tell you)... Even though I am ok as a scripter, I am still really bad teacher (always been that way), so I can't help you that much really. So simply put: I am ONLY a scripter, NOT teacher. :\ Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 (edited) Nvm, prsc had to be above the mssl include. Also, can u have OSI and mssl in the same script? Also, I've put the transpcolor in ny script, and marked it as an integer, but it keeps coming back as an unknown identifier. I can't figure out why, I've tried moving around the variable, even put it inside the function. Edited December 1, 2012 by tweakmeup Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 Do you get error even with this blank script: {$DEFINE PRSC} {$I MSSL\MSSL.scar} procedure ScriptTerminate; begin MSSL_Unsetup; end; begin MSSL_Setup; end. ? Could it be you used {$DEFINE PRSC} after {$I MSSL\MSSL.scar}? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 1, 2012 Share Posted December 1, 2012 (edited) Alright lets get down to the grind now. I have thoroughly tested these "FindDeformed" functions (well one of them), and I've come to the conclusion that they are bugged, and have posted the bug to SCAR's bugtracker. Check out the post on the bugtracker to find out why. When you include lets say MSSL. MSSL has built in defines, so if you define PRSC before you include MSSL then MSSL knows that you are using PRSC and includes certain files for PRSC thus it has to be like this: [scar] {$DEFINE PRSC} {$I MSSL\MSSL.scar} [/scar] So the TranspColor thing doesn't even matter if the FindDeformed functions are broke. So your alternative for now would have to be DTM's. For DTM finding you need to make sure you pick places that the Yellow and White Dots cannot go. For instance the outline of a building. Then whenever a DTM is found using the FindDTM function. It returns the middle point at which it was found (starting point in DTM). If you make the middle point the outline of the place, then you would need to do like x + 15 or something to walk to the center of it... Unless anyone here has any objections my findings find the FindDeformed functions as broke Once the FindDeformed functions are fixed I will make my full tutorial on Color/Tolerance/Bitmaps/DTM finding. Edited December 1, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 Alright lets get down to the grind now. I have thoroughly tested these "FindDeformed" functions (well one of them), and I've come to the conclusion that they are bugged, and have posted the bug to SCAR's bugtracker. Check out the post on the bugtracker to find out why. When you include lets say MSSL. MSSL has built in defines, so if you define PRSC before you include MSSL then MSSL knows that you are using PRSC and includes certain files for PRSC thus it has to be like this: [scar] {$DEFINE PRSC} {$I MSSL\MSSL.scar [/scar] So the TranspColor thing doesn't even matter if the FindDeformed functions are broke. So your alternative for now would have to be DTM's. For DTM finding you need to make sure you pick places that the Yellow and White Dots cannot go. For instance the outline of a building. Then whenever a DTM is found using the FindDTM function. It returns the middle point at which it was found (starting point in DTM). If you make the middle point the outline of the place, then you would need to do like x + 15 or something to walk to the center of it... Unless anyone here has any objections my findings find the FindDeformed functions as broke Once the FindDeformed functions are fixed I will make my full tutorial on Color/Tolerance/Bitmaps/DTM finding. I don't even think its deformed functions, I think bitmaps are screwed up lol. I have writeln found under my bitmaps all the time and it never returns anything like it does with findcolors... But I will look up dtms and see if I can figure them out. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 1, 2012 Share Posted December 1, 2012 (edited) I don't even think its deformed functions, I think bitmaps are screwed up lol. I have writeln found under my bitmaps all the time and it never returns anything like it does with findcolors... But I will look up dtms and see if I can figure them out. Haven't you been told already why this is? We all should agree that. 1. PRSC likes to change colors (maybe not on the minimap but w/e) 2. PRSC likes to shift the minimap everytime you open it? Source: Janilabo 3. PRSC has moving objects such as NPCS, and Players. So when you are searching for a bitmap on the minimap the amount of things that can screw it up are staggering: 1. The minimap could be rotated (but we can search for bitmaps and rotate them ) 2. The objects could have moved such as NPCS and Players. If number 2 happens. You will NEVER be able to find the bitmap USUALLY. The only fix for number 2 is to use FindDeformed bitmap. Why? Because the bitmap you have of that area is NOT the same (rotated or not) of the one that has the objects at different positions (NPCS and players). e.g.: Those 2 images will NEVER be found as Similar bitmaps. If my screen had that 2nd image on the minimap in the game. And I was searching with the bitmap from that first image. IT would NEVER find it under any circumstances, unless you used FindDeformed The yellow pixels of the NPCS are at different positions then before, and even the two bitmaps are of different sizes. Yeah I highly recommend DTM's because you can avoid the objects somewhat Edited December 1, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 I can't find any documentation on rotated dtms, can you explain what to put for anglestep? Is it the same as angleintervals? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 1, 2012 Share Posted December 1, 2012 Okay umm. Think of Angles as DEGREES. So you have like 0 - 360 degrees. Like on a skateboard you can do a 360 kickflip or something. So angle steps is how many degrees per search you want to rotate the bitmap by. But you need to use the RADIANS function. Radians takes a DEGREE. So e.g. here is how you would search for a DTM rotated at ALL rotations: [scar] FindDTMRotated(DTM, x, y, 0, 0, 500, 500, 0, Radians(360), Radians(1), Angle); [/scar] Angle just returns the ANGLE at which the DTM was found! But do notice that when you rotate it so much, it does become slower? So this is all adjustable. Quote Link to comment Share on other sites More sharing options...
tweakmeup Posted December 1, 2012 Author Share Posted December 1, 2012 Okay, I'm quit unsure how to use this editor, is there a video similar to the aca one you showed me? Cause I don't know which points to pick to make the dtm unique. Quote Link to comment Share on other sites More sharing options...
Janilabo Posted December 1, 2012 Share Posted December 1, 2012 (edited) Yeah I haven't seen had any problems with bitmaps in 3.37+ (except for those Deformed ones, but it seems like LJ found out about those problems aswell and reported the problems to MantisBT! ) tweakmeup, most likely you are using bitmaps wrong. You need to deal with transparency, and as you are trying to find bitmaps from minimap, its just not going to work, without using FindDeformedBitmap functions. As simple as that is.. Of course, if you are 100% sure there is some problem with Bitmap API, then you should report the problems to MantisBT, so Freddy can fix the bugs. I attached an example to show how we can find bitmaps inside inventory (put sleeping bags inside your inventory, to see how it works ). We need that transparency, so I used 0 as transparent color. Edit: There's mostly video tutorials about DTMs for Simba, but the main idea is basically the same, so you can watch Simba ones. Here: Bitmap test.zip Edited December 1, 2012 by Janilabo Quote Link to comment Share on other sites More sharing options...