Yoko
http://forum.yoko.com.ua/

Opitional Parameters
http://forum.yoko.com.ua/viewtopic.php?f=3&t=17069
Page 1 of 1

Author:  DracoX [ 2012-09-27 21:29:03 ]
Post subject:  Opitional Parameters

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?

Author:  Juicy Fruit [ 2012-09-28 00:51:54 ]
Post subject:  Re: Opitional Parameters

With this script.dll. viewtopic.php?f=12&t=16689

Function overloading:
Code:
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.

Author:  DracoX [ 2012-09-28 15:20:35 ]
Post subject:  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!

Author:  Destruction [ 2012-09-28 23:31:44 ]
Post subject:  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..).

Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/