• Log in or sign up for an account here: https://www.sythe.org/login

I need help to make something run faster!

SuF

Legend

Pirate
Retired Global Moderator
Joined
Jan 21, 2007
Sythe Gold
1,234
Messages
14,211
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Having a long time I finally was able to make a program that tells you the colors of every pixel on my screen. (I was doing this is trouble shoot it so I could figure stuff out and stuff. Gunna change it some to use in bots if I get it to run faster)

I have 1440 by 900 pixels which is 1,296,000 pixels on my screen. My program takes 1:37 minutes to display all the pixels. (I got dual core and Niv. GFo. 8600.)

Thats much to damned long. :/

I wrote this in simple code and it took like 2 hours to make it so that it accualy did the whole screen not just to top row or from corner to corner. If someone could help me make this run faster I would be very happy.

Code:
import java.awt.*;




public class test 



{
	static boolean con = true;
	static boolean cony = true;
	static boolean conx = true;
	public static void main(String[] args) throws Exception 
	{
		
		Robot auto = new Robot();
		{	
		
			int x = 0;
			int y = 0;
			int r = 1;
			int x2 = 1440;
			int y2 = 900;
			
				while(cony) 
				{
					if (y < y2)
						{
							x = 0;
							conx = true;
							while(conx)
							{
								if (x < x2)
									{
							
										Color pxcolor = auto.getPixelColor(x,y);
										System.out.println("" + pxcolor + r);
										x ++;
										r ++;
										
		
									}
								else if (x > x2)
									{
										conx = false;
										y ++;	
									}
								else
									{
										conx = false;
										y ++;
								
									}
						
						
							}
						}
		
					else if (y > y2)
						{
							
						cony = false;
						
						}
					else
						{
							cony = false;
						}
					
				}
			
		}

	}	
}

Don't tell me anything about objects and shit... I was making something simple this time and will probelly use objects when I accualy make some sort of bot. :/
 
I don't know java very well, but why don't you just do this:

Code:
for(int x=0;x<=1440;x++){
    for(int y=0;y<=900;y++){
        Color pxcolor=auto.getPixelColor(x,y);
        System.out.println(""+pxcolor);
    }
}

not sure what r was for in your code, but I doubt you need it. Good Luck.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
r was a counter to see how many pixels it had looked at.... It kept only doing the top line of my screen for some reason... Lemme look at yours XD
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Yes yours works... My first one looked just like yours.... I dunno why it didn't work. :/ It still takes forever though...


EDIT: it takes less time but it froze the second time I ran it =P


EDIT 2: took 40 seconds igunna try my programy thingy

EDIT 3: mine took 43 this time =P the rs window has about.. 300,000 pixels which takes about.... less than 10 seconds.... on slower machines it will probelly take more than 20 :/ i got vista which also may slow it down some XD
 
And you dont have to scan your entire screen, just the runescape client. Its also faster to get a screenshot in java, then iterate through that.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
yes I know... do you know how i could get my program to find out where the rs screen is on the persons comp screen? that would help me a lot :/


also how to make a hotkey that would stop my auto clicker i am working on :/
 
In c++, theres a function called FindWindow, then you use the handle from that and get the window position. As long as you can get your cursor's position, I'd do the following:
Create A Button; When Clicked, wait 2 seconds; Get Cursor Position. Then have this your starting x and y. The user would have to move the mouse to the upper left of the runescape client.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
or press a butten then click the top corner :/ then start it would seem like a better idea but thanks XD
 
Runescape Gamblingrunescape gambling
Back
Top