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?
Opitional Parameters
Moderators: Murderator+, Murderator
-
- Posts: 820
- Joined: 2011-06-11 19:54:23
Re: Opitional Parameters
With this script.dll. viewtopic.php?f=12&t=16689
Function overloading:
,exec with functions with parameters - see example in latest post.
Function overloading:
Code: Select all
Sub Magery(p)
...
end sub
Sub Magery(p1,p2)
...
end sub
Sub Magery(p1,p2,p3)
...
end sub
etc...
,exec with functions with parameters - see example in latest post.
Re: Opitional Parameters
Thx for the info!
I might not use this, since I script for other players, and they usually have issues for not following instructions like "download this script.dll and paste it in your Injection folder". Yeah.. they usually don't even read XD
But it's nice to know that there are some developments going around!
I might not use this, since I script for other players, and they usually have issues for not following instructions like "download this script.dll and paste it in your Injection folder". Yeah.. they usually don't even read XD
But it's nice to know that there are some developments going around!
-
- Junior Expert
- Posts: 3221
- Joined: 2004-06-24 22:08:56
Re: Opitional Parameters
U can set global variables and then call required function.
To simplfy developing process, u can write like Juicy advises and write some converter to compatible version (its not so hard..).
To simplfy developing process, u can write like Juicy advises and write some converter to compatible version (its not so hard..).
YokoInjection CodeSweeper
Function not found?
Possession of mathematics at the level of art - a gift that is only available for election.
Sorry for my clumsy English.
Telegram: @tatikom
Function not found?
Possession of mathematics at the level of art - a gift that is only available for election.
Sorry for my clumsy English.
Telegram: @tatikom