I need help with a script

Posted:
16 Jul 2021, 17:42
by LECZ
I am making a shop and this is the problem
Every time Tux wants to buy something and doesn't bring coins, he buys it anyway.
I did this script but it doesn't work for me:
if("coins" >= 50){
Tux.add_coins(-50);
Tux.add_bonus("grow");
}
Re: I need help with a script

Posted:
17 Jul 2021, 07:29
by DevonST
"coins" is a string of text because it is inside quotation marks. A good programming language would tell you that strings are not comparable with numbers. You should replace "coins" with Tux.get_coins()
Re: I need help with a script

Posted:
17 Jul 2021, 17:04
by LECZ
DevonST {l Wrote}:"coins" is a string of text because it is inside quotation marks. A good programming language would tell you that strings are not comparable with numbers. You should replace "coins" with Tux.get_coins()
something like that?:
if(Tux.get_coins() >= 50){
Tux.add_coins(-50);
Tux.add_bonus("grow");
}
Re: I need help with a script

Posted:
19 Jul 2021, 21:16
by LECZ
DevonST {l Wrote}:Yeah, that should work
Thanks for your help if it works
