Basic Math Using Scripting


Hi there. I’ve come across this basic math using scripting calculator – Its very useful. Been reading a bit on the programming language lua used to create it and I have a question. The above is great if you want to do basic add, multiply, subtract etc. But if you want to create an if ruleset – e.g. how would you go about writing it? In essence I want a person to enter a value in a text box and say if said number (lets call it a) is between x and y then a*z otherwise if a is between x and y then a*z otherwise a is between x and y then a*z etc etc. The code for the basic math using scripting is as follows

numberofshirts = getvalue(5) –Get value of first textbox
shirtprice = 0.002 –Replace 15 with amount of shirt

totalamountdue = (numberofshirts * shirtprice) –Multiply the first textbox times the shirt amount

setvalue(6,totalamountdue) –Change 6 to ID of Hidden Value or Textbox


Any ideas on how I can edit to do the above? 

Warren asked


    Question stats

    • Active
    • Views41 times
    • Answers0 answers
    • Followers1 follower