Hello everybody.
In my game, I implemented a player registration system: when you register, you are asked to choose your name, and your save files will be named with that name ($game_party.leader.name + '*.rvdata2'). This works perfectly, but the issues start when I try to selectively delete save files by name.
I put all the names of the registered players in an array, and I start a for cycle to check if, for every name, there are save files.
In the spoiler below I wrote the part of the script I am using where it messes up.
Whit this bug, if I look for Hello*.rvdata2 files, and in my directory there are Hello01.rvdata2 and Hello02.rvdata2, but also a HelloMe.rvdata2 file, the search will include all of them! This is pretty annoying, because in my game I need to ensure if a single player, with a specific name, has save files or not, and this non-exclusive search is a big obstacle. Morevoer, when it comes for the engine to delete save files by name, it does not make mistakes, and searches only for the save files with the name I asked.
Hoping I was inderstandale, what I would like to know is why the engine includes, in a search by name, names that include the name you are searching for and how to avoid that.
Maybe it is just a trivial problem, but I did not find anything about it on the forums or on the web, so thank you in advance for any help 🙂
EDIT: I just tried to remove the "*" from the code (searching for $namesArray + '.rvdata2' instead of $namesArray + '*.rvdata2'), and then the engine found no saves for every player.
This means, as I supposed, that the "*" stands for the number of the save file, and is necessary to the search, but is it possible that the engine also reads it as any letter after the given name (* == number from 01 to whatever or * == any string)?
In my game, I implemented a player registration system: when you register, you are asked to choose your name, and your save files will be named with that name ($game_party.leader.name + '*.rvdata2'). This works perfectly, but the issues start when I try to selectively delete save files by name.
I put all the names of the registered players in an array, and I start a for cycle to check if, for every name, there are save files.
In the spoiler below I wrote the part of the script I am using where it messes up.
for i in 6..$namesArray.size - 1 # The first six names are by default without save files (NPC accounts) and I do not need to check them, so I start the index from 6.
if Dir.glob($namesArray + '*.rvdata2').empty?
print Dir.glob($namesArray + '*.rvdata2') # Prints a list of the save files for the name stored in "i" position in the array. But not only them! It includes all the save files with names
# containing the name I am checking!
print $namesArray + '*.rvdata2' # The save file name I am looking for, despite the engine includes other files too.
end
end
if Dir.glob($namesArray + '*.rvdata2').empty?
print Dir.glob($namesArray + '*.rvdata2') # Prints a list of the save files for the name stored in "i" position in the array. But not only them! It includes all the save files with names
# containing the name I am checking!
print $namesArray + '*.rvdata2' # The save file name I am looking for, despite the engine includes other files too.
end
end
Whit this bug, if I look for Hello*.rvdata2 files, and in my directory there are Hello01.rvdata2 and Hello02.rvdata2, but also a HelloMe.rvdata2 file, the search will include all of them! This is pretty annoying, because in my game I need to ensure if a single player, with a specific name, has save files or not, and this non-exclusive search is a big obstacle. Morevoer, when it comes for the engine to delete save files by name, it does not make mistakes, and searches only for the save files with the name I asked.
Hoping I was inderstandale, what I would like to know is why the engine includes, in a search by name, names that include the name you are searching for and how to avoid that.
Maybe it is just a trivial problem, but I did not find anything about it on the forums or on the web, so thank you in advance for any help 🙂
EDIT: I just tried to remove the "*" from the code (searching for $namesArray + '.rvdata2' instead of $namesArray + '*.rvdata2'), and then the engine found no saves for every player.
This means, as I supposed, that the "*" stands for the number of the save file, and is necessary to the search, but is it possible that the engine also reads it as any letter after the given name (* == number from 01 to whatever or * == any string)?