Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - fugibo

RPG Maker Scripts / Window Additions
July 15, 2010, 01:11:55 pm

- With this script, you can now create animations:
Window_Animation.resize 200, 200 # resize a window to 200x200
Window_Animation.move 50, 50 # move a window to (50, 50)

# this one makes a window hover up and down do |window|
 window.displacement_x = window.displacement_y = Math::sin((Graphics.framecount % 360) * Math::PI / 180)

- You can also add objects to windows as thus:
window << object # the method named "insert_<object class>" is called, i.e. for a string "insert_String" would be called
window << animation # adds the animation, so that window#update will call it
class Window_Animation
 def self.resize width, height
   return do |window|
     if window.width > width
       window.width -= 2
     elsif window.width < width
       window.width += 2

     if window.height > height
       window.height -= 2
     elsif window.height < height
       window.height += 2
 def self.move x, y
   return do |window|
     if window.x > x
       window.x -= 1
     elsif window.x < x
       window.x += 1
     if window.y > y
       window.y -= 1
     elsif window.y < y
       window.y += 1
 def self.proc &block
 def initialize &block
   @block = block
   @hash = {}
 def call window window

class Window
 attr_reader :displacement_x, :displacement_y
 alias fugibo_window_additions_initialize_alias initialize
 def initialize *args
   @animations = []
   @displacement_x = 0
   @displacement_y = 0
 def << object
   send 'insert_#{object.class}', object
 def insert_Window_Animation animation
   @animations << animation
 def insert_Proc proc
   @animations << Window_Animation.proc(proc)
 alias fugibo_window_additions_update_alias update
 def update
   @animations.each do |animation|
 def displacement_x= x
   self.x += x - @displacement_x
   @displacement_x = x
   return x
 def displacement_y= y
   self.y += y - @displacement_y
   @displacement_y = y
   return y

a scripter's "tool." some methods added to the Window class and a new class (Window_Animation, not sure if that name's taken already). neat example (assuming the code works, which it should:)

w =
w.width = 160
w.height = 120
w.x = 240
w.y = 180

w << Window_Animation.move 120, 80
w << Window_Animation.resize 320, 240
w << do |window|
 w.angle = Graphics.framecount % 40 - 20

loop do
 if Input.trigger? Input::C
Have Fun: ShowHide

module Rum
 class Node
   include Enumerable
   include Comparable
   attr_reader :parent, :label, :body, :attributes
   def initialize parent, label, attributes = {}
     @parent = parent
     @label = label
     @attributes = attributes
     @body = ''
     @children = []
   def <=> other
     if other.kind_of? Node
       if @label == other.label
         return @attributes <=> other.attributes
         return @label <=> other.label
       raise ArgumentError, "Unable to convert #{other.class} to Node"
   def [](attr_name)
     return attributes[attr_name]
   def each
     @children.each {|node| yield node}
   def find label=nil, attributes=nil, &block
     # kinda slow. it could probably use some optimization.
     super() do |node|
       (label == nil ? true : node.label == label) and
       (attributes == nil ? true : attributes.all? {|key, vaue| node[key] == value}) and
       (block == nil ? true :
   def select *args, &block
     subset = @children.clone
     args.each do |arg|
       if arg.is_a? String
         subset.delete_if do |node|
           node.label != arg
       elsif arg.is_a? Hash
         subset.delete_if do |node|
           arg.any? do |key, value|
             node[key] != value
     if block != nil
       subset.each do |node| node
     return subset
   def push object
     object.kind_of?(Node) ? @children.push(object) : raise("Cannot add non-node #{object} as child of node #{self}")
   def child_count
     return @children.count
   def to_xml indent=0
     tab = "  " * indent
     if @body.size == 0 and @children.empty?
       return "#{tab}<#{@label}#{attributes_to_xml_string} />"
       return "#{tab}<#{@label}#{attributes_to_xml_string}>\n#{tab}\t#{@body}\n" << (@children.inject('') {|s,n| s << n.to_xml(indent+1)}) << "#{tab}</#{@label}>\n"
   def spawn label, attributes = {}
     node =, label, attributes)
     self.push node
     return node
   def attributes_to_xml_string
     return @attributes.inject(' ') {|string, pair| string << "#{pair[0]}=\"#{pair[1]}\""}
 class Document < Node
   def xml_attributes_from_string string
     attributes = {}
     if string != nil
       string.scan(/(\w+?)="(\w+?)"/) do |pair|
         attributes[pair[0]] = pair[1]
     return attributes
   def tags_from_xml string
     node = self
     string.scan(/(<[^>]+>|<\/[^>]+>|[^<]*)/) do |sub|
       case sub[0]
       when /<([\w\-]+?) (.+)?\/>/ # simple node
         node.spawn $1, xml_attributes_from_string($2)
       when /<([\w\-]+?)( (.+) ?)?>/ # complex node (open)
         node = node.spawn $1, xml_attributes_from_string($2)
       when /<\/([\w\-]+?)>/ # complex node (close)
         if $1 == node.label and node != self
           node = node.parent
           raise "Attempted to close tag named '#{$1}'; current tag is named '#{}'"
       else # node content
         node.body << sub[0].strip
     return self
   attr_reader :source
   def self.open_xml filename, &block
     document = :xml,
     if block != nil document
     return document
   def self.xml source, &block
     document = :xml, source
     if block != nil document
     return document
   def initialize type=:xml, source='', &block
     super nil, ''
     @source = source
     case type
     when :xml
       tags_from_xml @source
     if block != nil self
   def to_xml
     # overridden to avoid enclosing <></>
     return @children.inject('') {|string, node| string << node.to_xml}

Rum is a pure-Ruby library I wrote today that can be used to load, manipulate, and save XML files. What makes it different from REXML/&c.? This:

#! /usr/bin/ruby

require 'rum'
include Rum

<class id="101">
 <student id="99887" name="John" grade="11" />
 <student id="44753" name="Jenny" grade="10" />
<class id="102">
 <student id="99887" name="John" grade="11" />
 <student id="68532" name="Jenny" grade="10" />

Document.xml XML do |document|
 # Want to find all unique students in all classes?
 document.collect {|klass|'student')
 # Want to find all classes with a grade 11 student?'class') {|klass|'student', 'grade' => '11').size > 0
 # how many juniors are in the school?'student', 'grade' => '12').uniq.count

 # Want a pretty list of all classes and the students in them?'class') do |klass|
   print "In class #{klass['id']}:\n"'student') do |student|
     print "\t#{student['name']} (student #{student['id']}, grade #{student['grade']})\n"

I still need to do some work on it, such as getting select/find's fancy search mechanisms to work with more of Enumerable, converting the simple node label recognition into more advanced path-style (think CSS selectors, I guess?) recognition, &c.

In the end I want it to be able to do things more like:

# are any seniors in any classes?
document.any? 'class/student', 'grade' => '12'

Do whatever you want with the code.
Programming / Scripting / Web / Project Euler
March 14, 2010, 01:29:53 am

Lots of interesting math/comp. sci. problems. also has proven to me how much I suck at math/programming.

QuoteFind the sum of all the positive integers which cannot be written as the sum of two abundant numbers.

and my processor is still eating away at #3 and #10 ><

I gave up on #3 for now, my prime number algorithm needs some serious revision. I'm currently taking the factorial of 1,000,000 for my lexicographic permutation prediction algorithm on one core while the other continues to try and find prime numbers up to 2,000,000 (and then add them!).
Chat / Of Lesbians and Constitutional Misconceptions
March 11, 2010, 10:00:06 am
My old high school made it into the news.

I'm tired of everyone assuming that sexuality is protected under the constitution. I could be wrong, but I'm pretty sure that's not in the main document, and I'm fairly certain it hasn't been amended, either.
Electronic and Computer Section / Netflix
March 07, 2010, 01:08:05 pm

If you don't know what this is, it's basically what you've been missing your entire life.
$9 gets you unlimited mail rentals of _tons_ of movies + online watching of some. $13/$16 lets you rent 2/3 movies at a time.

The selection is fairly good, I think. And the online streaming works amazing (I only get 200kb/s most of the time, and I watched The Royal Tenenbaums at DVD quality with nearly no wait).

It has a two-week free trial (similar to WoW, you have to cancel it by the end or it will charge you).

I reiterate:
I stuff my face with skittles until I'm sick, grab some water, and jump straight into documentation + source editing.
RPG Maker Scripts / Open Ruby Game Scripting System
February 16, 2010, 06:48:16 pm
Open Ruby Game Scripting System (or ORGSS) is a specification I am currently working on in my spare time that intends to be 100% compatible with RGSS 1.02e, with the exception of Win32API, with several API modifications to extend the system's capabilities.

Any suggestions, recommendations, or corrections are very welcome.

Current progress (parity with RGSS 1.02e has not yet been achieved; however, I intend to synchrnosize this with work on RGame, a Mac implementation of RGSS 1.02e I am also working on in my spare time):

Terms: ShowHide

  • "Library:" "Library," when used in an ORGSS context, refers to the underlying implementation of ORGSS. For example, RGSS102E.dll forms the "library" for RGSS 1.02e.

Graphics Module
The Graphics module is used to control framerate and display settings.
Methods: ShowHide

  • Graphics.fullscreen?: Returns true if the library currently displays in fullscreen mode, false otherwise.

  • Graphics.fullscreen=(argument): Sets the current fullscreen state to the single argument. If the argument evaluates to true, the library will begin displaying in fullscreen mode, if possible. Returns the current fullscreen state in a fashion equivalent to Graphics.fullscreen?.

  • Graphics.update: Commands the library to update the display, rendering all sprites and viewports. A call to this method will also block Ruby-side execution in an effort to throttle the frame rate.

Input Module
The Input module is used to gather keyboard input data.
Methods: ShowHide

  • Input.update: Updates the current Input state, replacing the Input data with new information gathered since the last call.

  • Input.trigger?(...): Takes one or more arguments, all of which should be strings. If at least one character from any of the strings corresponds to a key has been pressed down between the last call to Input.update and the one preceding it, returns true; otherwise, false.

  • Input.release?(...): Similar to Input.trigger?; takes one or more arguments, all of which should be strings. If at least one character from any of the strings corresponds to a key that has been released between the last call to Input.update and the one preceding it, returns true; otherwise, false.

  • Similar to Input.trigger? and; takes one or more arguments, all of which should be strings. If at least one character from any of the strings corresponds to a key that is currently pressed, returns true; otherwise, false.

Audio Module
The Audio module is used to play audio files.
Methods: ShowHide

  • Audio.play_bgm(name, volume, pitch): Attempts to load and play the BGM file corresponding with name at a volume volume and pitch pitch.

  • Audio.stop_bgm: Stops playing the current BGM, if any.

  • Audio.play_bgs(name, volume, pitch): Attempts to load and play the BGS file corresponding with name at a volume volume and pitch pitch.

  • Audio.play_me(name, volume, pitch): Attempts to load and play the ME file corresponding with name at a volume volume and pitch pitch.

  • Audio.play_se(name, volume, pitch): Attempts to load and play the SE file corresponding with name at a volume volume and pitch pitch.

  • Audio.stop_se: Stops playing the current SE, if any.

Welcome! / Hey
February 02, 2010, 03:53:38 pm
I'm back from the asylum.
Advertising / this is the comic
January 06, 2010, 07:08:18 pm

it's a webcomic written in Ruby on Rails (today. it honestly only took a few hours to set all this up, which includes multitasking a billion things on the computer for the first two and then spending the rest coding + reading documentation. Rails is amazing).

Entertainment / Electric President/Radical Face
January 03, 2010, 01:30:53 pm
Ben Cooper is one of the coolest guys I know of. His music leaves something to be desired, but his lyrics are amazing.

Have any of you even heard of this guy? Just wonderin'
General Discussion / I Would Like Your Opinions
January 01, 2010, 03:34:59 pm
Who else thinks that games (at least story-based ones, such as RPGs) need a hell of a lot more story to them? As in, the story is actually influential on the game, rather than stuff you see between button presses.

IMO, most games use stories for two purposes:

  • To tell you where to go next. I mean, you're gonna need to know, but it's more of a "Well, the next castle is named 'Spinarax' sort of thing" most of the time than inference/background information. Maybe if they made you investigate to find out something (y'know, drop the big bits like what your goal is &c. in a main cutscene, then let you talk to other people for the rest) it would be a lot more entertaining. Plus, for "open-ended" games like Fable, storylines made in this manner would be much more malleable.
  • To entertain immersively, which wouldn't be bad, except that it's more like mashing buttons to watch TV than it is immersion most of the time. During those times, I'm much more likely to just watch a movie or read, since those are dramatically less expensive hobbies and provide much more entertainment for how much effort I have to put in.

I've gotten to the point where I don't even play RPGs any more because the general game play is much more of a boring grind than anything immersive or stress-relieving. The last RPG I played through was 358/2 Days since it was actually simple and entertaining while in-battle, and the missions were usually short enough that I got a good dose of story every 30-45 minutes.

and opine now pl0x
Welcome! / Temporary Leave
December 21, 2009, 09:27:02 pm
I'm trying to go on an online hiatus for now. So yeah, you get a week or so without Longfellow. Enjoy.
Academics / ...
November 29, 2009, 10:04:20 am
I just had a Physics problem that read:
"A pole vaulter clears 6.0 meters. What is velocity just before he hits the ground?"

I could be horribly off, but something tells me that since they gave nothing else and I don't know what his altitude was the moment he "cleared 6.0 meters" or when his maximum altitude would be, I can't solve this problem.

Programming / Scripting / Web / Ruby rot13 Script
November 24, 2009, 07:29:39 pm
I made this a while back and just converted it into an executable library, so I'd thought I'd post it here. The code is probably horribly inefficient, but it works.
#! /usr/bin/ruby
#  This is an executable Ruby library that adds rot13 functinality to the String class,
#  and can encrypt/decrypt STDIN.

class String

def rot13!
size.times do |i|
if self[i].between? 65, 90
self[i] += 13
self[i] = 64 + self[i] - 90 if self[i] > 90
elsif self[i].between? 97, 122
self[i] += 13
self[i] = 96 + self[i] - 122 if self[i] > 122

return self

def rot13
return self.dup.rot13!


if $0 == __FILE__
input = ''
while ( b = STDIN.gets ) != nil
input << b

STDOUT.print input.rot13


EDIT: rot13
RPG Maker Scripts / Uses of Enumerable#collect?
November 15, 2009, 06:22:21 pm
Does anyone know any practical uses for Enumerable#collect? The uses of methods such as select, any?, all?, detect, &c. are all pretty obvious (if esoteric), but I can't see any case in which a coder would need an array of values.
Video Games / Angband
November 04, 2009, 02:26:47 pm

Hardest. Game. Ever.
Video Games / Machinarium
October 26, 2009, 11:32:50 am

Awesome adventure game, for Mac and PC. So far I've only beaten the demo, but I plan on buying it ASAP. I just love that little robot bugger.

I also find it hilarious that all of the folders for the game are named in binary:
<will post pictures when I get home, Interblag is slow right here>
Intelligent Debate / Euphemisms?
October 16, 2009, 09:24:38 pm
I have a feeling of what the general consensus will be already, but I'm just wondering - what does the typical CP user think of euphemisms?
Video Games / 358/2
September 26, 2009, 01:42:11 pm
is buying in 3 days
Programming / Scripting / Web / First Full-Fledged Apps?
September 20, 2009, 11:21:08 pm
I just made mine (RGame is taking forever to develop)! Technically, I've made some before that were just hacks with RGSS and Win32, but this lil' beaute is my first "real" one:

Spoiler: ShowHide

So leik, what was your first app?
RPG Maker Scripts / RGSS Documentation
September 20, 2009, 06:27:10 pm
Yeah, I need you guys to help me with it.

Basically, I just need to know all the classes, their methods, what arguments those methods take, and what value does methods return. If you guys could just do some experimentation (in other words, type random methods into the script editor to see what they return, etc) and tell me the results, it'd help a ton.
Chat / While Searching for SNL Sketches
September 13, 2009, 12:04:38 am
I found a free download for an uppity cow.

Electronic and Computer Section / iTunes 9
September 09, 2009, 10:28:28 pm
They uglified the Mac version.

They made me download a ton of crap just to change the appearance.

It sucks.

Chat / I Love Physics
September 05, 2009, 10:37:42 am
Despite the fact that all the teachers suck at it, I do love the subject.

Here's my favorite problem so far:
Problem: ShowHide

A physics student holds a 2.40-kg block against a wall by pressing on it perpendicularly to the wall. Find the minimum force she must exert if the coefficient of static friction is µs  = 0.32.

My Answer: ShowHide

The force of gravity on the block is 2.4 * 9.8, or 23.52, Newtons. To hold the block, there must be a net vertical force of zero on the object; therefore, she must produce enough force for their to be at least 23.52N of friction on the object. Since µs is 0.32, then it's just the equation 23.52 = 0.32 * Fnormal. Solve for Fnormal to find the force she is exerting and you get ~73-74. So I pick the multiple choice answer around that :P

See? Even I suck at explaining this crap.
Chat / Does this seem Theocratic to you?
August 25, 2009, 04:50:53 pm
QuoteIn the name of God, Amen. We whose names are underwritten, the loyal subjects of our dread Sovereign Lord King James, by the Grace of God of Great Britain, France and Ireland, King, Defender of the Faith, etc.
Having undertaken, for the Glory of God and advancement of the Christian Faith and Honour of our King and Country, a Voyage to plant the First Colony in the Northern Parts of Virginia, do by these presents solemnly and mutually in the presence of God and one of another, Covenant and Combine ourselves together into a Civil Body Politic, for our better ordering and preservation and furtherance of the ends aforesaid; and by virtue hereof to enact, constitute and frame such just and equal Laws, Ordinances, Acts, Constitutions and Offices, from time to time, as shall be thought most meet and convenient for the general good of the Colony, unto which we promise all due submission and obedience. In witness whereof we have hereunder subscribed our names at Cape Cod, the 11th of November, in the year of the reign of our Sovereign Lord King James, of England, France and Ireland the eighteenth, and of Scotland the fifty-fourth. Anno Domini 1620.

Chat / Tabletop/P&P RPG Recommendations?
August 08, 2009, 01:13:16 pm
So, I've been curious about RPGs for a while, but I'm not really sure where to start at. I know D&D is the original and the de facto standard, but I also know there are plenty of others (I alreay have an Arcana Unleashed reference book that I bought ages ago because I thought the spells in it were pwn), but I'm not really familiar with them or their comparative merits. Can anyone with experience shed some light for me?

And even though the system does nothing, you still have to spend hours putting up with it when WGA spazzes on you. *sigh*
Entertainment / Titanium Rhapsody
June 20, 2009, 08:45:15 am
Courtesy of King,

Intelligent Debate / Is he really helping?
June 19, 2009, 09:51:18 pm
I didn't think he was doing that bad of a job until I saw the "New GM" ads.

Which weren't really that bad; they sure beat the Pizza Hut and Subway ads I've seen.

...until I realized they weren't advertising a product.

...and then I realized that they were paid for by taxpayers.

...and that I was a taxpayer.

...and that they never asked us about ANY of this.

Is anyone else mad about this kind of crap? And I'm very, very insulted that our opinions don't matter to him, and that he feels that we should show him our support for no reason. I thought that we were the ones he was working for?

(it's Obama, guys, Obama)
Express your Creativity / Longfellow
June 15, 2009, 04:52:49 pm
Alrighty, so I've decided to post some of the graphics and such I've done in the last year or so (all of it using either Pixelmator, an excellent, cheap Mac graphics editor, or the GIMP, which I'm sure you're already familiar with) so that you guys can comment on, criticize, praise, or jack off to it. (Only one two of those are likely to happen, guess which):

Believe Background

Spoiler: ShowHide

This was created in Pixelmator after I read a couple tutorials (can't remember where they were or what they were on, so sorry).
Distribution/Your Rights:
1280x800 Background wallpaper, you're free to use it as your wallpaper, to share it with others, and to base your own work off of it, but don't forget to credit me. Enjoy!

Yay lollipops! :P

In Aqualungs

Spoiler: ShowHide

This was just me messing around in Pixelmator. Got the name from my friends Tumblr, no idea if it's a popular reference or not (she's into a lot of odd movies and books, so it could be anything).
Distribution/Your Rights:
640x480, methinks. Enjoy.

Eek! The text got slightly pixelated when I changed the perspective. It's not _that_ bad, thankfully.

Signature Bar Thingy

Spoiler: ShowHide

I threw this together with Pixelmator in commemoration of my shift from WcW to Longfellow. Sucks, dunnit? :P
Distribution/Your Rights:
512x24, or something like that. I can't remember. Ask me for permission if you want to use it.

I added the very slight text shadow myself, which was a pain on a couple of the letters (namely, the second O and the W). Also, I noticed that it needed a slight border around it, and it could do with a little more width (800, maybe? Or is that overkill? Someone mind telling me what the best would be?)

Mac & Linux Logo

Spoiler: ShowHide

For those who just love UNIX in general. Made with GIMP.
Distribution/Your Rights:
I have no idea what resolution it is. Public Domain.
<this will be posted in a sec, having trouble uploading>
GIMP sucks on Macs. Srsly. Don't even touch it with a 10-foot stick.

UNIX Wallpaper for iPhone (iPhone Wallpaper = What's Shown on Lock Screen)

Spoiler: ShowHide

For those who just love UNIX in general. Made with GIMP Pixelmator. (Lawlz, Copy+Pasta)
Distribution/Your Rights:
320 x 480. Public Domain, I just took some random images and edited them together (read: don't spread this around, I might get in trouble)

Took 10-15 minutes, and that's with all the searching/fiddling I did with the logos. Fun times :P