Main Menu
  • Welcome to The RPG Maker Resource Kit.

Problem with a script.

Started by thanatos2k1, June 27, 2011, 05:19:09 AM

0 Members and 1 Guest are viewing this topic.

thanatos2k1

Ok, so it's my second day attempting to learn the ruby languauge.. and I am doing Dubealex's excercises..
http://www.creationasylum.net/forum/index.php?showtopic=4854&st=0

Now, I'm creating Window_2:

class Window_2 < Window_Base
 
  #BLOCK 1
  def initialize
    super(0, 0, 200,380)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial" 
    self.contents.font.size = 24
   
    #BLOCK 2
        for i in 0...$game_party.actors.size
      x = 0
      y = i * 90
      actor = $game_party.actors
      self.contents.font.color = text_color(6)
      self.contents.draw_text(x, y, 200, 32, $game_party.actors.name)
      self.contents.font.color = text_color(4)
      self.contents.draw_text(x, y+32, 200, 32, actor.class_name)
    end
  end

end

______________________________________


I'm using a call script to access:

Window_2.new

________________________________

Now, it doesnt crash when I load the game, however it gives an error when I trigger the script:

Script 'w2' line 11: NoMethodError occurred.
undefined method 'actors' for#<Game_Party:0x45a2930>

_______________________________________

I'm guessing its choosing "actors" instead of "size" as the method, I don't know why.  It's identical to what's written on the page.
Does anyone have any idea?


pacdiggity

Your main problem, I suspect, is that you're writing an XP script in VX.
In VX, Game_Actors on its own is a class. Because I don't have it in front of me, I can't tell you the exact method you should use, but look through that to see if you can find it.
it's like a metaphor or something i don't know

thanatos2k1

Yes, yes!  I figured that was it, but I also thought it's probably the same language, but the classes could be different.. Do you know any good scripting tutorials for VX? Because the next lesson didn't work for me either.. Im gonna go searching through the script to see if I can find the class.