Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 EDIT: I decided to remake all of my maps. I only had a few made anyway. Thanks guys! Link to comment Share on other sites More sharing options...
emblem Posted August 28, 2009 Share Posted August 28, 2009 ```Type MapRec' StuffName As String * 20```Change the * 20 to * 50.You may have to remake your maps though. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 Thanks. Why would I have to remake them, though? Would backing them up help? Link to comment Share on other sites More sharing options...
The Oracle Posted August 28, 2009 Share Posted August 28, 2009 technically it's changing the map's format, so no Link to comment Share on other sites More sharing options...
emblem Posted August 28, 2009 Share Posted August 28, 2009 Yeah. You would need to make a map converter. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 Is it easy to make a map converter? Link to comment Share on other sites More sharing options...
emblem Posted August 28, 2009 Share Posted August 28, 2009 It would be, but it's not really worth the effort just for 20 more characters in your map name. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 Okay, thanks. I'm willing to make a map converter for this, actually. Do you think you can tell me some basics on making one, please? Link to comment Share on other sites More sharing options...
emblem Posted August 28, 2009 Share Posted August 28, 2009 Make two maprecs. Your old one and your new one.Load a map using the old one, convert each value over to the new one, save the map using the new oneSo like:```Map.Name = OldMap.Name``` Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 This is what I've done so far:I've created another MapRec, MapRecA. This is what it looks like in my **ModTypes** right now:```Type MapRec Name As String * 20 Revision As Integer Moral As Byte Up As Integer Down As Integer Left As Integer Right As Integer music As String BootMap As Integer BootX As Byte BootY As Byte Shop As Integer Indoors As Byte Tile() As TileRec Npc(1 To 15) As Integer SpawnX(1 To 15) As Byte SpawnY(1 To 15) As Byte owner As String scrolling As Byte Weather As IntegerEnd TypeType MapRecA Name As String * 50 Revision As Integer Moral As Byte Up As Integer Down As Integer Left As Integer Right As Integer music As String BootMap As Integer BootX As Byte BootY As Byte Shop As Integer Indoors As Byte Tile() As TileRec Npc(1 To 15) As Integer SpawnX(1 To 15) As Byte SpawnY(1 To 15) As Byte owner As String scrolling As Byte Weather As IntegerEnd Type```I think I know what you mean by the second part of your post, but I'm not exactly sure. Can you please explain the loading, converting, and saving in more detail? I think I know what you're saying, but I want to confirm it. Link to comment Share on other sites More sharing options...
emblem Posted August 28, 2009 Share Posted August 28, 2009 Basically, load each map one by one.Take each variable in the old maprec, save it in the new maprec.Then save the new maprec. Link to comment Share on other sites More sharing options...
Godlord Posted August 28, 2009 Share Posted August 28, 2009 > Basically, load each map one by one.I hope you meant: load old map > make new rec > clean old map > save new map > clean new map > go back to load old map.It's just going through the two structures and setting each variable/element.Like:```Map.Name = OldMap.NameMap.Revision = OldMap.RevisionMap.Moral = OldMap.MoralMap.Up = OldMap.Up' etc.```Regards, Godlord. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 @Godlord:> I hope you meant: load old map > make new rec > clean old map > save new map > clean new map > go back to load old map.> > It's just going through the two structures and setting each variable/element.> > Like:> ```> Map.Name = OldMap.Name> Map.Revision = OldMap.Revision> Map.Moral = OldMap.Moral> Map.Up = OldMap.Up> ' etc.> ```> > Regards,> Godlord.Okay, thanks guys, but I'm still a little confused. Should I create a new MapRec in both the Client and Server? Also, what do you mean by "loading the old map"? Do I just go on it in the Client? Additionally, where would I put the code that you're telling me to use? Link to comment Share on other sites More sharing options...
Robin Posted August 28, 2009 Share Posted August 28, 2009 Fixed length strings just for easier saving is lazy.Don't dump the UDT into a .bin file for the lulz, do it line-by-line.```' Read string lengthGet #nFileNum, , sLen' Set string size, then read stringSTRING = Space$(sLen)Get #nFileNum, , STRING``````' Store string size for variable lengthPut #nFileNum, , CLng(Len(STRING))' Store stringPut #nFileNum, , STRING``` Link to comment Share on other sites More sharing options...
Godlord Posted August 28, 2009 Share Posted August 28, 2009 @Robin:> Fixed length strings just for easier saving is lazy.> > Don't dump the UDT into a .bin file for the lulz, do it line-by-line.> > ```> ' Read string length> Get #nFileNum, , sLen> ' Set string size, then read string> STRING = Space$(sLen)> Get #nFileNum, , STRING> > ```> ```> ' Store string size for variable length> Put #nFileNum, , CLng(Len(STRING))> ' Store string> Put #nFileNum, , STRING> > ```Or actually write a file format so it's actually cross-platform and easily modifiable.@Kimimaru:> Okay, thanks guys, but I'm still a little confused. Should I create a new MapRec in both the Client and Server? Also, what do you mean by "loading the old map"? Do I just go on it in the Client? Additionally, where would I put the code that you're telling me to use?Your old maps are the maps with the 20 as length, your new maps will be the maps with the 50 as name length.Regards, Godlord. Link to comment Share on other sites More sharing options...
Robin Posted August 28, 2009 Share Posted August 28, 2009 @Godlord:> Or actually write a file format so it's actually cross-platform and easily modifiable.Yeah, because cross-platform file formats are really important in **Visual Basic** projects. ;PI was just pointing out how people can write a binary system without having to fuck around with fixed-length strings all the time. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 @Godlord:> Or actually write a file format so it's actually cross-platform and easily modifiable.> Your old maps are the maps with the 20 as length, your new maps will be the maps with the 50 as name length.> > Regards,> Godlord.Well, I know that, but I don't believe you answered any of my questions. Link to comment Share on other sites More sharing options...
Godlord Posted August 28, 2009 Share Posted August 28, 2009 @Robin:> Yeah, because cross-platform file formats are really important in **Visual Basic** projects. ;PIf you're ever going to port it and you forgot something:@Godlord:> Or actually write a file format so it's actually cross-platform and **easily modifiable**.Also it supports older and newer versions if done well. So no, it's not only for cross-platform usage.@Kimimaru:> Well, I know that, but I don't believe you answered any of my questions.It's really obvious though. You only need to know how to read binary files, write them and how to use "Type" or structures.Regards, Godlord. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 28, 2009 Author Share Posted August 28, 2009 I'm not exactly sure how to do all of that. Would it be possible for someone to tell me a simpler way of doing it and where to put the code? Link to comment Share on other sites More sharing options...
Robin Posted August 28, 2009 Share Posted August 28, 2009 @Godlord:> If you're ever going to port it and you forgot somethingHe wants to know how to save strings with different lengths in binary. Not how to future-proof his project for possible language ports. Link to comment Share on other sites More sharing options...
Godlord Posted August 28, 2009 Share Posted August 28, 2009 @Robin:> He wants to know how to save strings with different lengths in binary. Not how to future-proof his project for possible language ports.Yeah, accuse me for stating that you can better save it in an actual file format instead of pure binary. Not to mention that you could save a string entry prefixed with a **length**.Regards, Godlord. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 29, 2009 Author Share Posted August 29, 2009 EDIT: Decided to remake my maps. I only had a few anyway. Thanks a lot, guys! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now