Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Multiple Currencies and Shop
- Orangeguy426
-
27 posts
Multiple Currencies and Shop
Hello!
I am making a clicker game called Coder and it needs a different currency (Code projects (Games created)). I wanted to know a good way to create code so that you could make Code projects and get monies at the same time.
I also want to know how I could create a shop like this:
Money Shop
Auto-Coder: $100
Auto-Engineer: $1,000
Project Shop
Coding Project: $500
Super Coding Project: 5 Coding Projects
Coding Project that will change the world: 10 Super Coding Projects
My current code: (edited for every change people answer with)
Circle Of Clickness
OR
I am making a clicker game called Coder and it needs a different currency (Code projects (Games created)). I wanted to know a good way to create code so that you could make Code projects and get monies at the same time.
I also want to know how I could create a shop like this:
Money Shop
Auto-Coder: $100
Auto-Engineer: $1,000
Project Shop
Coding Project: $500
Super Coding Project: 5 Coding Projects
Coding Project that will change the world: 10 Super Coding Projects
My current code: (edited for every change people answer with)
Circle Of Clickness
when this sprite clicked
change [Money] by (1)
next costume
wait (0.1) secs
next costume
define Buy (item) for (price)
if <(price) > (Money)> then
set (item) to ((item) + (1))
set (Money) to ((Money) - (price)
else
say [Oops, it seems you don't have enough money.] for (2) secs
end
OR
define Buy (item) for (price)
if <(price) > (Money)> then
replace item (item # of (item) in [options v] :: list) of [amount of each v] with ((item (item) of [amount of each v] :: list) + (1))
set (Money) to ((Money) - (price)
else
say [Oops, it seems you don't have enough money.] for (2) secs
end
Last edited by Orangeguy426 (Sept. 11, 2019 23:03:47)
- StrangeMagic32
-
1000+ posts
Multiple Currencies and Shop
This could work if you made 2 lists.
Buy [Tree] for (100)
define Buy (item) for (price)
if <(price) < ($)> then
replace item (item # of (item) in [options v] :: list) of [amount of each v] with ((item (item) of [amount of each v] :: list) + (1))
set [$ v] to (($) - (price))
else
say [Oops, it seems you don't have enough money.] for (2) secs
end
Last edited by StrangeMagic32 (Sept. 12, 2019 02:57:25)
- codeman1044
-
1000+ posts
Multiple Currencies and Shop
I think you made a small mistake in that… are you -snip-supposed to use an (item # of () in ) reporter and a regular (item () of ) reporter in your replace script?
Also, you should probably throw in an operator in the greater than boolean so the code checks for greater than or equal to instead of just greater than.
Last edited by codeman1044 (Sept. 9, 2019 01:12:06)
- StrangeMagic32
-
1000+ posts
Multiple Currencies and Shop
yeah I messed up a little, let me just fix itI think you made a small mistake in that… are you -snip-supposed to use an (item # of () in ) reporter and a regular (item () of ) reporter in your replace script?
Also, you should probably throw in an operator in the greater than boolean so the code checks for greater than or equal to instead of just greater than.
- Orangeguy426
-
27 posts
Multiple Currencies and Shop
This could work if you made 2 lists.Buy [Tree] for (100)
define Buy (item) for (price)
if <(price) > ($)> then
replace item (item # of (item) in [options v] :: list) of [amount of each v] with ((item (item) of [amount of each v] :: list) + (1))
else
say [Oops, it seems you don't have enough money.] for (2) secs
end
Also couldn't you make variables instead of lists? like add a variable for each item?
Ex.:
Buy [Tree] for (100)
define Buy (item) for (price)
if <(price) > ($)> then
set (item) to ((item) + (1))
else
say [Oops, it seems you don't have enough money.] for (2) secs
end
- codeman1044
-
1000+ posts
Multiple Currencies and Shop
Yes, you could, but that would be a loss of efficiency. Using a list would be more effective, less laggy (proven), less confusing, and more organized. couldn't you make variables instead of lists? like add a variable for each item?
- StrangeMagic32
-
1000+ posts
Multiple Currencies and Shop
-snip-I fixed a few more mistakes on my part
Last edited by StrangeMagic32 (Sept. 12, 2019 02:58:11)
- Discussion Forums
- » Help with Scripts
-
» Multiple Currencies and Shop