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
7
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?



So if I use it like



I get 4 in return
WickedX
15
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
punkyb
7
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



or

Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
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
7
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
DBPro Master
16
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:



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.



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
7
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: 2024-03-28 09:46:05
Your offset time is: 2024-03-28 09:46:05