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.

Newcomers DBPro Corner / Default Function Parameters?

Author
Message
punkyb
1
Years of Service
User Offline
Joined: 8th Sep 2016
Playing: PC and Android Games
Posted: 6th Oct 2016 21:35
Hi,

I'm just trying out DBPro and I would like to know if it is possible and how to use default function parameters like this?

+ Code Snippet

So if I use it like

+ Code Snippet

I get 4 in return
WickedX
8
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 7th Oct 2016 08:15 Edited at: 7th Oct 2016 08:15
+ Code Snippet
punkyb
1
Years of Service
User Offline
Joined: 8th Sep 2016
Playing: PC and Android Games
Posted: 7th Oct 2016 10:34
Thanks. I mean I have to set it as an option.

So either I can do this

+ Code Snippet

or

+ Code Snippet
Phaelax
DBPro Master
14
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Agartha
Posted: 7th Oct 2016 13:59
DBP does not offer function overloading. The overkill solution would be to build your own DLL plugin in C++ and create those functions there, that is possible.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
punkyb
1
Years of Service
User Offline
Joined: 8th Sep 2016
Playing: PC and Android Games
Posted: 7th Oct 2016 14:06
Ok got it, thanks Phaelax! just curious if this is supported by default.
Ortu
9
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 13th Oct 2016 03:09 Edited at: 13th Oct 2016 15:19
There are a couple of tricks that you can use within DBPro. The easiest is probably to just pass a UDT:

+ Code Snippet

If you want something more free form, you could pass everything as a single string and parse it down into arguments. not the most efficient method, but provides the functionality if you really need it.

snippet uses Matrix1 plugins, you can do the equivalent with native commands, but you will be better off getting Matrix1 if you dont already have it.

+ Code Snippet

If you end up sticking with DBpro, you will find that part of its fun and charm can actually be finding ways to work around its shortcomings.


A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
punkyb
1
Years of Service
User Offline
Joined: 8th Sep 2016
Playing: PC and Android Games
Posted: 13th Oct 2016 11:50
Thanks Ortu! I could try this one out. It's not really that much of a bother but more like a nice feature to have!

Yes, I'm hoping I could just make a decent game with DBPro and so far so good with what I have got.

Login to post a reply

Server time is: 2017-10-19 22:38:56
Your offset time is: 2017-10-19 22:38:56