Opitional Parameters
Posted: 2012-09-27 21:29:03
Is there a way to create a function that may receive 0 OR 1 OR 2 parameters.
For example:
0 parameters:
Magery() ; Would cast a default spell without waiting the result of the cast
1 parameter:
Magery('Magic Arrow') ; Would cast 'Magic Arrow' into a target without waiting the result of the cast
2 parameters:
Magery('Magic Arrow',5000) ; Would cast 'Magic Arrow' into a target and wait up to 5sec for the result
I've tryed using Sub Magery(param1) and Sub Magery(param1,param2) in my autoload and Injection only checked one of them for parameter number.
The objective is to be able to use ,exec Magery ingame and Magery(...) with as much parameters as I need
One more thing... Is there a way to use ,exec with functions with parameters?
For example:
0 parameters:
Magery() ; Would cast a default spell without waiting the result of the cast
1 parameter:
Magery('Magic Arrow') ; Would cast 'Magic Arrow' into a target without waiting the result of the cast
2 parameters:
Magery('Magic Arrow',5000) ; Would cast 'Magic Arrow' into a target and wait up to 5sec for the result
I've tryed using Sub Magery(param1) and Sub Magery(param1,param2) in my autoload and Injection only checked one of them for parameter number.
The objective is to be able to use ,exec Magery ingame and Magery(...) with as much parameters as I need
One more thing... Is there a way to use ,exec with functions with parameters?