Discuss Scratch
- Discussion Forums
- » Suggestions
- » More than one if for if then else
- appdeveloper51251
-
2 posts
More than one if for if then else
Currently, the scratch block for if then else looks like this:
https://pasteboard.co/GPIsmcW.png
^^ what block could look like
And you could add more “if then”'s.
Excuse my terrible editing, and any unorthodox things I've said in my post, this is my first time on the forum
If you still don't understand, then basically I have a game with ranks and a box. You click the box for money and get ranks with money, which ranks up the box and gives you more money. I have a sprite for each rank which you click on to upgrade. That sets the variable for the rank to 1 (1 being true, 0 being false). I click the sprite and it changes the variable by 1. On the sprite for the box, the code says “if <variable = 1” then do this, else do this. I can do that, but I have multiple “rank” sprites and I can't code that properly, or at least to my knowledge. If there is a way to do this already, forgive me, I'm new to this. It would be nice to have a quick response, I have a deadline for this project in about a week.
Cheers,
appdeveloper51251 (Darren/Victor, we share an account for school)
How about a block that lets you have multiple ifs but 1 else? For example, if there are “ranks” in a game you can purchase, (1 sprite for each rank which you click on to purchase), then you have a main sprite (a box which you ranked up), then the block would have multiple selections for if.
https://pasteboard.co/GPIsmcW.png
^^ what block could look like
And you could add more “if then”'s.
Excuse my terrible editing, and any unorthodox things I've said in my post, this is my first time on the forum

If you still don't understand, then basically I have a game with ranks and a box. You click the box for money and get ranks with money, which ranks up the box and gives you more money. I have a sprite for each rank which you click on to upgrade. That sets the variable for the rank to 1 (1 being true, 0 being false). I click the sprite and it changes the variable by 1. On the sprite for the box, the code says “if <variable = 1” then do this, else do this. I can do that, but I have multiple “rank” sprites and I can't code that properly, or at least to my knowledge. If there is a way to do this already, forgive me, I'm new to this. It would be nice to have a quick response, I have a deadline for this project in about a week.
Cheers,
appdeveloper51251 (Darren/Victor, we share an account for school)
Last edited by appdeveloper51251 (Oct. 19, 2017 22:57:51)
- DaEpikDude
-
1000+ posts
More than one if for if then else
Rank?
Purchase?
What??
Wouldn't it be easier to just “extend” it if you right click?
Also you can use scratchblocks, like so:
Purchase?
What??
Wouldn't it be easier to just “extend” it if you right click?
Also you can use scratchblocks, like so:
Looks much better.
- -ShadowOfTheFuture-
-
1000+ posts
More than one if for if then else
No support. The workaround is really simple.
- FUTSync
-
100+ posts
More than one if for if then else
If i'm understanding you correctly, why cant you just repeat the if/else block? and in every else block, do the thing you wanted?
- DaEpikDude
-
1000+ posts
More than one if for if then else
Because that's different to what an else if is. If i'm understanding you correctly, why cant you just repeat the if/else block? and in every else block, do the thing you wanted?
If thing1 is true, it does the first statement, and then the else of the second.
If thing2 is true, it does the else of the first and then the second.
If the second if else was in the first it'd work, but that doesn't work.
- appdeveloper51251
-
2 posts
More than one if for if then else
Sorry for the useless thread then, thank you for the workaround!
- FUTSync
-
100+ posts
More than one if for if then else
Because that's different to what an else if is. If i'm understanding you correctly, why cant you just repeat the if/else block? and in every else block, do the thing you wanted?
If thing1 is true, it does the first statement, and then the else of the second.
If thing2 is true, it does the else of the first and then the second.
If the second if else was in the first it'd work, but that doesn't work.
- Charles12310
-
1000+ posts
More than one if for if then else
Please explain: No support. The workaround is really simple.
You can see now that in this instance, it doesn't seem to be easy anymore. You have to drag one block, and another, and another, and another…
Also, it takes up too much space causing more scrolling to see other scripts, which can get worse if the scripts inside them were big.
You can see here that it looks much more organized, and much more shorter than the other. I doubt this would be easy if the user had to make a lot of ifs and elses.
I'm supporting for this reason.
- FUTSync
-
100+ posts
More than one if for if then else
Just because you have to ‘drag and drop’ a lot of times & that its ‘more organised’ doesn't mean it should be implemented.Please explain: No support. The workaround is really simple.
You can see now that in this instance, it doesn't seem to be easy anymore. You have to drag one block, and another, and another, and another…
Also, it takes up too much space causing more scrolling to see other scripts, which can get worse if the scripts inside them were big.You can see here that it looks much more organized, and much more shorter than the other. I doubt this would be easy if the user had to make a lot of ifs and elses.
I'm supporting for this reason
(snipped to shorten quote).
This block would rarely be used, and very rarely that many times, the work around is extremely simple.
many blocks on scratch can end up looking messy because of extended use of blocks, that doesnt mean their should be a simplified option.
Last edited by FUTSync (Oct. 21, 2017 01:19:03)
- Charles12310
-
1000+ posts
More than one if for if then else
Ridiculous. Even my projects use so many ifs and elses. You don't care if someone has to suffer having to do all of that stuff? I told you, it saves time and energy. What do you mean, “rarely used”? The if and else block is an important block, and I've seen projects use a lot of ifs and elses. If you don't care about organised code, you will realize how much more time it takes, if you don't organise your code. Do you even care if people will lose energy and if they waste time? This is supposed to be about why an if block with multiple else blocks is useful. My opinion is my opinion. I think it's useful in case you have a lot of ifs and elses, and so it organises your scripts so that you can get the job done and only a bit of energy is wasted.Just because you have to ‘drag and drop’ a lot of times & that its ‘more organised’ doesn't mean it should be implemented.Please explain: No support. The workaround is really simple.
You can see now that in this instance, it doesn't seem to be easy anymore. You have to drag one block, and another, and another, and another…
Also, it takes up too much space causing more scrolling to see other scripts, which can get worse if the scripts inside them were big.You can see here that it looks much more organized, and much more shorter than the other. I doubt this would be easy if the user had to make a lot of ifs and elses.
I'm supporting for this reason
(snipped to shorten quote).
This block would rarely be used, and very rarely that many times, the work around is extremely simple.
many blocks on scratch can end up looking messy because of extended use of blocks, that doesnt mean their should be a simplified option.
- DaEpikDude
-
1000+ posts
More than one if for if then else
Hey, uh, literally every other programming language would like to have a word with you. Just because you have to ‘drag and drop’ a lot of times & that its ‘more organised’ doesn't mean it should be implemented.
if (so and so) {
...
} else if (so and so) {
...
} else if (so and so) {
...
} else if (so and so) {
...
} else {
...
}
- anslovera27
-
1 post
More than one if for if then else
I need to know if you can put multiple items in the diamond shaped block when you do, “if llllllll then…”
Where the l's are, I need to know if you can put multiple things in there.
Where the l's are, I need to know if you can put multiple things in there.
- Maarten_
-
100+ posts
More than one if for if then else
You can, try using the following operators for that: I need to know if you can put multiple items in the diamond shaped block when you do, “if llllllll then…”
Where the l's are, I need to know if you can put multiple things in there.
An “and” operator is used if both values are true
An “or” operator is used if at least one value is true
- Harakou
-
1000+ posts
More than one if for if then else
I initially deleted a post suggesting that we merge this into this thread because I planned to do so, though on second look I could see some of the specific details of that thread possibly being more complex than the ones here, so I'm going to opt to leave these separate for now. Sorry about that!
- Paddle2See
-
1000+ posts
More than one if for if then else
It looks like this is a duplicate topic of this one over here so I'll close it to keep the conversation all in one place.
Please use the existing topic in the link above.
Please use the existing topic in the link above.
- Discussion Forums
- » Suggestions
-
» More than one if for if then else