simulating mouse clicks

Basically what I want to do is make things automated in my game, diablo 2. The game has a 2 hour “perming” thing for all new characters. What I want to do is to make a script that clicks on the screen causing the character to move. If a character is standin still for too long, he drops, so I want to write a script that just clicks between to pts on the screen, causing the character to move back and forth.

Currently I have installed the Scripting Additions that allows me to click on the screen. This works well in the finder, safari, and pretty much any other app I tried. But when tested in the game, the game does respond.

on idle
	tell application "System Events"
		tell process "Diablo II (Carbon)"
			set frontmost to true
			mouse click {500, 393} -- + i}
			delay 1
			mouse click {524, 393}
		end tell
	end tell
end idle

This is what I have so far, but Diablo does not respond. Any help is appreciated.

Assuming you are using xtool.osax and running OS X 10.3, I’ve found that while move works proprely, mouse click doesn’t work on lots of windows.

The failure seems to be that either the move or the click is not registered as an event by System Events. Try clicking a checkbox on the Energy Saver Preference panel - same result. The cursor moves to the right place, but the checkbox doesn’t change state. Oddly, if you press the mouse button without moving the mouse, the checkbox responds to the “real” click.

I emailed about this when I discovered it, but the email failed to deliver after 48 hours of trying.

Yea, thats what I figured by reading the other posts that involved this script addition. Hope it can be fixed, thanks for the response. Maybe there is another way to do it.