Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!
Offline
Operators are really useful in a few ways, but i'll list the easiest one here.
when gf clicked repeat until <(Bang) = [1]> play sound [Magic Wand v] end stop script
Offline
awesomedude214 wrote:
Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!
((3) + (2))If you click this it will say " 5"
Last edited by fetchydog567 (2013-01-27 10:17:16)
Offline
awesomedude214 wrote:
Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!
Well operators are what they seem like; some add, some subtract, some divide, and so on. If you ever want to use them, just fill out the 1~2 text boxes in it, then put it in a drop down menu, a round space of a block, in more operators, or in the booleans (=, >, <). So for example, here's a sample script using operators:
when gf clicked set [variable v] to (1) if <(((variable) + (2)) * (2)) < (9)> switch to costume ((variable) + (1)) end
Last edited by ErnieParke (2013-01-27 13:12:27)
Offline
They are actually very helpful in ute projects, fire example:
1. If any variable is equal, do whatever then you can use ' equal to' operator.
2. You can make a calculator using plus minus multiplication division mod, etc
3. They are also used in mathematical simulations
* There are many other things too, try them yourselves
Offline
what does the operators longest down do? like hello world and sqrt and <10 ?
([sqrt] by 10)
Last edited by kattenelvis (2013-04-21 12:35:40)
Offline
kattenelvis wrote:
what does the operators longest down do? like hello world and sqrt and <10 ?
([sqrt v] of 10)
Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:
(join [Hello] [ a pie!])
([sqrt v] of (9))
([10 ^ v] of (3))
Last edited by ErnieParke (2013-04-21 13:57:56)
Offline
ErnieParke wrote:
kattenelvis wrote:
what does the operators longest down do? like hello world and sqrt and <10 ?
([sqrt v] of 10)Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:
(join [Hello] [ a pie!])
Will give you "Hello a pie!"
As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:([sqrt v] of (9))
This will give you 3 because 3 times itself will give you 9.
Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:([10 ^ v] of (3))
This will give you 1,000 because that's what 10*10*10 is.
Well I hope that I hit all of them. Also, I hope that this helped!
With regards,
ErnieParke
what is it used for? and what does all the other ones meen?
Offline
kattenelvis wrote:
ErnieParke wrote:
kattenelvis wrote:
what does the operators longest down do? like hello world and sqrt and <10 ?
([sqrt v] of (10))Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:
(join [Hello] [ a pie!])
Will give you "Hello a pie!"
As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:([sqrt v] of (9))
This will give you 3 because 3 times itself will give you 9.
Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:([10 ^ v] of (3))
This will give you 1,000 because that's what 10*10*10 is.
Well I hope that I hit all of them. Also, I hope that this helped!
With regards,
ErnieParkewhat is it used for? and what does all the other ones meen?
Well, I'm not entirely sure what you mean by other ones, so could you say them?
As for the join block, that's used when you need to join text. For example, let's say that you want to ask the player for their name:
ask [What's your name?] and wait say (join (join [Hello ](answer))[!])
Offline
ErnieParke wrote:
kattenelvis wrote:
ErnieParke wrote:
Well the join operator (which I think i you're talking about) just joins whatever you put into the two boxes. For example, this:
(join [Hello] [ a pie!])
Will give you "Hello a pie!"
As for the sqrt operator, it's actually short for square root. It figures out what number, when multiplied by itself, will give you the number you entered. For example:([sqrt v] of (9))
This will give you 3 because 3 times itself will give you 9.
Finally, the 10^ operator multiples 10 as many times as you entered into the blank space. For example:([10 ^ v] of (3))
This will give you 1,000 because that's what 10*10*10 is.
Well I hope that I hit all of them. Also, I hope that this helped!
With regards,
ErnieParkewhat is it used for? and what does all the other ones meen?
Well, I'm not entirely sure what you mean by other ones, so could you say them?
As for the join block, that's used when you need to join text. For example, let's say that you want to ask the player for their name:ask [What's your name?] and wait say (join (join [Hello ](answer))[!])
The other operators are used mainly in math.
Well, I hope that that cleared some things up.
With regards,
ErnieParke
what i mean with the others is:
(10)mod(10) round (10) [abs] of (10) [sin] of (10) [cos] of (10) [tan] of (10) [asin] of (10)e.t.c
Last edited by kattenelvis (2013-04-23 12:50:57)
Offline
kattenelvis wrote:
ErnieParke wrote:
kattenelvis wrote:
what is it used for? and what does all the other ones meen?
Well, I'm not entirely sure what you mean by other ones, so could you say them?
As for the join block, that's used when you need to join text. For example, let's say that you want to ask the player for their name:ask [What's your name?] and wait say (join (join [Hello ](answer))[!])
The other operators are used mainly in math.
Well, I hope that that cleared some things up.
With regards,
ErnieParkewhat i mean with the others is:
(10)mod(10) round (10) [abs] of (10) [sin] of (10) [cos] of (10) [tan] of (10) [asin] of (10)e.t.c
Oh. That's quite a list.
Well, to start off, the mod block does a bit of a fancy operation. When you divide a number by another, it's not always going to go in a whole number of times. For example, 3 goes into 8 2 times. Or, 8/3 = 2, plus of course, a remainder of 2. This mod block gives you that remainder. It's mainly used in infinite-something projects, though there are other uses.
The round block basically rounds a number to the nearest number. So:
round (2.4) = 2
round (2.6) = 3
round (123.1) = 123
round (-2) = -2
It's used in various situation
Moving on. The abs (short for absolute) block basically does nothing to a number, other then make it positive. For example:
abs(-2) = 2
abs(3) = 3
Simple, right?
Finally, the sin(), cos(), and tan() are all functions used in trigonometry to find out information about a triangle, mainly side lengths. So, if you had 2 angles and a side, then you could find the length of the two other sides and the measure the size of the final angle.
As for the asin(), acos(), and atan(), they do the same thing as above, though they help with angles.
Well, that's about it! If you have any questions, which you probably will, just ask.
With regards,
ErnieParke
Offline
awesomedude214 wrote:
Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!
Operators do lots of things. They join things, such as this:
if <(score)> = [10]// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works broadcast [you win]If suppose you made a game making the sprite say your score, you need a operator.
say join [this is your] (score)//operators also enable a sprite to say something joined with a variable.Operators also join 2 things together.
when gf clicked move (10) steps if <touching sprite 2> or < touching sprite 3> // this gives the sprite 2 options. If touching this or that... hide//do this
when gf clicked move (10) steps if<touching sprite 2> and <touching sprite 3>// this tells the sprite to hide if it touches [b]both of those sprites[/b] hide Those are operators. They are very useful during programming.
Offline
joshuaho wrote:
awesomedude214 wrote:
Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!
Operators do lots of things. They join things, such as this:
if <(score) = [10]>// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works broadcast [you win v] endIf suppose you made a game making the sprite say your score, you need a operator.say (join [this is your] (score))//operators also enable a sprite to say something joined with a variable.Operators also join 2 things together.when gf clicked move (10) steps if <<touching [sprite 2 v]?> or <touching [sprite 3 v]?>> // this gives the sprite 2 options. If touching this or that... hide//do this endwhen gf clicked move (10) steps if <<touching [sprite 2 v]?> and <touching [sprite 3 v]?>>// this tells the sprite to hide if it touches [b]both of those sprites[/b] hide endThose are operators. They are very useful during programming.
I fixed your code. Mainly, you forgot <>'s in various places, and you forgot to cap of your if's with an "end"
With regards,
ErnieParke
Last edited by ErnieParke (2013-04-23 16:35:58)
Offline
ErnieParke wrote:
joshuaho wrote:
awesomedude214 wrote:
Hi Scratch. Ive seen people use operators in their projects but I dont know how to use them!! please reply!
Operators do lots of things. They join things, such as this:
if <(score) = [10]>// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works broadcast [you win v] endIf suppose you made a game making the sprite say your score, you need a operator.say (join [this is your] (score))//operators also enable a sprite to say something joined with a variable.Operators also join 2 things together.when gf clicked move (10) steps if <<touching [sprite 2 v]?> or <touching [sprite 3 v]?>> // this gives the sprite 2 options. If touching this or that... hide//do this endwhen gf clicked move (10) steps if <<touching [sprite 2 v]?> and <touching [sprite 3 v]?>>// this tells the sprite to hide if it touches [b]both of those sprites[/b] hide endThose are operators. They are very useful during programming.I fixed your code. Mainly, you forgot <>'s in various places, and you forgot to cap of your if's with an "end"
With regards,
ErnieParke
Thank you. I am not a expert on making scratchblocks, so that explains why I am not that good.
Offline
joshuaho wrote:
ErnieParke wrote:
joshuaho wrote:
Operators do lots of things. They join things, such as this:if <(score) = [10]>// the operator here enables you to add a variable. It says that if the score equals 10, then broadcast. That is how a operator works broadcast [you win v] endIf suppose you made a game making the sprite say your score, you need a operator.say (join [this is your] (score))//operators also enable a sprite to say something joined with a variable.Operators also join 2 things together.when gf clicked move (10) steps if <<touching [sprite 2 v]?> or <touching [sprite 3 v]?>> // this gives the sprite 2 options. If touching this or that... hide//do this endwhen gf clicked move (10) steps if <<touching [sprite 2 v]?> and <touching [sprite 3 v]?>>// this tells the sprite to hide if it touches [b]both of those sprites[/b] hide endThose are operators. They are very useful during programming.I fixed your code. Mainly, you forgot <>'s in various places, and you forgot to cap of your if's with an "end"
With regards,
ErnieParkeThank you. I am not a expert on making scratchblocks, so that explains why I am not that good.
Well, if you wait a bit more, you might just become an expert on scratchblocks. ;)
By the way, it was nothing.
With regards,
ErnieParke
Offline