Thanks in advance.
Itay
![Smile :)](./images/smilies/icon_smile.gif)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
add X to field "yourField"
Yes I do know that.dunbarx wrote:We would need to know more about how things are "bought".
If you have a field with a number in it, do you know that you can:This is basic stuff, which you say you are already OK with. Is that so? Or am I missing your point?Code: Select all
add X to field "yourField"
Craig Newman
Code: Select all
if field "name" >49
then
subtract 50 from field "name"
else
answer "You can't buy this upgrade yet!"
end if
Yes I do know that.AgentItay wrote:dunbarx wrote:We would need to know more about how things are "bought".
If you have a field with a number in it, do you know that you can:This is basic stuff, which you say you are already OK with. Is that so? Or am I missing your point?Code: Select all
add X to field "yourField"
Craig Newman
Code: Select all
if field "name" >49
then
subtract 50 from field "name"
else
answer "You can't buy this upgrade yet!"
end if
As I said, I need to know how to do that once the upgrade is purchased, it will add X amount to the said field, every X amount of time. And also, that for every X upgrades bought, it will add X multiplied by Y (the amount bought) in F amount of time.dunbarx wrote:Hi.
OK, then. But if you are already doing that, what can we help you with?
Craig
Sure, sorry.dunbarx wrote:Is there a timer of some sort involved in your process? Or is each instance of a purchase an isolated event?
Without knowing a bit more of how your project is constructed, it is hard, at least for me, to answer your questions. So, given the above two queries, can you lay out the procedure under which you want to make these changes? Perhaps describe a brief scenario of a typical purchase or series of purchases and the tasks that should go along with them. Do this in a step by step fashion.
Craig
Code: Select all
on mouseUp
addDough
end mouseUp
on addDough
if the optionKey is down then exit addDough --how else could you get out of this madness?
add 0.2 to fld 1
send "addDough" to me in 12 ticks --0,2 seconds
end addDough
Thank you very much Craig!dunbarx wrote:OK.
Your first lesson in sending messages in time. Make a button and a field on a new card.
In the button script:Now can you better this in that the addition is made only if some other condition is met, for example, the hilite of a factory button is "true"? Or if two factory button hilites are true, the value that is added is not an explicit "0.2" but rather a multiple of that?Code: Select all
on mouseUp addDough end mouseUp on addDough if the optionKey is down then exit addDough --how else could you get out of this madness? add 0.2 to fld 1 send "addDough" to me in 12 ticks --0,2 seconds end addDough
Craig Newman
Thanks Craig. I do think LC is fundunbarx wrote:Hi.
There is no reason at all to give me any credit. Please do not. As long as you think LC is fun, I am satisfied.
Craig
I included a line that allowed the process to end when the optionKey was pressed. If you look at the code, there is no other way to exit, short of command-period or unplugging or shooting the machine.how can I make the script you gave me stop adding the points to the field, after a button is clicked?
How did you stop the handler? The "Alt" key is the Windows version.I also didn't understand what option key is.
Code: Select all
if the optionKey is down then exit addDough
Code: Select all
if the mouseLoc is within the rect of button "yourStopButton" and the mouse is down...
or
if the stopFlag of this stack is "Stop"...
or
if the hilite of button "yourStopButton" is "true" then...