Archive for the ‘Script’ Category


Please don’t spoil my day, I’m miles away…

October 1, 2008

and after all I’m only sleeping….


Sorry I have been out. I *gasp* cancelled my AoC account for the time being because my little bro thoughtfully got me a copy of WAR and damn is it a fun game!


At least so far…


I said the same thing about AoC for quite some time so we’ll see.


As far as my Wiimote idea… well I have ported it to WAR and WoW and soon enough I’ll post the final version so all of you can give it a try. Unfortunately though it might actually require three wiimotes. This is because I use one in each hand, and then one in my pocket for jogging around (it really works!).


Humorously enough (and btw I am NOT going to include this in the final version) I found out that if you put a wiimote into a hat-like holder on your head, you could use it for mouse-look simply by nodding your head roughly in that direction. Unfortunately I feel like adding yet another wiimote would make the set-up uncannily ridiculous.


So feel free to stop by and check out my next update…which should be soon. I just need to post the script!




PS. I may come back to AoC if and only if  they deliver on the promises that the content that should’ve been there on relase is now there and then some. Seriously the game gets pretty boring shortly after you hit 80, and even raids don’t yield gear that you can even use to tank the mobs you get the gear from!


I Was Wrong!

September 15, 2008

Ok, I’m not going to skip to my loo to Java quite yet. After looking at some tutorials, and being completely overwhelmed by the massive amounts of knowledge I will need to pick through, there is no way in hell I could figure out how to do what I want in less than a few months.


So, that being said: I recruited my best friend who, among other things, worked for Microsoft at one point, and knows Java like the back of his own hand. Sometime soon he’ll be spending a weekend or two at my house so we can get together and work on my little project. He even said he’d help make a graphic UI for me! Wee!


Therefore until that weekend happens, I am stuck with what I know, and I’m coming back on my hands and knees with GlovePIE for another week.


On the good side of this I did find a script for GP that lets you:

1) Put a Wiimote in your pocket

2) Start jogging

3) GP recognizes that you are jogging!

It also recognizes walking. So I can use this as my ‘running script’ for creating movement in game. I’d like to thank Rhys Legault for his awesome script creation of magical shinyness! Now if I could only figure out a turning script with the same Wiimote (if you can’t tell by this point, I’m not too bright in the realm of programming) Actually, just thinking about it, it might not be that hard!


Here is the running script that I found on Friday (oh and if you can’t tell, I don’t blog on the weekend because I have a life hehe)


/*                  Wii R Walking v1.0
*                 Created by Rhys Legault                 *
*                        *
*             Last Modified: February 19th, 2007          *
*  Feel free to use, modify and redistribute this script  *
*  About:
*  This script identifies if you are still, walking or running
*  Requirements: 1 Wiimote
*  Directions:
*  Throw the wiimote into you pocket and start walking or running
*  This can be around the room or on the spot it doesn’t matter.
*  Just don’t run into anything!
*  The debug window will show that you are either still, walking or running
*  If required, adjust the threshold values to suit your needs.
*  If you want to use this script inside of another script use the
*  Search->Replace tool and replace all Wiimote values to Wiimote2
*  You won’t be able to use any of the buttons the Wiimote while it’s
*  in your pocket so you will require another Wiimote for any button
*  assignments
*  Notes:
*  To protect your Wiimote you can put it into the original plastic packaging
*  of an additional Wiimote (not the Wiimote’s packaging in the Wii bundle)
*  It fits perfectly & the buttons will not be pressed while you’re running

//Amount of time between calculating movement status
//1 = 25ms, 4 = 100ms, 5 = 125ms, 10 = 250ms, 20 = 500ms, 40 = 1000ms
var.Timing = 20

//Threshold values for Walking & Running
var.WalkingThreshold = 20
var.RunningThreshold  = 60

//Sets the maximum forces applied to the wiimote
if abs(Wiimote.RelAccX) > var.MaxAccX then var.MaxAccX = abs(Wiimote.RelAccX)
if abs(Wiimote.RelAccY) > var.MaxAccY then var.MaxAccY = abs(Wiimote.RelAccY)
if abs(Wiimote.RelAccZ) > var.MaxAccZ then var.MaxAccZ = abs(Wiimote.RelAccZ)

//Adust var.Timing if you want to change how often the TotalForce is calculated
if (PIE.Frame % 40) % var.Timing = 0
   //Calculates the total of the max forces applied to the wiimote
   var.TotalForce = var.MaxAccX + var.MaxAccY + var.MaxAccZ

   //Resets the max forces applied to the Wiimote
   var.MaxAccX = 0
   var.MaxAccY = 0
   var.MaxAccZ = 0

//Displays movement status
if var.TotalForce < var.WalkingThreshold
   debug = “Still”
elseif var.WalkingThreshold < var.TotalForce < var.RunningThreshold
   debug = “Walking”
   debug = “Running”

If I could get a decent Mouselook script going, then I would have a perfect Movement/Vision script and at least that portion would be finished. I think this is what I’m going to work on tonight!


Goodbye GlovePIE, Holla Java!

September 12, 2008

So, last night I rolled up a noob toon on Deathwhisper named Thules, just to test out my set up on Tortage.


Yeah…and… it actually worked! Minus a few bugs it was fairly successful. I ran around the island slicing left, right, down all the while bonking alligators with the giant broken oar I had. It didn’t quite get my heart pounding, but I can see a lot of potential for this.


If I can figure out a way to create a mechanism that makes your character jog when you jog, and turn right or left when you do (hehe, and jump when you jump!) it definitely would be better. And I know I am not going to accomplish this with the Dance Pad, so I’m going to have to retire it. But what would replace it?

I really wish the guys at would respond to the emails I send them, because that looks like something I could use. In the end I will probably do something like create a Wiimote/Nunchuck belt that responds to the up & down motion of jogging, and turning etc.


Even though I was able to use my rudimentary bonking and running abilities on Tortage, for some reason the IR mouse in my left hand was being stubborn, and none of the buttons on EITHER Wiimote were working properly. I think that my script is simply too complex for GlovePIE, or I am doing it wrong. Either way, I believe at this point it would be better to ‘borrow’ some projects done by others, and basically weave them together to make what I want. In that way, I would only have to learn a minimal amount of scripting/coding in Java instead of trying to start from scratch with GlovePIE. I’m going to use Java because theoretically it is a cross-platform language, and the gesture recognition library I want to use is written in Java as well.


So, looking at Java APIs for the Wiimote, I have these three so far:



A very simple Java based API for the Wiimote with a graphic UI that is fairly intuitive. It’s very similar to WiinRemote in that it can set commands for all the buttons, and do IR Mouse application. Aside from that, it doesn’t really support gesture recognition so I would have to figure out how to add WiiGee to it for swing recognition support.



“Motej is a slim Java library for Wiimote communication” according to their website.

It simply allows for Wiimote communication and the data from the Wiimote is as unchanged as possible. There seems to be several ‘packages’ that come with it that I don’t completely understand yet. Here are the features comprehensively listed though.

  • Discover and connect to Wiimote devices
  • Wiimote IR Camera in both basic and extended mode
  • Wiimote Accelerometer
  • Wiimote rumble feature
  • Wiimote player LEDs
  • Wiimote buttons
  • Read Wiimote EEPROM memory
  • Write Wiimote registers
  • Wiimote Status Information
  • Wiimote Calibration Data

So it definitely allows for comprehensive data gathering from a Wiimote. Now to interpret that data into actual key strokes might be a different monster all together.


Also, there is no graphic UI, so I might have to add that myself? (gulp) Although it provides several ‘demos’ with it.


Wiimote Simple

I’m not exactly sure how ‘Simple’ this API is. Although it claims to have “less functionality than WiiremoteJ” the features it lists are the same as Wiiremotej

The features listed are:

  • Read accelerometer data, useful for responding to dynamic swinging actions.
  • Read infrared camera data, useful for cursor pointing.
  • Respond to button pushes.
  • Vibrate Wiimote.
  • Set lights on the Wiimote

    The one thing that interests me is the “useful for responding to dynamic swinging actions” in that it mentions “swing” and not “flick” because so far the only action that I can read or interpret from the Wiimote is an almost-instantaneous flick action.


    In the end, I want to combine one of these API’s with the WiiGee Java-Based Recognition Library so that I can have button interpretation, an IR mouse, AND complex gesture recognition so that both Wiimotes will be able to properly & comprehensively communicate with AoC. So for now I’m dumping GlovePIE. It was great while it lasted, but unless I’m scripting retarded with it, I’m pretty sure that the language is a bit too limiting for what I want to do. Therefore, on to Java!

    I guess when I get home I’ll install Java and the Bluetooth Java Library etc and see how it all works. Maybe I know more about Java than I think I do.


    Exergaming FTW

    September 11, 2008

    Another night of updating the code, and fixing a few small bugs. After restarting the ‘Swing Recognition’ script that I wrote, I’ve had better success, but for some reason it won’t trigger if, say, you swing a Wiimote left for 45 ms.


    Here is an example of the code I wrote for the Down swing.

    //Swing script Sept 10

    //Amount of time allowed between sequence actions
    PIE.SeqReadGap = 50ms

    //Amount of accelation required for action to occur
    var.AccelerationThreshold = 1.5

    //Amount of time between a flick action
    var.ActionGap = 150ms

    //Amount of time to hold key press
    //Used in example functionality (Delete if unused in custom functionality)
    var.HoldKey = 50ms

    if var.WiimoteFlick = false

    //Swing Down
    If Wiimote.RawAccY <= -29 m per s per s and Wiimote.Roll < 45 and Wiimote.Roll > -45 then
    var.WiimoteFlick = true

    //Custom script functionality starts here
    say “Wiimote down”
    wait var.HoldKey
    //Custom script functionality ends here

    wait var.ActionGap
    var.WiimoteFlick = false

    Basically, what it does is checks to see if the Wiimote is not tilted more than 45 degrees in either direction from the face-up position, and if it’s Y Acceleration is going down (is negative). As far as I know, there is no temporal function in GlovePIE aside from detecting velocity since the last script frame. Because GlovePIE is not a linear programming language (which means, I think: it simply repeats itself over and over as fast as it can) it can’t read something like “If Wiimote does X movement, for Y amount of time, then execute Z.”


    Is that correct? Do any of you programming/coding people want to comment? I’m lost with that one. I mean I’d love to figure out how to do Gesture Recognition, because then I could implement it into other programs like World of Warcraft where you have like 30 separate battle skills. So if you traced a circle shape in the air, you would use the Intercept ability (or whatever).


    I don’t think you can achieve accurate gesture recognition with GlovePIE unfortunately.


    Tonight I’ll work on the Diagonally Up Swings that you receive at later levels. I actually could run around Hyborea last night and do some rudimentary swings fairly effectively (albeit awkwardly), but I think if someone got used to this, it would be possible.


    Obviously as I mentioned before, some things would be extremely difficult such as selling/buying at the auction house.

    Off-Topic: Check out what this guy did with the Wii Balance Board! This would be pretty cool to use. Too bad it’s all in a different language.


    Ok so, update from last night. I got the movement script for the Dance Pad finished. I’d really like it if you ran in place your character would move, like the video, but that would be difficult to do (I think) with a DDR pad and I don’t own a Wii Fit. Maybe I could write a script that makes your character run by jogging with a Wiimote in your pocket? Once again, any suggestions of coding/scripting would be helpful, the last time I wrote any script before this was when I was 8 on my mom’s commodore 64!

    Oh yes, and I’d like to add I found this little gem on Youtube. Very interesting idea, but a treadmill is kind of expensive and takes up a huge amount of space. Plus, what if you wanted to stop fast?



    September 9, 2008

    Ok, so after looking at Glovepie, and then looking at how to calculate certain swings, I realize the only way I can do this is by using Calculus (I got an A in it in college…10 years ago!) or simply switch to writing this script in Java and figure out how to combine the efforts of:


    Wiigee Gesture Recognition Library




    Oh yeah, and then I simply need to teach myself how to use the Java programming language!


    That’s all…no big deal… /sigh/


    Oh well, I guess innovative creations are never spawned with ease.


    Anyone know basic Java out there?


    The Script Version 1.0 (early Beta…or whatever)

    September 8, 2008

    My apologies for not posting in the past few days, alas I forgot my Flash memory at work so I didn’t have any copy of what I was writing for the weekend. Now that I have access again, I’ll post parts of my script and describe how each part functions. If you have any suggestions with how to add/change the script, I’m all ears:



    There ya go! 

    Ok, with that massive amount of crap being copy/pasted from my computer I will say this. It does not work yet!


    The swing script doesn’t work properly, the mouselook is really screwed up, and for some reason lost my ‘old’ dancepad script so I have to go back and look at which PPJoy Virtual Joystick Buttons represent the four corners of the Dance Pad so I can script those commands in.


    It doesn’t help that I joined a raiding guild on Thog now, and we did Vistrix last night (it was freaking AWESOME!) and we’re doing Kylikki (sp) and some wurm tonight. I’ll try to get some script fixed before raids start though. The whole thing is looking promising, and it is going to be funny once I actually get my bokken and gladius, which should be in the mail and arriving by the end of this week.


    Yes, yes I know…”You’re gonna put yer eye out with that kid!” heh we’ll see!


    Oh yes, and if you shop at Game Stop, check this out.



    I watched all 90 minutes of it (like 3 episodes), and it cracked me up. Well done sir! (Even if it was a shameless copy of ZeroPunctuation’s Yahtzee)