Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: (Hexamin) on March 17, 2010, 10:36:45 am

Title: Writing Skills in a Menu: [RESOLVED]
Post by: (Hexamin) on March 17, 2010, 10:36:45 am
Edit: self.contents.draw_text(x, y, width, height, $data_skills[id].name)
The problem wasn't with how I was calling this, I was using contents.text_size to try to write the width and x value, but it couldn't convert the $data_skills[id].name into a fixnum to determine its size for some reason.  Anyway, thanks for your time!

I want to write in skills into a menu i'm working on.


self.contents.draw_text(0, 0, 100, 32, ?!?!?!?)


I've not been able to figure out what to put in "?!?!?!?" to call a specific skill.  Say... skill #2 in the database.  Or... skill $game_variables[26] in the database.

Anyone mind helping me with this simple syntax problem?

THANKS ^_^
Title: Re: Writing Skills in a Menu: HELP!
Post by: Fantasist on March 17, 2010, 11:07:11 am
I can't remember what to use, but it's a good idea to check Window_Skill refresh method, it'll give you a clue ;)
Title: Re: Writing Skills in a Menu: HELP!
Post by: Sase on March 17, 2010, 11:08:42 am
I don't know much about scripting but I'd say skill.name
I guess for that to work you have to load the "skill" beforehand.
Title: Re: Writing Skills in a Menu: HELP!
Post by: Jackolas on March 17, 2010, 11:14:22 am
out the top of my head:

$data_skills[id]
Title: Re: Writing Skills in a Menu: HELP!
Post by: (Hexamin) on March 17, 2010, 11:31:59 am
yeah I've been rummaging through window_skills, and trieds $data_skills[id], but no dice so far.

I'll keep lookin' though.

Actually, let me dissect this further for ya'll, maybe you can brainstorm better than I.

In Window_Skill it uses this to draw the skill like I'm wanting to.

self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)


So looking at "skill.name", .name is just a method for whatever "skill" is.  They define skill like this in the current method.


skill = @data[index]


So now I have to find what @data[index] does.  In the refresh method they initialize @data with this.


@data = []


And then create a loop which pushes items into the array based on what, I have to assume, is the actor's current skills.


    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        @data.push(skill)
      end
    end


So it pushes skill into the array, @data, and then repeats for each interval of i.


skill = $data_skills[@actor.skills[i]]


Now I must analyze @actor.skills and determine just what value this can be.  Jumping back to the skill scene we find that @actor = $game_party.actors[@actor_index], so it is just a number, so I don't see why I wouldn't be able to just use $data_skills[id].name in self.contents.draw_text to write the skill....

*ponders*