Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Griver03 on July 20, 2011, 01:29:20 pm

Title: [XP] Just a question about rgss/ruby
Post by: Griver03 on July 20, 2011, 01:29:20 pm
hi there i have a question about scripting possibiltys.
i use some scripts which use the actors name for sprite selection (legacy class change as example.)
so i have to give my actors names in database.
but i thought about to give the player the opportunity to select the actors name by their self.
therefore are many scripts out there i know.
but the problem is that the graphics need to be named like the actor....
now my question is, is there a way to create a script which can do the following:

check which name an actor have,
copy a picture from the charaters folder and rename it in the way it needs to be named.

example:

This is how legacy wants to have it for actor 1 = "Aluxes_Warrior.png"
But if i change the name by script, for example to "Peter"
the graphic's name have to be "Peter_Warrior.png" too.

now comes the new script to work
in the characters folder is a grphic named "TEMP1_Warrior.png"
now the script should copy the file and rename it to "Peter_Warrior.png"

like i said i dont request that but i want to know if this is possible ?!
thx in advance
Title: Re: [XP] Just a question about rgss/ruby
Post by: Taiine on July 20, 2011, 02:21:26 pm
When I come across scrips like this, I tend to edit them to use the actor ID rather than the actor name.

So instead of
BOB_whatever.png
the files just have to be
01_whatever.png

This it don't matter what you name the character as it just goes by what the actor ID is in the database.
Title: Re: [XP] Just a question about rgss/ruby
Post by: Apidcloud on August 19, 2011, 06:03:27 pm
well, just use this to rename it:
File.rename( anOldName, aNewName )

the NewName should be the name that the player chooses :P

see you
Title: Re: [XP] Just a question about rgss/ruby
Post by: ForeverZer0 on August 19, 2011, 07:19:41 pm
The ID naming method is better, much less IO access, and no possibility of any type of file access errors.  If you want something other than a number, and want actual words, use the name of the character in the database, and reference it not by their name of the $game_actor, but of the $data_actors[ID].name.  This value is constant and will not change.
Title: Re: [XP] Just a question about rgss/ruby
Post by: Apidcloud on August 19, 2011, 08:27:13 pm
@ForeverZer0

Let me see if I understood what you said xD
$data_actors[ID].name just returns the name of the actor with that id right? lol
Title: Re: [XP] Just a question about rgss/ruby
Post by: ForeverZer0 on August 19, 2011, 08:29:56 pm
@Apidcloud:
Yes, as I just stated it does.  It is not changed when an actor name changes.  The Game_Actor#name is initialized as this name, but is subject to change.  This value will remain the same even if that is changed. lol
Title: Re: [XP] Just a question about rgss/ruby
Post by: Apidcloud on August 19, 2011, 08:34:33 pm
Lol I get it now

Well, that's a good way, because just like you said, with that method, IO acess wont be denied or something xD

See ya and ty for the good explanation :)
Title: Re: [XP] Just a question about rgss/ruby
Post by: Blizzard on August 20, 2011, 06:00:16 am
What F0 explained is literally the actor name that you specified in the editor.
Title: Re: [XP] Just a question about rgss/ruby
Post by: Apidcloud on August 20, 2011, 09:05:25 am
Quote from: Blizzard on August 20, 2011, 06:00:16 am
What F0 explained is literally the actor name that you specified in the editor.


Well, always learning xD
I guess that's logic now, $data is used for database stuff eheh :P
Title: Re: [XP] Just a question about rgss/ruby
Post by: Griver03 on April 10, 2012, 06:13:50 am
sry i foret about that long ago but thanks for replying so much :shy: