Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 19, 2008 16:47:07 GMT -5
Hey Guilect,
is it possibly to write statements like "ReadByte:WriteByte" and ReadInt:WriteInt". ReadString and WriteString would be also usefully. Herewith, i could write a better Highscore and more. All would be a bit easier. What do you think about it! Peter
|
|
|
Post by Guilect on Apr 19, 2008 18:53:28 GMT -5
I think that is possible. I will look into it.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 20, 2008 6:46:14 GMT -5
Hi Guilect,
thank you, that you will look into your good Brutus2D Basic. right now, i am starting to writing a mini game series. I thought, it would be better when all games have a highscore with several entries. I think that i can buy next month a full version of brutus2D, hopefully! Peter
|
|
|
Post by Guilect on Apr 22, 2008 6:36:26 GMT -5
When first Brutus2D was developed, I envisioned the file commands as system level commands and so they exist like : FileRead, FileWrite. And there are only a handful of such file commands. But now I think that File should be its own object if the new commands are added. So, commands would be like : File.Read, File. Write, File.ReadByte This would have the side benefit of enabling the file commands to appear in the pop-up autocomplete thingy. I can leave the existing commands so as not to break existing code.
I do have a little hesitation on how to force VBScript ( and thus Brutus2D) to read and write specific data types as all variables in VBScript are Variants, but we shall see how it goes.
As time permits I will work on this and the network bugs for U9. Hopefully it will not be so long.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 22, 2008 11:52:19 GMT -5
Hi Guilect,
okay. Thank you Peter
|
|
|
Post by Guilect on Apr 23, 2008 19:27:59 GMT -5
Here is what is implemented (so far?) :
File Object
METHODS:
GetPosition SetPosition Get/Set the current file position. This is changed automatically when you read/write, so you do not have to change this if you are reading/writing from beginning to end.
OpenFile This has to be called after you setup the filename & before you read/write anything.
ReadLong This reads a series of 4 bytes from the current filename, at the current file position, and converts and returns them to an Long.
ReadStr This reads a string from the current filename, at the current file position, and returns it.
ReadStrFixed(vSize As Long) As String This reads an fixed size string from the current file, at the current file position, and returns it. vSize is the size of the string to read. This is useful for file headers etc.
ReadByte This reads an byte from the current filename, at the current file position, and returns it.
WriteLong(wLong) This writes a long(wLong) as 4 bytes to the current filename, at the current file position.
WriteStr(wString) This writes a string to the current filename, at the current file position. The string cannot be longer than 255 characters.
WriteStrFixed(wString) This writes a fixed size string to the current filename, at the current file position. The string can be as long as you want.
WriteByte(wByte) This writes an byte to the current filename, at the current file position.
Here is a sample B2D program
' Test of the File object
' write stuff to a file File.OpenFile "test.txt"
File.WriteStr "foobar" File.writeByte(55) File.Writelong(123456)
File.CloseFile ' Now for a test read it back dim myString, myByte, myLong File.OpenFile "test.txt"
myString = File.readStr() myByte = File.readbyte() myLong = File.readLong() File.CloseFile msgbox CStr(myByte) + vbCrLF + CStr(myLong),, myString
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 24, 2008 4:56:46 GMT -5
Hi Guilect,
this is what i wanted ! This looks good, so far. when does it come out ?
Thank many Guilect. Peter
|
|
|
Post by matthew on Apr 24, 2008 6:11:45 GMT -5
Yeah, they're a lot like the file operations in Basic4GL. I'm sure people are going to find them useful.
|
|
|
Post by u9 on Apr 24, 2008 14:32:29 GMT -5
Definitely good additions. I'm not sure, but is there (or shouldn't there be) a get file length/size, so that one can go to the end of the file to write? And what happens if you go to e.g. position 0 and write? it starts overwriting? And is everyting after that position erased? I am wondering if it is possible to shorten a file
|
|
|
Post by Guilect on Apr 24, 2008 19:54:04 GMT -5
B2D already has the command system.FileSize(). I will roll the existing file related commands into the new File object. FYI, position starts at 1. As for what happens if you overwrite, you will have to tell me what you find out.
|
|
|
Post by Guilect on Apr 25, 2008 18:18:24 GMT -5
To the new File Object commands I have copied in the existing commands : Exists Size WriteAll ReadAll Delete Copy Append
Now I have to write up the help files for these commands. Write them in the HTML editor then remember how to use the MS help compiler (again). (For those out there thinking of writing a help file for some software you have written, might I suggest just about any other piece of software other than the MS help compiler).
When will this be done... Let me put it this way, I find writing help documentation about as much fun as watching paint dry. I will try to get it done soon. If you need these file commands sooner than I can get the help docs done, let me know and I can always provide the necessary files ahead of time.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 25, 2008 19:05:29 GMT -5
Hi Guilect,
do not hurry up! I can wait. Thank you very much. Peter
|
|
|
Post by matthew on Apr 25, 2008 19:32:38 GMT -5
Now I have to write up the help files for these commands. Write them in the HTML editor then remember how to use the MS help compiler (again). (For those out there thinking of writing a help file for some software you have written, might I suggest just about any other piece of software other than the MS help compiler). I tried creating a help file using the MS help compiler once & found it very tedious. If I recall, I had to type everything out in Wordpad first. Now I use this program, it's an Open Source WYSIWYG program, just type out the text & hit the compile button. You can even import old .hpi & .hlp files.
|
|
|
Post by Guilect on Apr 30, 2008 17:58:05 GMT -5
Matthew thanks for the info on the HelpMaker. Alas it cannot import a .hhp MS help project, which is what B2D's help is in. This program would be good for someone starting fresh. Small update: Done adding the new file commands to the help. Want to see if I can find a fix for U9's network question. Hope to have something out by this time next week. (sooner of course if possible)(later is also a possiblity
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 8, 2008 10:04:35 GMT -5
Hi Guilect,
great !! i am working with this new system and i have no problems therewith It is fantastic !! thank you for the good work.
ps. where can i get a fullversion ?? Peter
|
|