Closed GoogleCodeExporter closed 9 years ago
I was also looking to see if there was any form of IF function, which I saw the
example under set:
set, {$var6:false},
jump, {var6:true},
/* jump is not executed because var6 is false */
That would work with a good portion of the vn's IFs i'm working on, but could
the engine support something like this:
set, {var2:90}
set, {var3:1}
jump, {var2:>=90}, {var3:1},
The jump function is evaluated on two conditions. The first being var2 is more
than or equal to 90 and var3 is 1.
Thanks again,
Joshua
Original comment by joshuaca...@gmail.com
on 9 May 2012 at 1:11
Hi Joshua,
Currently, there's no random value generator. Or a multiple condition jump.
Workaround is to use a macro, which executes custom javascript. You can use
Helper.setValue and Helper.getValue methods.
For example:
function macro_random()
{
/* generate random value from 1 to 10 */
Helper.setValue("random_var_name", Math.floor((Math.random()*10)+1))
}
then in script:
set, {"random_var_name", 0}, /* create variable */
macro, "macro_random",
You can do something similar to multiple condition jumps, by creating a macro
that reads variable values, perform logic, then set the result to another
variable. Then in the script, use this result variable as parameter to "jump".
Will consider adding these on future revisions. Shouldn't be too hard. I think
:)
Thanks!
Original comment by oclabbao
on 15 May 2012 at 3:52
Oh, sorry about the example, mistyped that one. 'jump' should have a label to
jump to.
set, {$var6:false},
jump, {var6:true},
/* jump is not executed because var6 is false */
This should have read:
set, {$var6:false},
jump, {var6:true, label:"some_label_to_jump_to"},
/* jump is not executed because var6 is false */
See 'jump' for samples on conditional jumps and also loops.
Original comment by oclabbao
on 15 May 2012 at 4:04
Managed to squeeze some time and implement the above (yey!). I'm not ready to
release a revision yet though, so if you want to try it out, please checkout
the latest source from SVN.
To use:
set, {var1:"random"}, /* generate random float between 0 and 1 */
set, {var1:"random 10 20}, /* generate random integer between min and max
values */
jump, {label:"label1", var1:10, var2:20} /* jump to label1 if ALL conditions
are true */
Thanks! Keep the issues/requests coming! :)
Original comment by oclabbao
on 16 May 2012 at 12:40
xD Very awesome! I'll let you know if I run into any other possible requests.
Thanks!
Original comment by joshuaca...@gmail.com
on 16 May 2012 at 10:40
Original comment by oclabbao
on 31 Jan 2013 at 8:11
Original issue reported on code.google.com by
joshuaca...@gmail.com
on 9 May 2012 at 12:35