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 / Function Collection

Author
Message
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 12th Jul 2006 10:06 Edited at: 12th Jul 2006 10:50
Here are my encode/decode functions...


And here is a simple file viewer...


Technically it's not a function, but it can be converted to one...

Next is a function to find the entire length (as an integer) of the file specified (usefull for the encode/decode functions)


And there you have some functions! In the pack will you please ackknowledge me? (In the credits and such)

I am also planning on making engines (game engines) for basic player control based on RPG, FPS, Adventure, Racing, and Auto-FPS.

For those who don't know what Auto-FPS is, it's where the player moves around but you don't control his/her movement, but you can control the gun. This system revolves around wavepoints...

[EDIT] I have added an untested dynamic sky code... A better one is coming...


Now, as I said, these are untested, they might not work, and they just might work. But they should work.

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Jul 2006 11:57
I hope you don't mind DB user 2006+ but I had actually started making this before you posted. It is also an encode/decode function, but it uses a password and a number code. When the two have different lengths, it should be virtually impossible to decode without BOTH the password and the number code. In the example below, it turns a message into a load of mumbo jumbo.
It is also quite fast.
You must have a folder called "Decoded".




There are three types of people, those that can count and those that can't.
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 12th Jul 2006 13:09
Good job! I don't mind, whomever has the better code has the place holder, and therefor you have got the placeholder for encode and decode, bravo.

As for the dynamic sky, i don't feel like working on it anymore tonight. My finding the length code is still good though, not sure for what, maybe loading memblocks? And I am still going to add engines.

Maybe I should add a GUI system?

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 12th Jul 2006 14:21
@Sixty Squares:
@Beji: You've already got my permission, right?
@Diggsey: Good encoding/decoding
@DB user 2006+: Good luck with the engines, but from my experiences, you should probably be aware that it takes tiiiime...

~~~~~~~~~~
Some more win api functions (nothing all that great this time ) :
♦Get system directory
♦Get temporary directory
♦Get the name of the currently logged on windows user
♦Delete folders containing files/other folders (I think DBP's built in command only deletes folders if they're empty)
~~~~~~~~~~~~~~


~~~~~~~~~~~~
By the way, does anybody know of any equal command to type in DBP?

Det är väl så
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Jul 2006 16:03
In VB, you can use sendkeys. Maybe you could find a way to utilise that. You could also try finding out where windows stores its keyboard entry and edit that directly.

There are three types of people, those that can count and those that can't.
Benji
18
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 12th Jul 2006 23:30
@ DB user 2006+

Don't worry, I'll add you in the credits of course.

@ Rudolpho

Yes, I know I have your permission, but other people just aren'y posting.

Visit my Airplane Engine thread in the WIP board.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Jul 2006 23:46
Everything I post here, you have complete permission to use

I've been working on my GUI 98 functions
They're not finished yet, but when they are I'll be sure to post them here if this thread is still around

There are three types of people, those that can count and those that can't.
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Jul 2006 00:09
Wow this thread is not a hot thread. The file in front of it in the thread list is red!

My Functions: Mine
Post yours: Post
Benji
18
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 13th Jul 2006 02:07 Edited at: 13th Jul 2006 02:08
@ Diggsey

Thanks.

It's the first people who won't post though.

@ Sixty Squares

Yes it is. Any thread over 50 posts is a hot thread.

Visit my Airplane Engine thread in the WIP board.
Dimension
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th Jul 2006 02:42 Edited at: 13th Jul 2006 02:43
Quote: "By the way, does anybody know of any equal command to type in DBP?
"


heres how i did it but your way looks easier


here is where the plugin is for reading the registry
http://forum.thegamecreators.com/?m=forum_view&t=34837&b=5

Does anybody know which one is faster or if it matters.
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 13th Jul 2006 07:31
@Benji
Yay! I am still going to be in the credits! lol.

@Rudolpho
I'm working out an FPS engine right now. By engine, i mean controls. I'll add in physics later.

@Everyone else
You all seem to have some good functions, good job

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Dimension
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th Jul 2006 07:47
Quote: "I'll add in physics later."


I think thats what everybody saids
Dimension
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th Jul 2006 07:58 Edited at: 13th Jul 2006 08:05
I'm not sure if im doing it right but i can't get the set wallpaper function to work

set dir "c:"
SetWallpaper("impact.jpg")

Function SetWallpaper(img$)
if file exist(img$) = 1
If dll exist(48) = 1 then delete dll 48
Load dll windir$()+"system32user32.dll", 48
R = Call dll(48, "SystemParametersInfoA", 20, 0, img$, 0)
Delete dll 48
endif
Endfunction R

It just makes my wallpaper black

here are some of my functions for naming object(edited from the codebase)
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 13th Jul 2006 08:09 Edited at: 13th Jul 2006 08:12
@Dimension
No, really, I will attempt to, I can't guarantee it will be complete, but I will attempt to do it, I might get gravity, and similiar jumping/moving commands to work. Realistic gravity may be a problem though.

As for the wallpaper command, you are using it wrong...

r=SetWallpaper("impact.jpg")
`The above needs a result fallback...

[EDIT]
Here is the exact code i used...


It works for me.

[FURTHER EDIT]
That code snippet gives me an idea...

[/code]
[/code]

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 13th Jul 2006 08:14 Edited at: 13th Jul 2006 08:40
Woah, i just edited my signature like that...

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Dimension
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th Jul 2006 08:22
The problem is that it has to be a bitmap image that is why windows has a desinated bitmap image for this.

And for the physics part of game design i would look into trying to learn some advanced math or at least look into the formulas. Or maybe even rent a physics book from the library.
Benji
18
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 13th Jul 2006 08:36 Edited at: 13th Jul 2006 08:38
I'll post up the version I made before you're guys's posts , but it is NOT royalty free yet.

EDIT:

I have not added them to a .dba file as of yet.

Visit my Airplane Engine thread in the WIP board.

Attachments

Login to view attachments
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 13th Jul 2006 08:47
@Benji
Yay! It's been posted!
Ahh... It's not royalty free yet... :'-(

@Dimension
So you are right about the jpg/bmp thing...

About the physics, why did you assume that i didnt know how to make physics, or more specific, how physics work. I have read stuff about them, ive seen how they work in games, i have a general - advanced understanding of physics. Please do not assume things about people.

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Dimension
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th Jul 2006 08:52
I ment the formula for gravity. I didn't think anybody knows that formula.

And i did some looking around and found a dll viewer which allows you to view the functions from a dll.

http://www.nirsoft.net/utils/dll_export_viewer.html
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 13th Jul 2006 08:58
Ah, ok i see, well thank you for the thought.

As for the DLL viewer, I used to have one of those, that's exactly what the community needs to add windows functions to their projects! Good job Dimension!

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Jul 2006 12:03
@Benji: Yeah, I see that ;(

@Dimension: Thanks
However, I thought of some way which doesn't need any additional dll's for this, since I was thinking of using it for adding some additional api-functions here.
For my personal needs, I'm using a premade dll for those events

@BB User 2006+: Ah, I see.

@Dimension (again): The function seems to only work with bitmap images
I'll look into whether I can get some more stuff to that function to get it to work with any image later today (would be as simple as loading the image, saving it as *.bmp and then using, I guess )
Also, you should be aware that the SetWallpaper() function returns 1 if it succeeds and 0 otherwise, so you should use it like
Success=SetWallpaper(img$)

@BB User 2006+: Aha, so you've already explained what I stated above ;p

Det är väl så
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jul 2006 13:18
Oh my god:

Stop ctrl-alt-del:
Function: "SystemParametersInfoA"
Dll: "user32"

If that got into the wrong hands

There are three types of people, those that can count and those that can't.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Jul 2006 17:27
@Diggsey: I don't think that there is any such function in there.... or is there?

Det är väl så
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jul 2006 17:44
Yes, there is but I don't know what the parameters are. If you get the parameters right it will suppress any ctrl+alt+del!
I think it is used by the system to suppress ctrl+alt+del when the task manager is already open, so that the task manager can check for it and instead of reopening the task manager, restart your computer.

There are three types of people, those that can count and those that can't.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jul 2006 20:14
You could try to use my Newton Library. Its just a bunch of functions. Here is the link to the page:
http://forum.thegamecreators.com/?m=forum_view&t=81130&b=6

Its not the best,and its far from complete(haven't really done much since DarkPhysics). As for asking Hamish about the gun thingy,I don't know how to contact him I could post in one of his threads,but that wouldn't be on topic. So I guess just don't include it.

all ben needs is his band,his guitar,and his computer
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Jul 2006 20:42
@Diggsey:
Hm.... migt this be what you are reffering to?

(Where 1 disables the systemkey set (alt+F4, ctr+alt+del, etc.), and 0 enables them)

In such an event I'd have to tell you that that only seems to work under Win 95 and Win 98
Also, I would guess that this is the same thing that the DBP command 'Disable systemkeys' does.

To actually disable the taskmanager in Win XP (and probably NT/ME as well), it seems like you have to modify the computers 'gina.dll' file, from what I've heard, so pretty hard luck there ;(

Det är väl så
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jul 2006 23:28
I have win 98 so it doesn't matter. Anyway what would I need to disable ctrl+alt+del for unless I was writing a virus

There are three types of people, those that can count and those that can't.
Benji
18
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 13th Jul 2006 23:35
So benny53, I CAN you the functions you posted earlier?

Visit my Airplane Engine thread in the WIP board.
Geddon00
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location: USA
Posted: 14th Jul 2006 04:28 Edited at: 14th Jul 2006 04:29
I posted these on another board, but here are some of my functions. I have a freeObject, freeSprite, and freeLimb function, some math functions such as anglePtToPt and getDistance, bezier curve functions, and a function which makes an object follow your cursor



Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 14th Jul 2006 08:09
Need a GUI?

I'm still working on run, and actually this is for my own project, but here are the functions, do realise though that it is incomplete...


And also, there is a problem with the button, I can't seem to get the exact middle of the button with Temp=ButtonSizeX/2 : Middle=ButtonX+Temp : center text Middle,ButtonY+2,text$
Any ideas? For now, it just positions the text right in the left hand side of the button. If you guys need an example, here you go (Not sure which one this is though..)


Ah, this one is for the toolbar... Good then, this one works well... And here is an untested example for how to use the button...


There you guys go! I think this is the first GUI on the forums to have a menu bar...

Oh, and the code in the first example does not permit ability to close a menu once openned, you will have to edit that yourself

Royalty-Free use, just include in credits (Naming function) - Thank you.

Uhh, That should be it, have fun with the code!

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 14th Jul 2006 14:14 Edited at: 14th Jul 2006 15:00
I made this "Modern text"-functions some days ago.
It's better then print or text i think, because of a better cursor-command and the possibility to change the line-height and under/trough/over-line the text.

The code includes an example also.



Maybe I'm going to post my timer-functions, when I've improved them, too.


Edit:

Here are the advanced timer-functions. (Also with example)

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 14th Jul 2006 18:22
here's a simple function I use to find the next open object number:


Pirates of Port Royale
Live the life of a pirate.
Benji
18
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 14th Jul 2006 21:27
Whew, you huys are keeping me busy just testing them all. I havn't tried these latest ones yet, but I will as soon as I have successfuly completed trying the others.

Visit my Airplane Engine thread in the WIP board.
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 15th Jul 2006 08:13
Glad youve got all these functions for your pack!

I finally have a NEW computer!!!
Windows XP Pro, AMD Athlon 64-BIT Processor, ATI Radeon Graphics, Windows Vista compatable, DirectX 9.0c, 2 Hard Drives, 6 Extra Drives, etc. etc.
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 16th Jul 2006 08:24
Oh, pack is gone to second page, but I have an updated GUI for you all to use! Here is the update... (Please note that at this time there is no example, please refer to the first one i posted...)


There ya go! Have fun!

Your signature has been erased by a mod - try 600*120 max on the image
ThomasFN
19
Years of Service
User Offline
Joined: 26th Aug 2004
Location:
Posted: 21st Jul 2006 22:07
Quote: "FUNCTION freeObject( minValue, maxValue )

foundObject = 0
FOR checkObject = minValue to maxValue

IF object exist( checkObject ) = 0 AND foundObject = 0
nextObject = checkObject
foundObject = 1
ENDIF

NEXT checkObject

ENDFUNCTION nextObject"


got an easier to use one than that:


also heres a nice distance function:


Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 22nd Jul 2006 07:57
Hey, benji, you alive?

Did you ever dream of creating a professional 3d game, easily, and fast? Game Developer
http://forum.thegamecreators.com/?m=forum_view&t=84124&b=8
Be Ruler of your World...
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 22nd Jul 2006 12:54 Edited at: 22nd Jul 2006 12:55
lol

Yay a distance function finally thanks ThomasFN! I will need this eventually.

My Functions: Mine
Post yours: Post
Cave Man
17
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 22nd Aug 2006 20:36 Edited at: 1st Sep 2006 20:27
nevermind this post


Language: DBP
Benji
18
Years of Service
User Offline
Joined: 17th Dec 2005
Location: Mount Doom
Posted: 5th Oct 2006 23:43
I'm back! And no, I didn't die. I just formatted my computer, lost my password, and couldn't get it back because my E-Mail wasn't working.

I don't know if I should continue this thread because it's so old though...

Visit my Airplane Engine thread in the WIP board.
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 6th Oct 2006 03:54
Wow this got revived!

Ummm...
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 8th Oct 2006 14:51
Haven't seen this in quite a while

"I kören hörs de brummande busarna Björnligan och Gondolen"
Tactics
17
Years of Service
User Offline
Joined: 3rd Aug 2006
Location:
Posted: 9th Oct 2006 22:13
well, I just found this post now.. lol, I guess I am a bit late, but I found a lot of useful info, thank you everyone, I am looking forward to seeing how I can use DLL's in my programs(the dll viewer was the best find)

Login to post a reply

Server time is: 2024-05-09 04:59:12
Your offset time is: 2024-05-09 04:59:12