Discuss Scratch

aust120YT
Scratcher
16 posts

If the player doesn’t have enough cookies (variable) how can I block it from not happening?

I have a cookie clicker in progress (link is: https://scratch.mit.edu/projects/576460216/ !) but the issue is I can’t find out how to block it or have a message saying not enough cookies. Can anyone help me with this? I would like it to be newly like 2021! Please help me somebody? (No pen pls)
NMario84
Scratcher
1000+ posts

If the player doesn’t have enough cookies (variable) how can I block it from not happening?

orangetheory
Scratcher
500+ posts

If the player doesn’t have enough cookies (variable) how can I block it from not happening?

We can check if the person has enough or less cookies using if statements, which can be found in the control section. Then, we can add a boolean checking if the var Cookies is over or equals the cost.
when green flag clicked 
forever
if <<mouse down> and <touching [mouse pointer v]>> then
if <<(cookies) = [100]> or <(cookies) > [100]>> then
broadcast [grandma e.g. v]
else
say [you don't have enough money!] for (2) secs
end
end

Last edited by orangetheory (Sept. 29, 2021 20:36:24)


-Frisbee- -Cricket--Basketball--Forums--Mapping--Coding--Trigonometry master--Mathematics King--Future Prime Minister--Intro-Maker-
I know HTML/CSS, and JavaScript, and with these coding skills I have made some decent projects! Test them out below!
~Archery~Cops + Robbers~
Want an intro, outro, music, effects, or more? Check out the intro shop!

The forum helpers, a place where we help people in the forums
sharkode
Scratcher
1000+ posts

If the player doesn’t have enough cookies (variable) how can I block it from not happening?

when this sprite clicked
if <(cookies) > (cost)> then

upgrade

else

say [not enough cookies]
end

Last edited by sharkode (Sept. 29, 2021 20:35:43)


>>>This suggestion could end reduce mass reporting.<<<
=======================================================================================
Common forum languages (highlight this text and click shift+down arrow for more):
  • Support - Means someone supports a suggestion, make sure to say the reason when you are supporting a suggestion.
  • No support - Means someone don't support a suggestion, while it may sound a little mean, it's actually not as not everybody have to support the suggestion you purposed.
  • Bump - Bumping is a method of bringing a topic back to the front page.
  • Necroposting - Means bringing an old, dead, topic that nobody cares about back to life, necroposting comes from the greek word “nekros” meaning “corpse”, necroposting is prohibited as it wastes front page space.
  • Ocular - A website that allows you to search forum posts.
  • Dupe/duplicate - Posts that suggests the same thing, it's a good idea to use Ocular.
  • ST - Is short for Scratch Team, the moderators on this site.
  • ToS - Is short for Terms of Use, a bunch of legal jargon and stuffs like that.
  • TOLoRS - Is short for The Official List of Rejected Suggestions, it's always a good idea to read it before making a suggestion.
  • Kaj - A user who threatened to hack Scratch, he later became a legend and people often joked about him hacking posts.
Nezon
Scratcher
1000+ posts

If the player doesn’t have enough cookies (variable) how can I block it from not happening?

NMario84 wrote:

Duplicate
https://scratch.mit.edu/discuss/topic/307089/
I don't think that topic will help the user, and I believe that you should rather help them than simply linking a topic. You just led them to be necroposting


————————-
OP (Original Poster), Please try this

if <(coins) < [required amount]> then
broadcast [Not enough coins! v]
end

// Create a sprite that has a text costume saying, "Not enough coins", and decorate it if you want.

when I receive [ v]
show
wait (1) secs
hide

This is my signature (it goes automatically under every post I make)! Here is a bit of advice on foruming, by the way. Don't do SAND. SAND means four words.
SAND means Spam, Advertising, Necroposting, and Derailing.
Spam is when a irrelevant message is sent to many places. Wiki Article: Spam
Advertising is when you promote your studios and projects. Wiki Article: Advertising
Necroposting is when you post on a old topic. It distracts other helpers! Wiki Article: Necroposting
Derailing is when you post something that is irrelevant to the topic, like minimodding. It is called thread hijacking. Wiki Article: Derailing(Derailing idea comes from this guy),
in the process of leaving scratch.
bob has been hidden again :(

aust120YT
Scratcher
16 posts

If the player doesn’t have enough cookies (variable) how can I block it from not happening?

@nezon thank you so much! I can finally realse a big update for 2.0! Thank you big time I will add you in my credits!

Powered by DjangoBB