The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Shinami on July 15, 2012, 08:30:55 PM

Title: [RMVXA]Hash help please?
Post by: Shinami on July 15, 2012, 08:30:55 PM
It has been AGES since I've touched scripting much less RPG Maker. So, I'm fuzzy as can be on how to script with hashes. Everything I remember says this code block should work without ANY problems. What am I doing wrong?


  def self.r12_mission
    list = {} #INIT HASH list { ID => mission name, mission desc}
    list = {
    1 => self.name(1), self.desc(1),
    2 => self.name(2), self.desc(2),
    3 => self.name(3), self.desc(3),
    4 => self.name(4), self.desc(4),
    5 => self.name(5), self.desc(5),
    6 => self.name(6), self.desc(6)
    }
    return list 
  end
Title: Re: [RMVXA]Hash help please?
Post by: cozziekuns on July 15, 2012, 09:11:25 PM
Unless I'm mistaken, each value of the hash should be in array form.


list = {
  1 => [self.name(1), self.desc(1)],
  2 => [self.name(2), self.desc(2)],
  ...
}
Title: Re: [RMVXA]Hash help please?
Post by: Shinami on July 15, 2012, 09:54:15 PM
*hangs head in shame* I forgot something so simple...well, at least I realized what I was doing wrong in another section of the script after a cigarette break. Ironically, it was something simple there too.