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.

Program Announcements / DBP_NETLIB - Plugin for Dark Basic - UPDATE

Author
Message
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 15th May 2004 14:59 Edited at: 16th May 2004 18:29
DBP_NETLIB - Plugin for Dark Basic Professional

Hello all. Version 1.1 was just released and is available at the link below. Six new functions have been added, including the ones requested in the other thread. The new functions are:

fil_OutputFile()
str_PadLeft()
str_PadRight()
str_Insert()
tc_StrToFlt()
tc_FormatNum()

(Walaber: I am still looking into what you asked)

all of the functions, including the new ones, are fully documented in the zip download, or on the link page as an htm. Have fun.

Thanks,
CattleRustler & Exeat

full list of functions:



* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th May 2004 06:17
::bump::
sticky?


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 16th May 2004 06:42
Thanks. Almost enough to make a grown man cry.

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th May 2004 06:47
@LIT,

are you using the new Pad functions?
let us know if all is well.
maybe show some examples of code for others to see


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 16th May 2004 08:26
All is well with the pad functions and others as well though I am still testing them all.
Here is a small str_PadRight example. I writes the sin,cos,tan,asin,acos,atan values returned for 0 to 360 to a txt file.


It runs so fast I cannot even see the window I thought it wasn't working as my old program took about 2 secs. But all is well. Great job so far.

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
WoW is WOW
20
Years of Service
User Offline
Joined: 21st Jun 2003
Location: Australia
Posted: 16th May 2004 08:29
what is NETLIB?
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th May 2004 08:50 Edited at: 16th May 2004 08:52
@ LIT - thanks

@ RPG - .NET LIBRARY


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th May 2004 08:55
@ LIT,

instead of

Quote: "if file exist("ALL.TXT") then delete file "ALL.TXT"
open to write 1,"ALL.TXT""


use fil_OutputFile() function, to get the file started, then just use fil_AppendFile() to add data to the end of the file


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 16th May 2004 09:43
Hrm. I was just testing that. I get a command not understood error when I try to use those 2 functions.

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 16th May 2004 10:11
o_O

Make sure you're not using brackets when calling the command, as fil_OutputFile() does not return a value, it must be called like so:

fil_OutputFile "Filename.txt", "Output Data"


"Computers are useless they can only give you answers."
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 16th May 2004 10:17 Edited at: 16th May 2004 10:19
I wasn't even thinking. I had brackets in. But it runs much slower now. Almost as slow as my DBP workaround. The file functions must be slower for some reason.

New Code


[Edit] What is "o_O"? Hard for us old guys to keep up with the shorthand

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 16th May 2004 10:52
It's sort of a raised eyebrow smilie. Like "That's odd".

Not sure why the file commands are running slow, CR would be the person to answer that.


"Computers are useless they can only give you answers."
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th May 2004 18:28
I am not sure why it would be slow. Is it consistenly slow or is just the first call slow?


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 00:58
The second method using the file functions is slower than the first one everytime.

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th May 2004 02:00
"the second method" being OutputFile?
If yes, then I can only assume that the file being destroyed and recreated is slightly slower than just appending to a file.

I am not sure why it would be slow in the first place. If I get a chance I will do some latency tests using pure vb.net tests vs. dbp implementation.

hopefully it can suffice for now, as is.



* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 02:07
This is what I meant by method 1 and 2
method 1


method 2


"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th May 2004 03:33
ok.

I ran the following code a few times....



and got between 390 - 400 consistently.
Maybe run it and see what you get?


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 06:29 Edited at: 17th May 2004 06:31
I get from 1620 to 1740. With your code

This code Gets 40 to 69


"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th May 2004 06:45
I ran your code and got average of 70 ms.
I'd say that for speed intensive operations use the dbp file function because it's clearly faster (no call to external dlls).
Thanks for pointing this out.

at least the pad functions are working right


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 07:12 Edited at: 17th May 2004 07:17
I will test this further. I think it may be slower because it is opening and closing the file everytime the for/next part loops. Where my DBP code just opens and closes the file once per program run.

[Edit] Hrm what is the character to put in the string for next line? Like it would be /n or endl in c++

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th May 2004 07:22 Edited at: 17th May 2004 07:24
oh I missed that!
the results need to be retested!

edit: chr$(10)+chr$(13) may work as a carriage-return, line-feed


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 07:25 Edited at: 17th May 2004 07:25
I don't know what the next line character is so I can send all the info at one time

[edit] Thx i'll try that

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 07:54
Though I have not found out how to get the next line to work yet. It is alot faster I reran just using fil_appendfile once per program and got a pretty steady 45ms time. It was one really long string but it was fast. chr$(10) + chr$(13) doesn't seem to be working. I think DBP removes them or something. I will keep trying.

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 17th May 2004 12:48
To get the carradge return this would be the DBP code:



That should give you in the file:



Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 17th May 2004 15:17 Edited at: 17th May 2004 15:19
It's the other way around, 13 then 10.
chr$(13)+chr$(10)

And you shouldn't have any speed disadvantage against dbpro, the dbpro file writing commands are in dlls to, check the DBProFileDebug.dll string table.

[beat the machine that works in your head]
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 17th May 2004 16:34
Thank you. Yeah DBP and NETLIB has about the same speed on the file functions I get around 50ms with both of these codes.




"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th May 2004 17:08 Edited at: 18th May 2004 01:42
sweet.

just remember that fil_AppendFile() will add the line-feed/carriage-return for you


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 20th May 2004 18:12
A little off topic, I know. I am sorry...

How are you wrapping your .NET functions into a TPC dll? Are you using C++ COM interop? If so, could I have an example of this code, and I cannot get it to work.

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th May 2004 18:24
the VB.NET dll is a pure .net dll compiled - no interop. Then Exeat takes my dll and wraps it in a standard C++ dll so dbp can use it.

He would be better to explain the c++ part. I am sure he will answer if he sees this but remember he is in Australia so he may respond on your off hours.

If there is anything else I can help with, let me (us) know
good luck


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 20th May 2004 18:45
Ok. My question is how you actualy call the .NET functions in C++... If Exeat is doing this for you, I'm sure he can answer. Thanks!

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th May 2004 18:54
he can definitely answer but I can maybe give you a start...he makes a c++ function of the same name, and matching params, as the vb function. In the c++ function he calls the vb function, gets the data back, then passes that data back from his function call, but in the correct data types that dbp can understand. Also there is some resource file something, and a string table thingy We pass the project back and forth in email as open source so each can see what the other is doing/has done. Sorry I can't elaborate more on the c++ aspect


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 20th May 2004 19:07
Cool. The making of a standard C++ DLL that work as a TPC for DBPro I know how to do. I know how to make the string table and all that jazz...

What I can't figure out is how to call the .NET functions in the assembly (.NET DLL) correctly from C++. The documentation states I can call it as a COM object if I create a COM interface in my .NET (VB or C#) code and register a type library. I cannot, however, get this to work successfully. And I've spent a whole day doing it! Arrggg... But I can wait a tad longer...

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th May 2004 20:18 Edited at: 20th May 2004 20:19
i can look at Exeat's C++ code if you like, just tell me where and what to look for.

I know the reverse of this (using a com object in .net) is a fairly straight forward venture just by adding the com object as a Reference to the project brings the library in, where you then can instance an object representation of it. How it works in reverse with c++ - heh

edit: side note, you are running the .net framework 1.1, correct?


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 20th May 2004 22:32
Yeah, I'm running 1.1. Would there be a problem sending me the C++ wrapper?

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th May 2004 23:34
actually yes, that's kind of a problem.
Exeat wrote that code to wrap specific code that I wrote in vb.net, as well as things still being written. We didn't intend for any of it to become open source. Having said that, I am sure he can show you exactly what is necessary to get it going for you, by way of an example instead of the actual code from that source project, if he feels like doing so (I can't speak on that for him). I hope you understand where I am coming from.

He should be around in a few hours time - let's see what he has to say on the issue.



* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 21st May 2004 01:43
Ok. No big, eh? I'm about to head home and away from civilized society (the internet). If he has an example of the wrapper, he can send it to adam@mighty-atom.com. That would be super-cool.

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st May 2004 02:53



* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st May 2004 07:16 Edited at: 21st May 2004 07:17
I would have thought the "Zeet" would have happened along by now...




* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 21st May 2004 17:25
Must've missed this post in my daily rummaging this afternoon. Oh well. Anyway, I'll post it here instead of emailing you (in case someone else also wants to know how it's done). Wrapping a VB.NET DLL is so much easier then wrapping a VB6 one which required initialing the COM library, creating a pointer to the DLL and then finally calling it (gah!). In any case, our standard VB.NET DLL may look something like this:

VB.NET


To wrap the two functions vbDisplayForm and vbAdd, all I have to do is import the compiled VB.NET DLL and then call the functions. In your header file or at the top of your source code you need to call this:

C++ .NET


Then when calling the functions, I'd typically do something like this:

C++ .NET


As can be seen, a pointer still has to be created to point to the VB class but this isn't nearly as messy as it was to get it working for VB6. Then all you have to do is make your string table jazz and it should work. Note alternatively, you don't even have to use the VB namespace and the class could be accessed via: VBDLL::clsMyClass.

The biggest problem I had was trying to get my C++ DLL to recognise the VB DLL, apparently there were problems with not finding it in the right directory and what not. Hence why I included it in the path "..\bin\MyVBDLL.dll", I also had to configure my C++ projects output directory to point to "..\bin", that was the only way I managed to get it to compile and still recognise the VB DLL.

That's about all it takes, just make sure you don't create a COM DLL but instead use pure .NET. If you have any problems, just ask.


"Computers are useless they can only give you answers."
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 21st May 2004 17:37
Cool. I guess I didn't realize that that I could make the DLL using .NET in C++. I normally just do an old fashioned DLL. This is much easier than using the COM Interop stuff. I'll give it a go in a few minutes and let ya know. Thanks!

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st May 2004 19:08
thanks Exeat


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 21st May 2004 19:49
Ok. Having trouble exporting commands that return a value (integer in this test). I have no issues doing this with just a plain-jane C++ DLL.

Code snippet:


My string table:
RCP TEST%[L%RCPTest

DBPro gives me the following error:
User function RCP TEST must return a value if used in an expression

Any thoughts?

P.S. Please note that I am not "wrapping" a DLL written in C# or VB. I'm simply trying to write a .NET DLL and use it in DBPro... Why wrap when I know C++

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 21st May 2004 21:30
Nevermind, I'm an idiot (too much work ) Its my string table.

Should read:
RCP TEST[%L%RCPTest

Thanks for the help Exeat and CattleRustler. Now I can take advantage of the many cool features of .NET in my TPC DLLs.

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st May 2004 21:43



* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
TheOneRing
20
Years of Service
User Offline
Joined: 28th Aug 2003
Location: Right here.
Posted: 21st May 2004 22:52
You cannot, however, decalare a .NET managed type as a global variable in VC++... major let-down.

Visit http://www.mighty-atom.com/d-zone for the Transform-i scripting engine project.
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd May 2004 19:05
I just added the file DBP_NETLIB_KW.ini to the zipped download and updated the document as well. Putting this ini file in your \Editor\Keywords directory will cause the DBP_NETLIB commands to turn blue, and the function Arguments/Return Types will be displayed in the editor's status bar.

if you want the ini data without downloading the zip, copy and past the text below into a file named DBP_NETLIB_KW.ini that resides in your \editor\keywords directory.






* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 22nd May 2004 20:40
Very Cool. Thanks.

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd May 2004 22:20
UPDATE:

Added 2 new functions (not released yet - will notify)

fil_CopyFile() - copies any file to any location
fil_CopyDir() - copies any directory(with all sub dirs and files) to any location

more to follow


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 25th May 2004 00:52 Edited at: 25th May 2004 04:47
Hey, we made the Newsletter!!!!

yay, us!



sorry, just thought that it was kinda cool.


* DBP_NETLIB_v1.1 - VB.NET PLUGIN FOR DBP * Click Logo
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 25th May 2004 04:14
Congrats

"People don't fail ..... they stop trying." Specs. P4 2.8GHz 800 FSB | 512MB DDR333
GeForce FX 5200 AGP 256MB | Windows XP Pro Full

Login to post a reply

Server time is: 2024-05-28 19:07:02
Your offset time is: 2024-05-28 19:07:02