Discuss Scratch

Obsercxium
Scratcher
8 posts

(number) + (number) = 13 or higher

Hi, I'm kinda new to Scratch and I was building a project for Dungeons and Dragons. For the project, you were supposed to cast a protection spell by rolling 2 die to get 13 or higher. Here's the screenshot because I'm not that good at making forum posts.

when green flag clicked
say [hi, i'm obs.] for (lifespan) secs
go to [nowhere]

origins.
Uniquename1
Scratcher
100+ posts

(number) + (number) = 13 or higher

It doesn’t look like you receive the broadcast 10 sides die or ever send the broadcasts fireball equal or continue text and the first question is only asked at the beginning of the game. It should probably ask whenever you shoot a fireball. The 2 questions can just be asked in one script one after the other then it can calculate the answer in the same script too. You also could just not ask them to roll dice and have dice rolls happen automatically without the player even knowing about them. As such too you could just roll one 30 sided die but maybe you want the d and d feel. In which case have them all in one script and to be greater than or equal to 13 just have it be greater than 12 which naturally includes 13.

Try my games.
Scratch Sprite Club VI Soccer
Star Fighter Shooting
Space Marines: Boarding Party Strategy
Lion Runner Running/ Platformer
Obsercxium
Scratcher
8 posts

(number) + (number) = 13 or higher

Uniquename1 wrote:

It doesn’t look like you receive the broadcast 10 sides die or ever send the broadcasts fireball equal or continue text and the first question is only asked at the beginning of the game. It should probably ask whenever you shoot a fireball. The 2 questions can just be asked in one script one after the other then it can calculate the answer in the same script too. You also could just not ask them to roll dice and have dice rolls happen automatically without the player even knowing about them. As such too you could just roll one 30 sided die but maybe you want the d and d feel. In which case have them all in one script and to be greater than or equal to 13 just have it be greater than 12 which naturally includes 13.
Thank you so much!

when green flag clicked
say [hi, i'm obs.] for (lifespan) secs
go to [nowhere]

origins.
Obsercxium
Scratcher
8 posts

(number) + (number) = 13 or higher

I actually have one other question. Is there a block for (number) or higher?

when green flag clicked
say [hi, i'm obs.] for (lifespan) secs
go to [nowhere]

origins.
deck26
Scratcher
1000+ posts

(number) + (number) = 13 or higher

If you have integer values then x > 9 tells you it is 10 or more. Is that what you mean?
Th3DiamondMin3craft
Scratcher
100+ posts

(number) + (number) = 13 or higher

Obsercxium wrote:

I actually have one other question. Is there a block for (number) or higher?

Not really, but there is a workaround:

<<[] = [13]> or <[] > [13]>>





((((((((((((drained infinity :: grey) :: grey) :: grey) :: grey) :: grey) :: grey) :: grey) :: grey) :: grey) :: grey) :: grey) :: grey)

deck26
Scratcher
1000+ posts

(number) + (number) = 13 or higher

or
<not <[] < [13]>>
Obsercxium
Scratcher
8 posts

(number) + (number) = 13 or higher

Doesn't work.

when green flag clicked
say [hi, i'm obs.] for (lifespan) secs
go to [nowhere]

origins.
deck26
Scratcher
1000+ posts

(number) + (number) = 13 or higher

That's not how to use the blocks you've been given. You have a sum which you want to compare with a value. So

<<(sum) = [13]> or <(sum) > [13]>>
NOT
<(sum) = <<[] =  [13]> or <[] > [13]>>>
which doesn't make sense. The second half of that returns false (blank or 0 is not =13 or > 13) which is converted to 0 if you treat it as a value. So what you're checking for is sum=0.
Obsercxium
Scratcher
8 posts

(number) + (number) = 13 or higher

deck26 wrote:

That's not how to use the blocks you've been given. You have a sum which you want to compare with a value. So

<<(sum) = [13]> or <(sum) > [13]>>
NOT
<(sum) = <<[] =  [13]> or <[] > [13]>>>
which doesn't make sense. The second half of that returns false (blank or 0 is not =13 or > 13) which is converted to 0 if you treat it as a value. So what you're checking for is sum=0.
Oh my god, thank you so much!

when green flag clicked
say [hi, i'm obs.] for (lifespan) secs
go to [nowhere]

origins.

Powered by DjangoBB