Archive for March, 2012

Base Conversion

I posted this at RMRK a couple of days ago. This is just something awesome about Ruby I noticed, I can’t really think of any practical uses for this. It’s basically just harnessing the String.to_i(base) function that Ruby comes built-in with. I created a method that makes it simpler, and fixes some bugs with converting to base 1. The way it works is:

String.convert_base(from, to) – where String is an instance of the String class (anything in quotation marks), even letters, where from is the base you are converting from, and to is the base you’d like it to convert to. Of course, this only works up to base 36 (ten digits + 26 letters), and down to base 1, because other bases are kinda impossible without hard-coding them in. And they wouldn’t be practical at all anyway.

Here are some examples: “38”.convert_base(10, 2) -> 100110. This has converted 38 from decimal to binary. “”.convert_base(2, 10) -> 284. This has converted  from binary to decimal. “Pacman”.convert_base(36, 10) -> 1529039327. This has (awesomely) converted “Pacman” from base 36 (where all letters of the alphabet have a numerical value) to decimal. “2073739462”.convert_base(10, 36) -> “yanfly”. This has converted those numbers into letters.

Anyway, you can get the snippet here. Play around with it, whatever. Note that it’s incredibly cool, because if you’re a nerd like me you’ll have fun converting numbers to letters and vice-avers with from = 36 and to = 10, or the other way around. That is all. I’m a bit behind on my scripting, sorry about that. Turns out school’s a bitch. Yanfly’s taking a well-deserved scripting break, so I might do some catching up while he does that. I’ve got holidays coming up soon, so I anticipate some scripting then.

Enjoy, I’ll probably be back with a script next time.

An Important Decision

It’s been almost a year since I began work on PAC. And it’s not even close to being finished. Most of it is mainly from when I was an incompetent scripter, and copied a lot of other people’s code. Some very good things came out of PAC, mainly the Main Menu (squeee). But I think it’s time I thought more realistically about this.

I don’t think I’ll ever finish it, the way I’m going. I’m just not motivated enough. All that’s left to do are really big things; message system, battle system, equip system, status scene. I just don’t think I can tackle projects that big with no motivation. So I’ve decided to stop working on PAC, as it was just a half-assed effort to pump some scripts out and gather some fake publicity.

While I won’t be working on PAC anymore, I’ll still occasionally write a script for VX, and do requests. And I’ll also be doing Ace. I might even be stupid enough to start an engine for Ace. We’ll see.