Skoller7 Posted March 14, 2016 Share Posted March 14, 2016 Hello, I am a bit stuck on a script i am making here is my script, i was following an old post about someone with the same idea as myn but i still dont get some parts of the code so i hope to find an answer here (post http://forums.scar-divi.com/archive/index.php/t-1837.html ) My code : program FishingBot; var Bmp: TSCARBitmap; x, y: Integer; // x y always different? or same? Box1: Tbox; Desktop: TSCARWindowClient; procedure Fightbuttom begin Bmp := TSCARBitmap.Create('deNoTZJBgOGCvP8jRh1s3/mOAO+tX' + '77TVvTFj8pcnj/f6O++100PW8h6s5d3jRy9u3ngJQ0enTlhjofXs6KHf374dqC' + '7daq2zzw6h5R1Yy/ryoqmGKnOM1eaC0UJT9fWW2ttsdLfHhiw109hkBdSih6Zl' + 'U0XxErAU0EAg2m6ju9tW71RBxqnasu1+TjtsdPfbo9uyuaJ4tYXWHlQ3Q7x5tK' + 'YMqAXTYScWzAW6+Wxd2fn6ciA6GOgCVAPx5s6qEqAjgYJoWtAAxGRkB7y+cA5N' + 'y9EFc4BSOyqhaJWXw2ZrHWQtQAaalo0VxfNM1FeaawJlgQjoEjRbMLUAxYHqgd' + 'EHDAEgAsYd0C8EtWCGGLLUCwy/ENRyKD+dVC1Ar8HFj+en76kqWeppD/QyWvJD' + 'lkI2DcgGhucGK220KMYjBUw8+0Dho4emHr8UMehkUgSpWvaTbst+epUSADd3Xr' + 'o='); //Bitmap Loaded Desktop := TSCARWindowClient.Create(GetDesktopWindow); // Searches the desktop aka Pokemon Map SetClient(Desktop); // Actually only looks to the pokemon map aka my whole screan Box1 := GetWindowBox(GetDesktopWindow); // Selects a box around Found Bitmap end; begin Fightbuttom; DebugBitMap(Bmp); //selects name of the bitmap to be searched. wait(Random(1000)); // Waits a random amouth between 0 and 1000 if FindBitmap(x, y, Bmp, 0; 0, Box1.x2 - 1, Box1.Y2 - 1) then begin MoveMouse(x, y); //moves mouse to random Coords on the BMP Bitmap. Wait(Random(250)); MouseLeftClick; // makes u mouse left click end; end; end. Questions : 1) The meaning of this script will be that it catches the pokemons i need but kills the ones i dont need. I made one buttom so far but I dont know if i want to make a new one do i have to change the Bmp or the TSCARBitmap's name? Or Both? ( So for now it just finds the fight buttom and clicks it ) 2) the FindBitmap(x, y, bmp, 0; 0, Box1.x2 - 1, Box1.Y2 - 1) I tbh dont really know what this does. My gues is it searches the bitmap within the x and y coords? Saw it in the other guide when trying to learn from it 3) the x and y are they unique? or can i say lets copy paste that part of the code, and edit the names from the other bitmap and it'll search that bitmap between another x and y? or do i have to make another var for it then? I hope there are still some active ppl around here since i'm scared only finding such old posts. Also sorry my bad english if you didnt get my question just ask me in post and i'll answer within the day Thanks for the read and hopefully for the help Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 15, 2016 Share Posted March 15, 2016 1) If the image is different you should create a new bitmap and variable to assign it to. 2) It searches for that bmp within left bound, top bound, right bound, bottom bound (x1, y1, x2, y2) and returns the position of the first found bitmap's upper right most pixel as (x,y) 3) It won't matter what you name your x, y variables as long as you understand they are place holders so it's probably good practice to use separate variables to keep track of them e.g. : Fx Fy, Px, Py I won't confuse you with the type TPoint but you'll learn that later hopefully. Quote Link to comment Share on other sites More sharing options...
Skoller7 Posted March 15, 2016 Author Share Posted March 15, 2016 (edited) Thank you Wanted! I'm starting to understand it better and better, I have some more questions do i put them in this post or should i make a new one? If i dont have to make a new one then here is the question : I have want to make a part of code/way of bitmap, that will search for if it shows infront of the Magikarp. Now coding that i dont think will be a big problem but as you see the backgrounds and colours are different in both bitmaps how can i make scar only search the even tho the background is different? Is this possible or a no go? -EDIT got another solution so its kinda fixed Edited March 15, 2016 by Skoller7 Quote Link to comment Share on other sites More sharing options...