Having some trouble writing a script call

This is the script I'm working with:

class Game_Enemy < Game_Battler
  def change_param(param_id, value)
    enemy.params[param_id] = value
  end
end

This is the script call:

$game_troop.members[iD].change_param(param_id, value)

Here was the information the author gave me to work with:

ID: 1, 2, 3,... (in Troops)

param_id: (0 is Max HP, 1 is Max MP)
  def mhp;  param(0);   end               # MHP  Maximum Hit Points 
  def mmp;  param(1);   end               # MMP  Maximum Magic Points
  def atk;  param(2);   end               # ATK  ATtacK power
  def def;  param(3);   end               # DEF  DEFense power
  def mat;  param(4);   end               # MAT  Magic ATtack power
  def mdf;  param(5);   end               # MDF  Magic DeFense power
  def agi;  param(6);   end               # AGI  AGIlity
  def luk;  param(7);   end               # LUK  LUcK

value: the var.

What I'm trying to do is use this script to change the value of parameters for my enemies - but I'm having issues with the syntax and figuring out what symbols carry over and which ones do not when writing the script call.

So if someone could give me a direct example of how to write out this script call to change the mhp of an enemy to variable 1 it would be a big help to me.  Being able to see it as it is actually written in the event would fix my problems I think.
You'd use this snippet like this:

$game_troop.members[which member? 1-8].change_param(param_id: 0-7, value: any number)The param id corresponds to the list of parameters you have above, 0-7, 6 is agility, 7 is luck, 0 is max health, etc. The value is the number that the parameter should have after the call.

The ID is asking which member of the battle? There can be up to 8 enemies, so you need to choose a number from 1-8, and make sure that enemy is actually in the battle. To make sure they're actually there, use:

Code:
if $game_troop.members[enemy you want] != nil  $game_troop.members[ID].change_param(param_id, value)end
You'd use this snippet like this:

$game_troop.members[which member? 1-8].change_param(param_id: 0-7, value: any number)The param id corresponds to the list of parameters you have above, 0-7, 6 is agility, 7 is luck, 0 is max health, etc. The value is the number that the parameter should have after the call.
For the sake of testing I limited my troop to just 1 type of enemy for now and let's say I'm trying to change mhp of enemy 1 to 999.

This is what I typed:

$game_troop.members[1].change_param

(param_id:0, value: 999)

I got this error:

Unexpected tLABEL

(param_id:0, value:999)

If you could tell me what I did wrong I would appreciate it.
You don't include the param_id: part, you just use $game_troop.members[1].change_param(0, 999).

Sorry, I should have been more clear.
You don't include the param_id: part, you just use $game_troop.members[1].change_param(0, 999).

Sorry, I should have been more clear.
Np.  I'm new to this scripting stuff so it's probably a challenge slowing down to keep pace with my baby steps.  This is what I typed:

$game_troop.members[1].change_param(0, 999)

Now I get this error:

Script `Game_Interpreter` line1411:NoMethodError occurred

undefined method `Change_param` for nil:NilClass

Any ideas?

Edited#

Noticed I forgot to put my 0, like a dumbass.  But after adding that I still get same error I described. 
comment that out (put a # in front of everything) and add this:

puts $game_troop.members[1]and make sure you run the game with a console open (it's under the game dropdown menu in the editor, make sure Console is checked), and then let me know what this prints out.

Edit: also, the error is saying that the method is Change_param. Did you use a lowercase or capital 'C', because that may be the issue here.
comment that out (put a # in front of everything) and add this:

puts $game_troop.members[1]and make sure you run the game with a console open (it's under the game dropdown menu in the editor, make sure Console is checked), and then let me know what this prints out.

Edit: also, the error is saying that the method is Change_param. Did you use a lowercase or capital 'C', because that may be the issue here.
I used a lower case c.  Does it need to be capitalized?  I checked Show Console like you said.

This is what I typed on this attempt, and I'm just copy/pasting from the script on the event itself so everything should be exactly as I wrote it on the game:

#puts $game_troop.members[1].change_param(0,

999)

Now I'm getting this error:

Script 'Game_Interpreter' line1411:SyntaxError occurred

unexpected ')', expecting $end
nono, I meant do this:

Code:
#$game_troop.members[1].change_param(0, 999)puts $game_troop.members[1].inspect
nono, I meant do this:

#$game_troop.members[1].change_param(0, 999)puts $game_troop.members[1].inspect
Ok I did this:

#$game_troop.members[1].change_param(0, 999)

puts $game_troop.members[1].inspect

This didn't give me any errors, but enemy1's MHP didn't change into 999.  Is the 999 an actual amount or is it the variable ID?
Did you see what was printed to the console? That wasn't supposed to change the health, because we commented it out, so it's not run. The '#' tells ruby to ignore this.
Did you see what was printed to the console? That wasn't supposed to change the health, because we commented it out, so it's not run. The '#' tells ruby to ignore this.
Oh, it says:

Nil

_
try without the [1], so

Code:
puts $game_troop.members.inspect
try without the [1], so

puts $game_troop.members.inspect
Did this:

#$game_troop.members[1].change_param(0, 999)

puts $game_troop.members.inspect

If you need me to increase the picture size just let me know and I'll try to resize it.

ScreenShot-3.png
Ahh, your troop only has one enemy in it (and I forgot that $game_troop is a normal array, unlike $game_variables), so use the change_param on $game_troop.members[0]
Ahh, your troop only has one enemy in it (and I forgot that $game_troop is a normal array, unlike $game_variables), so use the change_param on $game_troop.members[0]
Are you wanting me to repeat the earlier process after changing the [1] to [0] then show you what the console says?

Or are you meaning you want me to remove the comment symbol and the second line and just try writing the script call as:

$game_troop.members[0].change_param(0, 999)
Nope, just $game_troop.members[0].change_param(0, 999) should work for you. 
Nope, just $game_troop.members[0].change_param(0, 999) should work for you. 
Cool it's working now, tyvm.

If I was to want to change the MHP to a specific variable rather a number how would I type that?  Maybe this?  change_param(0, [159])  
it wouldn't fit easily in the script box, because of how they work. what you'd have to do is something like

val = $game_variables[my variable id]if $game_troop.members[0] != nil $game_troop.members[0].change_param(0, val)endIf a line goes off the edge of a script box and wraps around to the next line, it completely breaks the script, so you have to use variables to make it all fit sometimes.

but anyway, just put a number where it says [my variable id], and it'll give you that variable. Remember, game variables start at 1, not 0.
it wouldn't fit easily in the script box, because of how they work. what you'd have to do is something like

val = $game_variables[my variable id]if $game_troop.members[0] != nil $game_troop.members[0].change_param(0, val)endIf a line goes off the edge of a script box and wraps around to the next line, it completely breaks the script, so you have to use variables to make it all fit sometimes.

but anyway, just put a number where it says [my variable id], and it'll give you that variable. Remember, game variables start at 1, not 0.
Thanks for all the help, appreciate it.
no problem 🙂 . That if statement I put in there should prevent issues like this again, mostly. It won't crash the game, but it won't work if the enemy is nil (nothing, null, doesn't exist).

Original thread: https://forums.rpgmakerweb.com/threads/having-some-trouble-writing-a-script-call.15477/