Trying to make a simple mining bot for a game called Wurm...

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Trying to make a simple mining bot for a game called Wurm...

#1 Post by Exempt » Fri Sep 23, 2011 10:35 pm

Trying to make a mining bot for a game called Wurm Online. It's a game made in java and it's being a pain to detect stats like food, water, and most importantly stamina. I can't seem to find memory addresses so I'm trying to just use a color picker to check for the stamina..

Code: Select all

matchcolor = makeColor(93, 157, 88);
x,y = pixelSearch(hdc, matchcolor, 186, 0, 206, 16, 10, 2);
r,g,b = getPixel(hdc, 196, 6);
printf("RGB: %d, %d, %d", r, g, b);
printf("x: %d\n",x);
For some odd reason it's telling me the color at that location is 255, 255, 255 which is not true it's a greenish color. I used paint to get the RGB values from the stamina bar.
This is the full code..

Code: Select all

setStartKey(key.VK_DELETE);
setStopKey(key.VK_END);

function main()
	--attach( findWindow("Wurm Online 3.0") );
	keyboardSetDelay(100);
	windows = 1;                 --Not really used atm...
	times = 0;                     --Varible to hold the amount of times i've mined...
	window = findWindow("Wurm Online 3.0.1")
	hdc = openDC(window);
	printf("hdc: %s\n", hdc);
	winX, winY, wWidth, wHeight = windowRect(window);
	printf("X %d, Y %d, W %d, H %d \n", winX, winY, wWidth, wHeight);
	
              --Just an easy way to make sure the window has focus....
	mouseSet(math.random((wWidth/2)-10, (wWidth/2)+10)+winX, math.random((wHeight/2)-10, (wHeight/2)+10)+winY);
	yrest(1000);
	mouseLClick();
	yrest(1000);

	while(times < 100) do
		if(windows >= 1) then
			matchcolor = makeColor(93, 157, 88);
			x,y = pixelSearch(hdc, matchcolor, 186, 0, 206, 16, 10, 2);
			r,g,b = getPixel(hdc, 196, 6);
			printf("RGB: %d, %d, %d", r, g, b);
			printf("x: %d\n",x);
			yrest(500);
			if(x > -1) then
				yrest(500);
				mouseSet(math.random((wWidth/2)-10, (wWidth/2)+10)+winX, math.random((wHeight/2)-10, (wHeight/2)+10)+winY);
				yrest(500); 
				keyboardPress(key.VK_M);
				times = times+1;
				printf("Times: %i\n", times);
			end
		end
	end	
	printf("Mined %i times. All done.\n", times);
	--detach();
end
startMacro(main);

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Trying to make a simple mining bot for a game called Wur

#2 Post by Administrator » Sat Sep 24, 2011 11:51 pm

For whatever reason, it seems like it is failing to get the pixel color. What does your log.txt say? There's any number of things that can be wrong. Maybe, the game is protected by some virtual machine or something.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Trying to make a simple mining bot for a game called Wur

#3 Post by Exempt » Mon Sep 26, 2011 2:05 pm

log.txt just says this....

Code: Select all

on Sep 26 14:00:45 2011 : Processor Type: 4X AMD or Intel x64 @3292MHz, OS: Windows 7 Service Pack 1
Mon Sep 26 14:00:45 2011 : User privilege level: Administrator
Mon Sep 26 14:00:45 2011 : Lua glues exported
Mon Sep 26 14:00:45 2011 : MicroMacro v1.01 beta 4
Mon Sep 26 14:00:45 2011 : LuaCoco is available
Mon Sep 26 14:00:45 2011 : Keyboard layout: US English
Mon Sep 26 14:01:18 2011 : Executing script 'miner.lua'
-------------------------------------------------------------------------------


Mon Sep 26 14:02:20 2011 : Execution success
All I get from the printf("RGB: %d, %d, %d", r, g, b); is 255, 255, 255.






PS: You're Avatar scares me. :shock:

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Trying to make a simple mining bot for a game called Wur

#4 Post by Administrator » Tue Sep 27, 2011 3:41 pm

Well, that's not very helpful. It could still be anything. Would this happen to be a flash game? If not, can you try testing it on another window to rule that out?
PS: You're Avatar scares me. :shock:
But it is cute.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Trying to make a simple mining bot for a game called Wur

#5 Post by Exempt » Fri Sep 30, 2011 7:27 pm

Administrator wrote:Well, that's not very helpful. It could still be anything. Would this happen to be a flash game? If not, can you try testing it on another window to rule that out?
PS: You're Avatar scares me. :shock:
But it is cute.
I don't think it uses flash, the game was made with Java. http://www.wurmonline.com, it's a decent game if you like sandboxes for sure. I use similar code in other games that use directx and it works fine. I assume it's something the game does. :(
By te way is there anyway to use attach() with direct input games?

In a scary kinda way...I guess.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Trying to make a simple mining bot for a game called Wur

#6 Post by Administrator » Sat Oct 01, 2011 3:24 pm

You would probably have to inject a DLL to hook all of the DirectX functions in order to achieve everything you want.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Trying to make a simple mining bot for a game called Wur

#7 Post by Exempt » Sat Oct 01, 2011 4:54 pm

Lame, I cannot figure out drectx hooking. I spent 2 weeks tinkering with a hooking tutorial and didn't get anywhere. Do you happen to know any basic hooking tutorials that use DLL injection?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Trying to make a simple mining bot for a game called Wur

#8 Post by Administrator » Tue Oct 04, 2011 1:26 am

It is a pain. I'm not going to bother explaining all the details, so just try the Direct3D hook starter kit.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests