Hm, let me see...
Maybe remove the givemoney handler from the button and put it into the stack script and let it accept one parameter,
so you can call it from everywhere.
Code: Select all
global give_money_id
## So we can pass any number (also negative numbers like -10)
command give_me_your_money the_amount_of_money
## If we do not pass a number, the handler will use 1 (for your periodic money adding):
if the_amount_of_money = EMPTY then
put 1 into the_amount_of_money
end if
## Mouse is still DOWN.
## We can add something directly to a field, as long as the field contains a number!
add the_amount_of_money to fld "moneyfield"
## LC will first examine the values in parens, so we can do this "Boolean" trick :-)
set the enabled of btn "levelUp1" to (fld "moneyfield" > 9)
## We will SEND this handler only if we add 1 = periodic adding of money!
## This way we can use it to just add or subtract any value <> 1 from the "moneyfield"
if the_amount_of_money <> 1 then
exit give_me_your_money
end if
send "give_me_your_money" to me in 1 secs
put the result into give_money_id
end give_me_your_money
So when clicking the button which steals you 10 "money" you can:
Code: Select all
on mouseup
give_me_your_money -10
end mosueup
Understand what I am doing here? Ask if not!
Best
Klaus