-->

Archive for October, 2007

Tutorial Thursday - Hello World in a GUI

Thursday, October 11th, 2007

Tutorial Thursday

Note to self: make crappy logo.

So, last week, we made a messagebox.
That was totally fun, wasn’t it?
You bet your ass it was.

But now, we’re going to do the same thing, except this time, we’re also making a Graphics User Interface (GUI) around it, which is just a tiny bit trickier.

First things first; start your favorite code editor (PSPad *hint hint*) and type the following:

#include <guiconstants.au3></guiconstants.au3>

Obviously, you will need the AutoIt package.

Now, what this basically does is add some functionality through a set of functions registered in GUIConstants.au3, including a very special one I’m about to introduce.

So, on to the window making.

GUICreate("Hello World!",256,256)
GUISetState(@SW_SHOW)

This makes a window with a caption of “Hello World!” with a width of 256 pixels, a height of 256 pixels and it’s displayed in the center of the screen.

I know you’re now thinking: “YESSSSS. A CODER IS ME.”, but nope, sorry.
This doesn’t really do anything besides open a window and then close it really really fast.

No, what we need is some way to keep it open…

Hmm…

How about…

We feed the program a useless loop that will keep it open… forever!

AWESOOOME.

While 1+1=2
If GUIGetMSG() = Then ExitLoop
Wend

This so called while-loop does exactly what you think it does.
Basically it translates into “as long as condition is met do following action”
For example:

As long as Timmy is being a dick, keep punching him.

In actual code, this would translate into:

While == “dick” funPunch() Wend

I hope that makes sort of sense.

The second thing I need to explain is the If… Then…
In proper English, the syntax would be:

Timmy is gay, so I punch it out of him.

In code:

If == “gay” Then funPunch()

Poor Timmy, nobody seems to like him.

This line:

If GUIGetMSG() = Then ExitLoop

Means that when you click the little x in the corner, the program closes down, because the infinite While loop is exited.
Which is weird, I guess, seeing as it is INFINITE.

To summarize, we now have:
-an empty window

#include <GUIConstants.au3>

GUICreate("Hello World!",256,256)
GUISetState(@SW_SHOW)

While 1+1=2
If GUIGetMSG() = Then ExitLoop
Wend

AWESOME.

Time to add stuff.
We update the code as follows, replacing the old crap:

#include <GUIConstants.au3>

GUICreate("Hello World!",256,256)
GUICreateLabel(“Hello World!”, 112,32, 256,24)
GUISetState(@SW_SHOW)

While 1+1=2
If GUIGetMSG() = Then ExitLoop
Wend

The GUICreateLabel bit adds… a text… thingy.
It’s a label I guess.
It’s built up quite easily:
-”the text you want to display between brackets”
-start x coordinate
-start y coordinate
-width of control
-height of control

Where (0,0) is the top-left corner of the screen.

Personally I think AutoIt’s display system is not that awesome.
I would’ve preferred if it was (startx,starty, endx,endy), but you can’t have it all I guess.
You have to… row… with the… belts… you have.

The AutoIt manual has many more types of controls, at the section Function Reference -> GUI Reference -> GUI Control Creation.

So try some funky combinations, because next week, we’re going to do Functions and Variables.

AND DO YOUR HOMEWORK BECAUSE THE NEXT ASSIGNMENT ACCOUNTS FOR TWENTY PERCENT OF YOUR GRADE.

Class dismissed.

Previous tutorials:
#01: Hello World in AutoIt

-knite

Dinner money

Monday, October 8th, 2007

Hi, guys, how was your weekend?

Wait, nevermind, I don’t really care.

Today my mom wouldn’t be home for dinner, so I had to make my own.
Normally, this wouldn’t be much of a problem, she trained me well in the ways of “boiling water and putting in spaghetti and getting one of those sauce pots and put that in too”.
But Monday is a crappy day.

After school (14:10 or ten past two if you’re an IDIOT) I immediately go to homeworkcouncellingwhatsemacallit, and I stay there to play Free Rider I MEAN DO SERIOUS HOMEWORKING until 17:30 (half past five).
Which means I get home at 17:50 (ten to six), and I have about 40 minutes to eat dinner, let alone prepare it.
This is because I have music practice at 19:45 (quarter to eight) and it’s about a 50 minute ride on the bike to Zaltbommel, and I don’t want to be late etc.

So my mom said, okay, here’s some money, buy some food when you go to homework councelling, or warm up some soup, whatever.

I decided to scrap the idea of buying dinnorz (ewl, that would probably require effort or something), and just warm up some soup with some bread and crap.

So I’ve just come back from music practice (it ended at 21:30 (half past nine)) and my mother asked me what I ate and I said soup and she… wanted… the money… back…

Am… am I… a bad person for thinking she’s a stupid hag if she’s going to throw a fit over 5 euros?

Because, seriously, even at minimum wage, that’s fucking nothing.

Also, I’ve figured it out why my parents were getting along so well for fifteen years and then decided to split up (yes that is totally said boohoo): my father is Chaotically Organized while my mother is Structurally Disorganized.

At my father’s apartment, it’s a giant mess, but he knows exactly where everything is and everything has its place etc.
At my mother’s hosue, it’s clean, on the surface, everything has its place (but it’s never there) and it’s basically chaos.

But this is just a partial theory, I might need to invest more time into it…

-knite

Fuck yes.

Friday, October 5th, 2007


You will watch this video, and you will love it.

The end.

Vice City friggin roolz.

Thursday, October 4th, 2007

I love Vice City.

No, I mean, I really really love it.

It has been ages since I’ve played it, but I finally picked up a non-illegal copy this saturday and according to my Xfire profile (BorQube, add me!), I’ve been playing it for 39 hours since Saturday afternoon, when I bought it.
Which is, you know, an obscene amount considering I have about three hours of free time a day thanks to my SUPERHARSH school + homework schedule.

Anyway, I now own the entire right side of the island, except for that DAMN Malibu Club, and all without cheating!

I’m so proud of myself.

Vice City’s flaws:
-cops are riding your ass, and only YOUR ass, other petty criminals only get chased by a copper instead of full-blown chases and stuff
-the A.I. is… pretty crappy
-cars and pedestrians disappear COMPLETELY RANDOMLY
-there aren’t enough properties to buy goddammit

Vice City’s awesome stuff:
-tiny little jokes like “CherryPopper” icecream, “You can’t beat our meat!” for a meat company and “Why don’t you get wood and do it yourself?” for a DIY store
-$100 dollar penalty for wasted and busted instead of GTA2’s friggin lives system
-insane and fun missions, and tons of them too

San Andreas wasn’t as arcadey and fun in my opinion.
Sure it was BIGGER, but bigger isn’t always better, right ladies?

Basically, it had too much micromanagement and RPG elements, with the whole “learning to shoot guns” and “training stats” and “realism”.

But San Andreas has better explosions, so I guess it gets points for that.

Liberty City (GTA IV for the uninitiated) is looking AWESOME by the way.

I will now leave you with the saddest thing evah. ;[
Friend’s Network
Hottest Game: Grand Theft Auto - Vice City 39 total hrs this week
Most Dedicated Gamer: knight666 39 total hrs this week

-knite

Tutorial Thursday - Hello World in AutoIt

Thursday, October 4th, 2007

Tutorial Thursday.

Yes, ladies and gentlemen, today is going to be the very first Tutorial Thursday.
Which, as you might have guessed, is going to be a recurring event.
Today’s Tutorial Thursday (reiteration lawlz) is going to be about a dinky little programming language called AutoIt.

AutoIt originally started as an automation tool.
It’s very easy to make small programs with it and have them automate certain tasks.
This also gives it… certain… virussy… properties, but it’s like chemistry: you can use it to make bombs or purify water.

But we’re not going to make virussy things today, today we’re going to do that stupid little thing that every programming book ever will tell you to do:

[dramatic pause]

Make a “Hello World!”.

Now, I know a bunch of programmers (just kidding, I don’t know anyone) who absolutely loathe the “Hello World!” tutorial.
I like to refer to them as “twats”.
Saying you don’t like “Hello World!” because EEEEVERYBODY uses it as a tutorial is like saying you don’t like “2 + 2 = 4″.
It’s just cute, fucktards.

Now, before you start download PSPad.
This is not a request, this is a friggin demand.
Why?
Because it’s AWESOME. \m/ >_< \m/
In fact, it’s so awesome, it’s going to deserve its own blog post.

So what do you need for this tutorial:
-Windows (no Mac or Linux for you)
-PSPad (or, like, Notepad or whatever)
-The AutoIt package (available at www.autoitscript.com)
-A keyboard

Now, in theory, this is going to be extremely easy.

Open your respective text editor and type:

MsgBox(64,"Hello World!","Hello World!")
exit

Save the file as “helloworld.au3″.

Now load up AutoIt.exe and select the file and press OK to compile and load it.

YES.
THAT IS IT.
YOU HAVE JUST MADE YOUR FIRST AUTOIT PROGRAM, CONGRATULATE YOURSELF AND EAT A COOKIE.

Now, what this program does:

AutoIt: hey, uhm, Computer, is it okay if I like, make some classes and stuff, and do something with them?
Computer: K.
AutoIt: awesome :-) i would like to make the class class “MsgBox” and it will display a box
Computer: Whatever.
AutoIt: and then it will have a nice information bubble icon next to it, which i define using the flag “64″.
Computer: You’re annoying.
AutoIt: and then i define that the message box will have “Hello World!” in its caption
Computer: Stop talking.
AutoIt: and then the message box will read “Hello World!”
Computer: Goddamn you’re annoying.
AutoIt: and when i’m done doing that, i will close the program
Computer: You’re not sitting next to me at lunch anymore.

The next tutorial will be pretty much the same, except we’ll first make a GUI around the message.

CAN YOU WAIT FOR IT?
I SURE CAN’T!

-knite

Next week: Hello World in a GUI

Hai guyz.

Thursday, October 4th, 2007

Yesssss, I finally did it.

I’m making a blog.
STARTING RIGHT NOW.
This blog will be about the stupid stuff I think about all friggin day.

So, hi, you can refer to me as knight666.
I’m an 18-year old final year student living in ’s-Hertogenbosch, the Netherlands.
I have been diagnosed with ADD (light version) and autism (diet version), which makes me Slightly Sane I guess.

Continued tomorrow!
(Maybe)

-knite

Hello world!

Thursday, October 4th, 2007

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

echo “Hello World!”;
document.write = “Hello World!”;
MsgBox(64,”Hello World!”,”Hello World!”)
draw_text(0,0, “Hello World!”)

Bonus points to those who can recognize every one of the programming languages I used.

-knite