Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Change DBPro "Read" to IanM's plugin

Author
Message
Battoad
AGK Developer
19
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 27th Feb 2011 10:41 Edited at: 27th Feb 2011 11:13
When using write/read I am starting to prefer IamM's plugins because they appear to be more stable in writing data, but because there is less "F1" help with these plugins I sometimes find them a bit tricky.

I have found a bit of DBpro code written by TDK back in 2006 which reads several pieces of data.



However I have been unsucessful in converting this to use IanM's plugins "open datafile to read" and "string$ = datafile string$"

Can anyone help?

EDIT:
I can get the following code to read 1 piece of data but adding a 2nd string variable doesnt return a value.




note: this code uses my variables and is therefore slightly different to the 1st example.
Example of data to read is 3 rows of numbers written by using "WRITE DATAFILE String" e.g
12
2001
87

Battoad
AGK Developer
19
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 27th Feb 2011 11:47
ok, n-p i think i've found the problem. A mix up with string$ and integers.

Battoad
AGK Developer
19
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 27th Feb 2011 13:49
oops, still not working. I am using the following format of IanM's.



However it only seems to "read" the last entry, possibly overwriting the previous ones. The file containing the data simply has data written to it in rows and I was wanting to read each row string$ and store under the names score1$, score2$ etc.

It works using the DBpro commands in the initial post so I will make do unless someone can guide me in how IanM's should be coded.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Feb 2011 16:04
I don't see a problem. The following works perfectly for me:



That snippet simply creates a .txt file, puts some data in it, then opens it again and reads the same data back and prints it to the screen.
Battoad
AGK Developer
19
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 27th Feb 2011 17:49
Thanks G-G. I had deleted my earlier efforts and replaced them with the standard DBPro commands for open/read so I can't check again to see where my error was, but i re-wrote it again using basically a copy of what you have entered above and now it does work fine. I can only guess I made a typo or other silly mistake.
Very tired, trying to get moments with my project in between everything else.
Thanks again.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Feb 2011 23:34
At one point I was working on a simple set of working programs to showcase various command sets ... I never finished that (obviously), but I still have what I worked on, as incomplete as that is.

I'll work out a simple way of packaging everything up and making it available (hopefully through the help files too). Once I've done that, then if people have suggestions for updates to that, they'll be welcome.

I'm currently working on a set of function-pointer extensions and improvements right now, so the example programs won't appear immediately.

Battoad
AGK Developer
19
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 28th Feb 2011 13:01
That would be great Ian.
I have only worked out how to use a small selection of your matrix1 commands, but what I have used, are very good. At the moment its almost as if you have to know how to use them in order to be able to use them so any examples would very much help me, and I bet others.
Thanks again and I look forward to seeing whatever you can provide.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Feb 2011 14:32 Edited at: 28th Feb 2011 14:33
It might be better if F1 just went to an open source help file. That would be cool. Not editable apart from your own pages, connected to your own dll's. A bit like a forum really.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 28th Feb 2011 17:37 Edited at: 28th Feb 2011 17:49
Perhaps the DBPro F1 help should be connected to links in a Wiki site. Then the community could contribute to the documentation and include examples. (probably already been done, but I would think it would have caught on..)

[edit]
Hmm.. http://wiki.thegamecreators.com.

Looks like all the documentation is there, just have to make the links in the keyword files and then encourage the community to pitch in and contribute to editing and maintaining.

Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 28th Feb 2011 18:42
Where can I get this plug-in?

Looks pretty good when you need to read in larger files because it's probably a lot fast then lots of Read Strings, isn't it?

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 28th Feb 2011 18:44
http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18

The Matrix1Utils Plugin Collection. An absolute must for anyone working in DBPro.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2011 19:46
Quote: "Looks pretty good when you need to read in larger files because it's probably a lot fast then lots of Read Strings, isn't it?"

I've got news: It's still lots of 'read string' commands.

However, if I told you how much faster my commands are over the built-in ones, you probably wouldn't believe me, so I'll leave some code you can use to show yourself:


There's also the 'bonus' of being able to read/write an entire array into a datafile, even if it's a UDT array.

Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 28th Feb 2011 20:07
Wow, that looks like a whole lot of really useful stuff ^^

Usage conditions, royalties?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2011 20:33
Conditions: None, but no warranty is provided either.
Royalties: None.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Feb 2011 22:39
@ Westmere:

One of the annoying things about Darkbasic Pro is the way files are handled. With the native commands there is no way to open a file, change a byte, and close the file without having to resave the entire file (with or without using memblocks).

Thanks to IanMs plugin it is so much easier to handle files for our games/applications. That's mainly why I'm his biggest fan... and that he brought back a true MID$() command.

Login to post a reply

Server time is: 2026-07-16 23:19:17
Your offset time is: 2026-07-16 23:19:17