Writing Skills in a Menu: [RESOLVED]

Started by (Hexamin), March 17, 2010, 10:36:45 am

Previous topic - Next topic

(Hexamin)

March 17, 2010, 10:36:45 am Last Edit: March 17, 2010, 11:35:54 am by (Hexamin)
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 ^_^
Max 1111101000; characters remaining: 1110111000

Fantasist

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 ;)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Sase

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.

Jackolas

March 17, 2010, 11:14:22 am #3 Last Edit: March 17, 2010, 11:17:04 am by Jackolas
out the top of my head:

$data_skills[id]

(Hexamin)

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*
Max 1111101000; characters remaining: 1110111000