The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Sorohn on January 30, 2012, 08:52:17 PM

Title: [RMVXA] game_actor script help
Post by: Sorohn on January 30, 2012, 08:52:17 PM
Greetings, I need some help fixing one of my RMVXA scripts. this is a base script that is built into the Ace programming. my error when I play test it occurs when I cause an actor to rise in level.  The specific error reads as follows:

Script 'Game_Actor' line 442: ArgumentError occurred.
too few arguments

The specified line mentioned then reads as follows:
      $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))

I'm not much of a coder, thus I am unsure if this is an obvious issue, or something more. May someone please give me some help in this matter?

I apologize if this is also located in the wrong forum as well.
Title: Re: [RMVXA] game_actor script help
Post by: pacdiggity on January 30, 2012, 11:19:20 PM
The only errors I can think of there would be if somehow the Game_Message#add method was changed, or the Vocab::ObtainSkill constant was changed.
Go to line 42 of Vocab (the first module in the script editor), and make sure there is only one %s in there. I'm using my own shoddy translation of the Japanese version, and I have that line as: ObtainSkill     = "learned %s?", I'm not sure if that's what the English version has.
I now want you to check the Game_Message class. Go to line 56. It should read: def add(text)
If that's all fine, then a custom script is overwriting the Game_Message#add method. If this is the case and you don't know how to fix it, post your custom scripts here. It's probably just an extra argument without a default.

And yes, this was the right forum.
Title: Re: [RMVXA] game_actor script help
Post by: Sorohn on January 30, 2012, 11:51:20 PM
Okay, I checked the Game_Message Script and that was the same.

I think my Vocab lines are out of order. My obtain skill vocab is line 43 instead of 42. I'll post lines 37 through 43 so you can see what's there, though I doubt the location of the ObtainSkill definition doesn't matter.

  Victory         = "Victory!"
  Defeat          = "% s has lost the battle"
  ObtainExp       = "The party has received % sXP!"
  ObtainGold      = "The party got % s\G!"
  ObtainItem      = "The party got % s!"
  LevelUp         = "% s leveled up to % s!"
  ObtainSkill     = "% s learned % s!"


Plus I'm not using any custom scripts too.
Title: Re: [RMVXA] game_actor script help
Post by: TDS on January 31, 2012, 12:14:19 AM
You have an extra %s in there.

It should look something like this.


ObtainSkill     = "%s was learned!"
Title: Re: [RMVXA] game_actor script help
Post by: Sorohn on January 31, 2012, 12:37:06 AM
Ha ha, okay so it was wrong. I had left it as I translated it and it had the two %s.

I just play tested it and that fixed it. So thank you TDS and Pacman.
Title: Re: [RMVXA] game_actor script help
Post by: pacdiggity on January 31, 2012, 12:38:21 AM
TDS is right.
Also, you should change all of those "% s" to "%s". The sprintf format won't interpret "% s" as a special character. You should also change your LevelUp, you have one too few %s in there.
  LevelUp         = "%s is up to %s %s!"
You also need to change Victory, it requires one %s. In ObtainGold, you should change \G to \\G.
Title: Re: [RMVXA] game_actor script help
Post by: Sorohn on January 31, 2012, 12:58:03 AM
The Victory one actually does not require it. I've been using that since I translated it and it hasn't caused any issues.
Title: Re: [RMVXA] game_actor script help
Post by: TDS on January 31, 2012, 01:00:17 AM
Quote from: Pacman on January 31, 2012, 12:38:21 AM
Also, you should change all of those "% s" to "%s". The sprintf format won't interpret "% s" as a special character.

Actually there really isnt a problem with leaving spaces in this situation, except that it looks wrong.


test = "% s spaces are great! but look ugly..."
p sprintf(test, "SPACE")
rgss_stop
Title: Re: [RMVXA] game_actor script help
Post by: pacdiggity on January 31, 2012, 01:17:07 AM
Huh. Did not know that. I've just never seen it used that way, so I figured there was a reason. Turns out there is: it looks wrong. ._.