Post by AltiusBimm on Feb 26, 2004 17:45:51 GMT -5
I am a fairly advanced GML programmer, but on this I’m stumped.
The RPG—on whose development team-of-two I am—requires a tile system which is instance-based.
At first I failed to realize this, and I designed a tile system that was tile-based—it worked well until we found it didn’t work well at all for creating raised tiles.
But enough with the back story…
(In the end I designed an instance-based, raised-tile-capable tile system which works fine.)
…what with I need help now is this:
The save/load system.
I had a save/load system which worked fine with the tile-based tile system; but that’s irrelevant now.
Most of all I need help with the string loading aspects of my save/load system.
I have several ideas, and I will show you the most promising one—but the strings it processes come up empty!
Here is the save file (a text file) which holds the tile definitions:
I now realize that using # defines a new line so that had to have been messing me up, however after correcting this mistake, the loading process still fails
The first line of the save file stores what character will be used as the marker for cutting the property string into pieces.
The second line of the save file stores what character will be used to mark the beginning of each line that defines a tile. A line without this character as its first character will be regarded as a comment line.
From the third line of the save file and onward, each line is either a comment or a tile definition.
In the future I will add a
block to make the loading script continue to check until the end of the save file, but for now I can’t even get one to work.
The problem seems to be here:
Obviously, in the above block there is no assignment to store the individual properties collected by the process of making the sub-strings. I will add that at some time, it hardly matters though, I have tried it at home and it also fails.
I just can’t think of what’s wrong, I clearly need to do more work on all this, yet I just don’t have the wit for dealing with saved strings in this way—it’s so hard to tell where the problem is because the whole process is so invisible.
I come here as a near-last resort, hoping to get some discussion going—just about any opinion would be better than nothing! Thanks.
The RPG—on whose development team-of-two I am—requires a tile system which is instance-based.
At first I failed to realize this, and I designed a tile system that was tile-based—it worked well until we found it didn’t work well at all for creating raised tiles.
But enough with the back story…
(In the end I designed an instance-based, raised-tile-capable tile system which works fine.)
…what with I need help now is this:
The save/load system.
I had a save/load system which worked fine with the tile-based tile system; but that’s irrelevant now.
Most of all I need help with the string loading aspects of my save/load system.
I have several ideas, and I will show you the most promising one—but the strings it processes come up empty!
Here is the save file (a text file) which holds the tile definitions:
,
#
#150,12000,d
I now realize that using # defines a new line so that had to have been messing me up, however after correcting this mistake, the loading process still fails
{
separation_character = file_read_string();
The first line of the save file stores what character will be used as the marker for cutting the property string into pieces.
new_tile_character = file_read_string();
The second line of the save file stores what character will be used to mark the beginning of each line that defines a tile. A line without this character as its first character will be regarded as a comment line.
properties_of_the_current_tile = file_read_string();
From the third line of the save file and onward, each line is either a comment or a tile definition.
In the future I will add a
while(file_eof() = false)
block to make the loading script continue to check until the end of the save file, but for now I can’t even get one to work.
The problem seems to be here:
if(string_char_at(properties_of_the_current_tile,0) = "#")
{
properties_of_the_current_tile =
string_copy(properties_of_the_current_tile,
1,
string_length(properties_of_the_current_tile));
while(properties_of_the_current_tile != "")
{
cut_point_of_the_current_property =
string_pos(separation_character,properties_of_the_current_tile);
//Remove the current property from the list:
properties_of_the_current_tile =
string_copy(properties_of_the_current_tile,
0,
cut_point_of_the_current_property);
}
}
}
Obviously, in the above block there is no assignment to store the individual properties collected by the process of making the sub-strings. I will add that at some time, it hardly matters though, I have tried it at home and it also fails.
I just can’t think of what’s wrong, I clearly need to do more work on all this, yet I just don’t have the wit for dealing with saved strings in this way—it’s so hard to tell where the problem is because the whole process is so invisible.
I come here as a near-last resort, hoping to get some discussion going—just about any opinion would be better than nothing! Thanks.