There are a couple of tricks that you can use within DBPro. The easiest is probably to just pass a UDT:
`init -----------------------------------------------------------------
type ArgsData
x as integer
y as integer
z as integer
endtype
new_Args as ArgsData
new_Args.z = 1 `sets the default
`at some point later calling the function ----------------------------------------
tArgs as ArgsData
tArgs = new_Args `this applies the custom default values
tArgs.x = 10
tArgs.y = 15
`tArgs.z = 50 `you can optionally overwrite the default, or leave it as is
DoThis(tArgs)
`function declaration
function DoThis(rArgs as ArgsData)
retVal = rArgs.x + rArgs.y + rArgs.z
endfunction retVal
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.
DoThis(str$(x) + "," + str$(y) + "," + str$(z))
DoThis((str$(x) + "," + str$(y) )
DoThis("1,2")
DoThis("1,2,10")
function DoThis(rArgs as string)
split string rArgs, ","
x = intval(split word$(1))
y = intval (split word$(2))
if split count() < 3
z = 1
else
z = intval(split word$(3))
endif
retVal = x + y + z
endfunction retVal
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.