A spot of direction here maybe to a tutorial or another example where this has been done would be nice. Thankyou.
I would like livecode to calculate the following x/y and put the answer in another field. The calculations would be minimum 300 up to max 5000 divided by only three default values (8. 12 and 16.5 and rounded up).
I know how to use the 'put' command here. But, I do not know which number between 300 and 5000 the user will type so how do I code for this unknown factor? Also this answer has to go into a variable and be calculated together with a ticked box in order to arrive at a final result.
For this last operation I presume that I can experiment where the one variable can hold two parameters.
Maths calculations
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Maths calculations
There are many ways to do this, mostly dependent on how you want the user to interface with the process. The arithmetic part is the least of it:
put value1 / value2 into field "answerField"
Since there are only three divisors, shall they pick those from a short list, after entering the dividend in a field? Shall each value be entered in its own field? Shall a button present dialogs in sequence, asking for the two values, with the second dialog (divisor) offering three choices that the user selects as opposed to entering in a field?
In other words, where are you with your knowledge of LiveCode? Please write back and tell us.
Craig Newman
put value1 / value2 into field "answerField"
Since there are only three divisors, shall they pick those from a short list, after entering the dividend in a field? Shall each value be entered in its own field? Shall a button present dialogs in sequence, asking for the two values, with the second dialog (divisor) offering three choices that the user selects as opposed to entering in a field?
In other words, where are you with your knowledge of LiveCode? Please write back and tell us.
Craig Newman
Re: Maths calculations
Sorry, now I see where I have not made it clear. the syntax you gave me thankyou. The user will input a number between 300 and 5000, the user will then click a radio button which provides him with three choices, these three choices will respectively represent the divisor 8, 12 , 16.5 and at that moment the user will be taken to card two where an answer will be seen in a field.
Where am I in my livecode knowledge? About 60 hours from the start line. And finding quite honestly, having tried the LCU, reading the PDF, reverse engineering, reading other literature, that the only effective way for me to understand and learn is to make up my own exercise and do it. At this moment in time all the rest has been counter-intuitive and counter productive except by way of introducing me to everything and gaining a basic familiarity with the programming language and IDE.
Where am I in my livecode knowledge? About 60 hours from the start line. And finding quite honestly, having tried the LCU, reading the PDF, reverse engineering, reading other literature, that the only effective way for me to understand and learn is to make up my own exercise and do it. At this moment in time all the rest has been counter-intuitive and counter productive except by way of introducing me to everything and gaining a basic familiarity with the programming language and IDE.
Re: Maths calculations
Hi.
You will find soon that you "get it". This does not mean that all of a sudden you have a 2000 word vocabulary and concomitant experience with each. It means that you will be comfortable with the structure and toolbox of LC, be able to build stuff with confidence, and be able to better research new tools you will need in the future. The dictionary is your friend, as the great Klaus would say.
And you are quite correct in that the best way to learn is by doing. It is perhaps the only way. The learning materials available, in my opinion, lead new users to believe that a "classroom" environment will suffice. It will not. I always ask new users to build an address book or calculator. They are no longer newbies after that, the exercise being far richer than the resultant stack.
And use this forum as much as you like. Everyone here is eager to help. I personally do not like to give ready-made solutions, if I think that tasking is better. This smugness is a character flaw I am working on. Clues and hints, yes; there was one such in my last reply, and you seem to have taken it in stride and moved forward.
Once you get your radio buttons to work as you wish, you might try five different ways to do the same thing. The exercise is richer than the result. The little things will drive you nuts. Triumphs will follow...
Craig
You will find soon that you "get it". This does not mean that all of a sudden you have a 2000 word vocabulary and concomitant experience with each. It means that you will be comfortable with the structure and toolbox of LC, be able to build stuff with confidence, and be able to better research new tools you will need in the future. The dictionary is your friend, as the great Klaus would say.
And you are quite correct in that the best way to learn is by doing. It is perhaps the only way. The learning materials available, in my opinion, lead new users to believe that a "classroom" environment will suffice. It will not. I always ask new users to build an address book or calculator. They are no longer newbies after that, the exercise being far richer than the resultant stack.
And use this forum as much as you like. Everyone here is eager to help. I personally do not like to give ready-made solutions, if I think that tasking is better. This smugness is a character flaw I am working on. Clues and hints, yes; there was one such in my last reply, and you seem to have taken it in stride and moved forward.
Once you get your radio buttons to work as you wish, you might try five different ways to do the same thing. The exercise is richer than the result. The little things will drive you nuts. Triumphs will follow...
Craig