[XP] Just a question about rgss/ruby

Started by Griver03, July 20, 2011, 01:29:20 pm

Previous topic - Next topic

Griver03

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
My most wanted games...



Taiine

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.

Apidcloud

well, just use this to rename it:
File.rename( anOldName, aNewName )

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

see you
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

@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
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

@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
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

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 :)
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

Blizzard

What F0 explained is literally the actor name that you specified in the editor.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Apidcloud

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
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

Griver03

sry i foret about that long ago but thanks for replying so much :shy:
My most wanted games...