Discuss Scratch

KingMCPEx
Scratcher
14 posts

Glitched Currency Code

I am making a somewhat “game” that requires clicks (or currency) to buy bots that can help you in the game.
I know how to make the code, but it requires the EXACT amount of clicks/currency in order to purchase the bot.
I need help to make it so that it can order these items/bots without EXACTLY getting (xyz) amount of currency!

Here is the project. The code I am talking about is under the “buy” arrows.
https://scratch.mit.edu/projects/156096904/#player

Thanks.
GunChleoc
Scratcher
500+ posts

Glitched Currency Code

Is this what you are looking for?

if <<(Button Clicks) < [11]> and <(Button Clicks) > [5]>> then
Do something
end
This condition will be satisfied for 6, 7, 8, 9 or 10 button clicks - adjust the numbers to what you need.

Last edited by GunChleoc (April 20, 2017 12:56:40)

rpglurker
Scratcher
100+ posts

Glitched Currency Code

You can use inequalities to check and make sure you do not have less than the currency required…. (This is the same as saying equal or greater than the currency required, but requires less code

Happy Scratching
KingMCPEx
Scratcher
14 posts

Glitched Currency Code

GunChleoc wrote:

Is this what you are looking for?

if <<(Button Clicks) < [11]> and <(Button Clicks) > [5]>> then
Do something
end
This condition will be satisfied for 6, 7, 8, 9 or 10 button clicks - adjust the numbers to what you need.

Doesn't make sense to me, but I'll try
KingMCPEx
Scratcher
14 posts

Glitched Currency Code

GunChleoc wrote:

Is this what you are looking for?

if <<(Button Clicks) < [11]> and <(Button Clicks) > [5]>> then
Do something
end
This condition will be satisfied for 6, 7, 8, 9 or 10 button clicks - adjust the numbers to what you need.

What do you mean by condition? I literally don't know what this technically does, is this some type of number range between 5 and 11? Heck, I don't even think this is what I needed, I needed some type of code that would let you receive said item without exactly having the amount it needed, and your code didn't do anything at all..
Leleo
Scratcher
2 posts

Glitched Currency Code

KingMCPEx wrote:

What do you mean by condition?

A condition is something that needs to be TRUE so everything inside the IF block happens. In GunChleoc's example, the Condition is the variable Button Clicks being 6, 7, 8, 9 or 10 (or <11 and >5).

What I got from your project is that you want to let the player buy a bot using clicks. Try something like this:

if <<(Button Clicks) > [10]> or <[Button Clicks] = [10]>> then
Buy bot and add clicks per second
end

This game has loads of potential. I have some ideas for you, let me know if you want them!
Mole_Gaming
Scratcher
100+ posts

Glitched Currency Code

if <not <(Clicks) < (Price)>> then

end
KingMCPEx
Scratcher
14 posts

Glitched Currency Code

..this was so simple;
..a user named Patrrys just remixed my project and let me copy his SIMPLE code. One of you should've just did that in the first place, instead of talking about these {i forgot} weird things I couldn't understand. I don't mean to be disrespectful, but this is honestly just so weird, that I'll just delete this project if I can.

Thank you, Patrrys, I will always remember you and always credit you on that project.

Last edited by KingMCPEx (April 21, 2017 12:45:20)

superphill1
Scratcher
100+ posts

Glitched Currency Code

KingMCPEx wrote:

I am making a somewhat “game” that requires clicks (or currency) to buy bots that can help you in the game.
I know how to make the code, but it requires the EXACT amount of clicks/currency in order to purchase the bot.
I need help to make it so that it can order these items/bots without EXACTLY getting (xyz) amount of currency!

Here is the project. The code I am talking about is under the “buy” arrows.
https://scratch.mit.edu/projects/156096904/#player

Thanks.
Try using a variable called money or something and if money = ? then broadcast bot and change money by however much it cost. Then have the bot, when receive broadcast bot, to do whatever you want it to do.

Also to collect money, just have a sprite like a coin and have it so when it is touching you then it is to change variable money by 1 and then hides itself.

Last edited by superphill1 (April 21, 2017 14:17:21)

KingMCPEx
Scratcher
14 posts

Glitched Currency Code

superphill1 wrote:

KingMCPEx wrote:

I am making a somewhat “game” that requires clicks (or currency) to buy bots that can help you in the game.
I know how to make the code, but it requires the EXACT amount of clicks/currency in order to purchase the bot.
I need help to make it so that it can order these items/bots without EXACTLY getting (xyz) amount of currency!

Here is the project. The code I am talking about is under the “buy” arrows.
https://scratch.mit.edu/projects/156096904/#player

Thanks.
Try using a variable called money or something and if money = ? then broadcast bot and change money by however much it cost. Then have the bot, when receive broadcast bot, to do whatever you want it to do.

Also to collect money, just have a sprite like a coin and have it so when it is touching you then it is to change variable money by 1 and then hides itself.

..already done found out a way.

Powered by DjangoBB