 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Sun Jan 21, 2007 7:39 pm Post subject: I can't believe this works (winamp bass to wiimote rumble) |
|
|
First of all, let me just say that this serves no purpose other than just seeing if it could be done. The methods used are far from optimal and I know I already said this in the topic, but I just can't believe this works!
Lately I've been experimenting with combining GlovePIE with another piece of scripting software: AutoHotKey. While similar to GlovePIE in some ways, AHK has a lot of functionality GlovePIE does not. Like the ability to check the color of certain pixels on the screen or to even check if a certain image appears within a certain area of the screen. I'm hoping to utilize this functionality in concert with GlovePIE to make scripts that adapt to what is happening in applications and/or games.
For example, say you have Super Mario Bros. loaded up in an NES emulator. You can use AHK to check the area of the screen that shows how many lives you have and then move the mouse to coordinates based on that number (set the mouse x to 4 if you have 4 lives, set it to 3 if you have 3 lives, etc) and THEN in GlovePIE you can check where the current mouse cursor is. If GlovePIE detects that the mouse's x position is 4, it can then light up the LEDs on the Wiimote to correspond with how many lives you have left! At least, this is my theory.
Before digging into the meat of it, I decided to test the theory on something easier: Winamp. For this experiment we'll be using the default Winamp skin, as seen here:
Note that this method will only work with the default skin.
Okay, see that little area right below the track time with the colored bars? These indicate the frequency. The bar furthest to the left is usually triggered by the lowest frequencies, so this is what we will look at to trigger the Wiimote rumble. I have AHK check a coordinate towards the top of the leftmost bar to see if it's a certain color, and if it is, move the mouse to point 0,0 on the screen and then move it away quickly. Meanwhile a GlovePIE script is constantly checking to see if the mouse is at 0,0 and if it is, it triggers the rumble.
So basically, whenever there's a lot of bass in Winamp, the Wiimote will rumble!
You can download the compiled AHK script here. When you run it, it will show up in the system tray on the bottom right of your screen. You can close it by right clicking on it and selecting "Exit". Next you should run the following GlovePIE script:
| Code: | if ((Mouse.x == 0) and (Mouse.y==0)) then
Wiimote.Rumble = true;
wait 20 ms;
Wiimote.Rumble = false;
endif |
Okay, now open Winamp and make sure it's using the default skin. After that, open up an mp3 and play it. It will only work if the main Winamp window has focus. If you find it hard to stop Winamp once the script is running because it keeps moving the mouse to the upper left corner, press "V" to stop the track in Winamp.
Again, this is just a little experiment that I cobbled together and I can't imagine anyone would use this for more than a minute but I thought it was kinda neat and worth sharing. |
|
| Back to top |
|
 |
timelf123
Joined: 21 Jan 2007 Posts: 15
Digg It |
Posted: Sun Jan 21, 2007 8:51 pm Post subject: |
|
|
| Thanks man, a good script! You got a website or how do you want me to credit you with my blog post? Right now it links to your wiili profile |
|
| Back to top |
|
 |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Sun Jan 21, 2007 9:00 pm Post subject: |
|
|
| Hmm... maybe just link to this thread? I don't have a website devoted to this stuff at the moment. I may end up making some sort of script reservoir at some point perhaps. |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sun Jan 21, 2007 10:48 pm Post subject: |
|
|
Use this to get the colour at a specific spot on the screen:
| Code: |
// Display colour under cursor
var.hdc = USER32.DLL.GetDC(NULL)
var.pixel = GDI32.DLL.GetPixel(var.hdc, mouse.CursorPosX, mouse.CursorPosY)
USER32.DLL.ReleaseDC(NULL, var.hdc)
debug = IntToHex(var.pixel, 6)
|
|
|
| Back to top |
|
 |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Sun Jan 21, 2007 10:58 pm Post subject: |
|
|
That's pretty awesome, Carl! Is there any way to set the coordinate origin to the upper left corner of the focused window? That's what I'm doing with that Winamp AHK script but I'd much rather just use GlovePIE if it's at all possible.
What other crazy junk can you do with DLL files and GlovePIE? I'm completely unfamiliar with this area of scripting.
Right now I'm going to test out your script and see if I can get the Wiimote to rumble when you overheat in Excitebike. Results in a few. |
|
| Back to top |
|
 |
CarlKenner Site Admin
Joined: 29 Nov 2006 Posts: 614
Digg It |
Posted: Sun Jan 21, 2007 11:08 pm Post subject: |
|
|
| Code: |
var.hdc = USER32.DLL.GetDC(NULL)
var.pixel = GDI32.DLL.GetPixel(var.hdc, Window.Left, Window.Top)
USER32.DLL.ReleaseDC(NULL, var.hdc)
debug = IntToHex(var.pixel, 6)
|
You might want to add a certain amount to window.left and window.top, if you don't want the real top left corner. |
|
| Back to top |
|
 |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Sun Jan 21, 2007 11:23 pm Post subject: |
|
|
Thanks for giving me all this new info to experiment with, Carl. My brain is on fire thinking of ways to apply it.
As for Excitebike, SUCCESS. Here's the snippet of code that worked for me:
| Code: | // check for overheat
if true then
var.hdc = USER32.DLL.GetDC(NULL)
var.pixel = GDI32.DLL.GetPixel(var.hdc, Int(351), Int(420))
USER32.DLL.ReleaseDC(NULL, Int(var.hdc))
var.test = '0x'+IntToHex(var.pixel, 6)
if (var.test == "0x003CAD") then
Wiimote1.Rumble = true
wait 20 ms;
Wiimote1.Rumble = false
endif
endif |
Note that this is for VirtuaNES in fullscreen mode. It checks the very rightmost pixel of the temperature bar to see if it's a certain shade of red and if so, activates the rumble. Mileage may vary. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|