Looking for a script call for the *name* of an actor's learned ability.

I'm trying to use Show Choices to make the player choose from a list of all of a specific actor's learned skills.

I'm using Fomar's More Choices script to allow for more than four choices, but I can't figure out what the script call is supposed to be to get the name of the skill.

Code:
=begin
More Choices
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
No requirements
Allows you to have more than four choices
----------------------
Instructions
----------------------
Edit the method more_choice and then use the call in
a choice option.
----------------------
Known bugs
----------------------
None
=end
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ● Edit Here
  # when handle
  #   $game_message.choices.push("a choice")
  #--------------------------------------------------------------------------
  def more_choice(p)
    case p
    when "Abilities"
      $game_message.choices.push($game_actors[3].skills(1))
      $game_message.choices.push($game_actors[3].skills(2))
      $game_message.choices.push($game_actors[3].skills(3))
      $game_message.choices.push($game_actors[3].skills(4))

# This one is the example setting, which works fine.   

    when "Pizza Topping"
      $game_message.choices.push("Ham & Pineapple")
      $game_message.choices.push("Meat Feast")
      $game_message.choices.push("Chocolate")
      $game_message.choices.push("BBQ")
      $game_message.choices.push("Diamonds")
      $game_message.choices.push("Spicy Chicken")
      $game_message.choices.push("Garlic")
   
    $game_message.choices.push("Cancel")
    else
      $game_message.choices.push(p)
    end
  end
  #--------------------------------------------------------------------------
  # ● Long Choices - Don't edit this bit
  #--------------------------------------------------------------------------
  def setup_choices(params)
    for s in params[0]
      more_choice(s)
    end
    $game_message.choice_cancel_type = params[1]
    $game_message.choice_proc = Proc.new {|n| @branch[@indent] = n }
  end
end

class Window_ChoiceList < Window_Command
  #--------------------------------------------------------------------------
  # ● Feel free to change the 1 to another variable that you'd prefer
  #--------------------------------------------------------------------------
  alias mc_call_ok_handler call_ok_handler
  def call_ok_handler
    $game_variables[1] = index
    mc_call_ok_handler
  end
end

I'm sure there's something fundamental about Ruby here that I'm missing.

EDIT: As is, I'm getting the error, "Argument Error: wrong number of arguments (1 for 0)"
deleted
On the Abilities part, change skills(id) to skills[id] because skills is an array not a method.. That is why you are getting an argument error of 1 for 0 when you're trying to do more_choices("Abilities").

If you want the name of all abilities of an actor, you should probably just do either

Code:
$game_actors(3).skills.each |skill|
 $game_message.choices.push(skill.name)
end

or

Code:
$game_actors(3).skills.each |skill|
 $game_message.choices.push($data_skills[skill].name
end

Not sure which one is correct

@Rorinator2 - actually, you use the script by calling more_choices(string key) i.e. more_coices("Abilities")

Doing choices.push("Abilities") will simply add a choice titled "Abilities"
choices.push("Abilities")
Well if I look up the script page and see the image on how to use it, it all makes sense.
On the Abilities part, change skills(id) to skills[id] because skills is an array not a method.. That is why you are getting an argument error of 1 for 0 when you're trying to do more_choices("Abilities").

If you want the name of all abilities of an actor, you should probably just do either

Code:
$game_actors(3).skills.each |skill|
 $game_message.choices.push(skill.name)
end

or

Code:
$game_actors(3).skills.each |skill|
 $game_message.choices.push($data_skills[skill].name
end

Not sure which one is correct

@Rorinator2 - actually, you use the script by calling more_choices(string key) i.e. more_coices("Abilities")

Doing choices.push("Abilities") will simply add a choice titled "Abilities"

So of all of these, the only one that didn't cause a crash was:

Code:
$game_message.choices.push($game.actors[3].skills[1])
$game_message.choices.push($game.actors[3].skills[2])
$game_message.choices.push($game.actors[3].skills[3])
$game_message.choices.push($game.actors[3].skills[4])

Which opens a choice window perfectly, but the window contains:

#<RPG::Skill:0x9719f68>
#<RPG::Skill:0x97036c8>
(blank space)
(blank space)

Which is at least an improvement \o/ I'm assuming those hex codes refer to the skills themselves? Is there a way to make it display the names instead of the hex codes?
What if you make it as

Code:
skills[id].name unless skills[id].nil?

Also what errors did you get from the others? I think I missed a piece of code on them lolz and also used () instead of [] on the actors part

should probably be

Code:
$game_actors[3].skills.each do |skill|
 next if skill.nil?
 $game_message.choices.push(skill.name)
end
What if you make it as

Code:
skills[id].name unless skills[id].nil?

Also what errors did you get from the others? I think I missed a piece of code on them lolz and also used () instead of [] on the actors part

should probably be

Code:
$game_actors[3].skills.each do |skill|
 next if skill.nil?
 $game_message.choices.push(skill.name)
end

These both worked \o/

Next thing I need to figure out is how to make the character *forget* the chosen skill. I put the following script in a conditional branch:

Code:
$game_actors[3].forget_skill[1]

And that one gave me "Script: 'Game_Interpreter' line 1411: ArgumentError occured. wrong number of arguments (0 for 1)

Code:
$game_actors[3].forget_skill($game.actors[3].skills[1])

And that one gave me "Script: 'Game_Interpreter' line 1411: NoMethodError occured. undefined method 'actors' for nil.NilClass

The second one *looks* more "right," but I think again I'm hitting a wall of Stuff I Don't Know About Ruby >__<
I got it!

Code:
forgetting = $game_actors[3].skills($game_variables[81]).id 
$game_actors[3].forget_skill(forgetting)


Where "81" is the variable selected as the response to the Choice in the choice script.

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-script-call-for-the-name-of-an-actors-learned-ability.109282/