north_star 16 Posted March 23, 2013 Report Share Posted March 23, 2013 Hi, I need someone help , I setup a variable and use it on $eval command for simple math command, it appear that it has a bug ( its works when I click run node, but fail when I play the bot ) reported as instructed but no answer yet, My situation is urgent, and if anyone knows how to setup a code for just simple to return a result from example ( 1+2=#var ) I will be greatfully thanks.. Quote Link to post Share on other sites
VaultBoss 310 Posted March 23, 2013 Report Share Posted March 23, 2013 Here is an example: divider define $integerNumJS(#var_INP_Number) { divider if($comparison(#var_INP_Number, "<", 0)) { then { set(#var_LOC_IntegerNum, $subtract(0, #var_INP_Number), "Local") } else { set(#var_LOC_IntegerNum, #var_INP_Number, "Local") } } divider set(#var_LOC_IntegerNum, $eval("var locworknum = {#var_LOC_IntegerNum}; locworknumint = ~~locworknum;"), "Local") divider if($comparison(#var_INP_Number, "<", 0)) { then { set(#var_OUT_Result, $subtract(0, #var_LOC_IntegerNum), "Local") } else { set(#var_OUT_Result, #var_LOC_IntegerNum, "Local") } } divider return(#var_OUT_Result) } divider... that returns the INTEGER of a number to use in UBot Studio.Change it to suit your needs. 1 Quote Link to post Share on other sites
north_star 16 Posted March 23, 2013 Author Report Share Posted March 23, 2013 thanks vault boss this is what I do need it, you save may time man Quote Link to post Share on other sites
VaultBoss 310 Posted March 23, 2013 Report Share Posted March 23, 2013 You're welcome I created a whole library of JavaScript functions for UBS, to supplement what existed already natively. Helps a LOT! Quote Link to post Share on other sites
north_star 16 Posted March 23, 2013 Author Report Share Posted March 23, 2013 set(#var_LOC_IntegerNum, $eval("var locworknum = {#var_LOC_IntegerNum}; Now this is the trouble man . When I Click "RUN NODE" its working and shows the result, but when I play the Bot, its has empty result...its strange but its also happen to my main bot. Do you know other command to avaoid of using $eval command ..? Quote Link to post Share on other sites
VaultBoss 310 Posted March 23, 2013 Report Share Posted March 23, 2013 If you used my code, that is normal to happen, as the variables within the function are "Local" so you won't see their values in the DEBUGGER, but only the variable returned by the RETURN command (the result of the function, basically) If you want to see how the variables inside the custom function work, turn them to "Global", watch the DEBUGGER... then in working environment, turn them back to "Local" 1 Quote Link to post Share on other sites
north_star 16 Posted March 23, 2013 Author Report Share Posted March 23, 2013 ahh I see, Its simply because of local and global setting fuction , and yes its working , thanks man Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.