regarding scripts, how can i put and if statement?

regarding scripts, how can i put and if statement? like for example if the variable a = 1, set it to 0. else, set it to 1.

thanks and God bless!

]]>

4 Commentsto regarding scripts, how can i put and if statement?

  1. Anonymous says:

    < ![CDATA[

    This way:


    var vars = LL.getVariables();


    var value = vars.getInteger(‘a’);


    var new_value;


    if(value == 0) {


      new_value = 1;


    } else {


      new_value = 0;


    }


    vars.edit().setInteger(‘a’, new_value).commit();




    or in a more consice form:



    var vars = LL.getVariables();


    vars.edit().setInteger(‘a’, vars.getInteger(‘a’)==0 ? 1 : 0).commit();




    or if value is always 0 or 1:



    var vars = LL.getVariables();


    vars.edit().setInteger(‘a’, 1- vars.getInteger(‘a’)).commit();

    ]]>

  2. Anonymous says:

    < ![CDATA[

    do you have a tutorial on how to use scripts in LL? i’m so interested on scripts but i don’t really have a knowledge about everything. hahaha

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Pierre Hébert thanks!

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Most scripts will have instructions with them. You need to allow scripts to be run menu/settings/lightning general/expert mode/run scripts.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *