Imagine Nation Forums
Injection: Passing a parameter into a function? - Printable Version

+- Imagine Nation Forums (https://in-uo.net/forums)
+-- Forum: Imagine Nation archive (https://in-uo.net/forums/forumdisplay.php?fid=6)
+--- Forum: Questions and Answers (https://in-uo.net/forums/forumdisplay.php?fid=27)
+--- Thread: Injection: Passing a parameter into a function? (/showthread.php?tid=4925)



Injection: Passing a parameter into a function? - Nasir - 02-26-2012

Does anyone know how I would pass a value into my function using ,exec / a hotkey? My goal here is to have one set of functions to handle casting instead of one for scrolls and a copy for normal casting.

Also, I'm not sure if boolean values even exist in injection's script?

Code:
sub greaterHeal_self(useScroll)
    uo.waittargetself();

    if uo.count(scroll_greater_heal) > 0 AND useScroll = true then
        uo.usetype(scroll_greater_heal);
    else
        uo.cast("Greater Heal");
    endif
end sub



Injection: Passing a parameter into a function? - Cana - 02-27-2012

I'd like to know this too. I experimented a bit but was unable to use ,exec testfunction(param) command. Don't think there's a boolean datatype. Only thing I found was this bit about expression evaluation:

- IF-THEN condition. You can use "<",">","<=",">=","==","<>" to check if
one value is less then other. Use "AND", "OR", "NOT" in boolean expressions.
You cn use "&&" instead of "AND" and "||" instead of "OR". The zero value is
considered FALSE, the non-zero is TRUE.


Injection: Passing a parameter into a function? - Raziel_ - 02-27-2012

Cana Wrote:I'd like to know this too. I experimented a bit but was unable to use ,exec testfunction(param) command. Don't think there's a boolean datatype. Only thing I found was this bit about expression evaluation:

- IF-THEN condition. You can use "<",">","<=",">=","==","<>" to check if
one value is less then other. Use "AND", "OR", "NOT" in boolean expressions.
You cn use "&&" instead of "AND" and "||" instead of "OR". The zero value is
considered FALSE, the non-zero is TRUE.

if this is true then the zero value and non zero value works like a boolean...


Injection: Passing a parameter into a function? - Cana - 02-27-2012

Raziel_ Wrote:if this is true then the zero value and non zero value works like a boolean...

Yes, sort of. If anyone is looking for more information some can be found here. It's not complete by any means but the text file (scripting.txt) can get you started.


Injection: Passing a parameter into a function? - Eru - 02-27-2012

Just thinking outside the box here, but you could make a boolean variable using conditionals for ingame items. Like checking the itemid of a lantern that is turned on or off, then using the lantern to change the value.