• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Name monsters from lower to higher string

Malek

Member
Joined
Dec 25, 2009
Messages
99
Reaction score
5
Hello, I need a PHP script or something else to rename a monster from lowercase to uppercase. For example, demon skeleton> Demon Skeleton. Can anyone help me, I would ask. greetings
 
You would have to provide more information. Post whatever script you want to use it in.

It's really straight forward, just pass the name to ucwords, ucwords('demon skeleton') returns 'Demon Skeleton'.
 
You would have to provide more information. Post whatever script you want to use it in.

It's really straight forward, just pass the name to ucwords, ucwords('demon skeleton') returns 'Demon Skeleton'.



I have an entire /monsters folder and I would like the first letter of each file to be changed. I don't have any script and just need help writing one
 
If you just need to rename all files in a folder this will do it, however it will only change the first letter, so demon skeleton.xml becomes Demon skeleton.xml. If you prefer Demon Skeleton.Xml, replace name.capitalize() with name.title(). Put the script in the monsters folder and run it, but be careful, because it will just rename every file in any subfolder of where you place the script. You need Python installed though.
Python:
import os

for root, dirs, files in os.walk('.'):
    for name in files:
        os.rename(os.path.join(root, name), os.path.join(root, name.capitalize()))

Otherwise Requests is more suitable to ask for someone to make a script for you.
 
If you just need to rename all files in a folder this will do it, however it will only change the first letter, so demon skeleton.xml becomes Demon skeleton.xml. If you prefer Demon Skeleton.Xml, replace name.capitalize() with name.title(). Put the script in the monsters folder and run it, but be careful, because it will just rename every file in any subfolder of where you place the script. You need Python installed though.
Python:
import os

for root, dirs, files in os.walk('.'):
    for name in files:
        os.rename(os.path.join(root, name), os.path.join(root, name.capitalize()))

Otherwise Requests is more suitable to ask for someone to make a script for you.

Exactly I mean changing the monster name in every file like this:

<monster name="dragon" nameDescription="a dragon" race="blood" experience="700" speed="180" manacost="0">
<monster name="demon skeleton" nameDescription="a demon skeleton" race="blood" experience="700" speed="180" manacost="0">
to
<monster name="Dragon" nameDescription="a dragon" race="blood" experience="700" speed="180" manacost="0">
<monster name="Demon Skeleton" nameDescription="a demon skeleton" race="blood" experience="700" speed="180" manacost="0">
 
Back
Top