This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-04-12 18:05:00

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Scratch Formulas

On this topic you may post the formulas may use in scratch to calculate formulas. I have two examples that are sure to work.

Is it Bumpy is it Round?

Using this formula you can tell if a number has a fraction in it, or if it doesnt:
if <(variable)=round (variable)>

Pretty simple but some people may have not known.

The Opposite Number

With four variables (the min, max, original number, and the new number), you can find the opposite. Lets say the min is 0, and the max is 100. With this 50 would be 50, 25 would be 75,10 would be 90, and 100 would be 0.Here it is, and remember it doesn't matter if it is negative or not with any of the variables:

Set new number to ( (-1 * original number) + (min + max) )

If you don't get the pattern look at it like this:
There is a number line.

<------------------------------------------------------->
0                                  50                                  100

Now you put a dot on it in a random place like 35 for example.

<-----------------o------------------------------------>
0                                  50                                  100

Now flip the number line.

<-----------------o------------------------------------>
100                              50                                    0

And now based on the numbers its about 65. You could also do -40 be the min, and 50 being the max and do that. So 5 would be 5, 30 would be -20 and ext.

Hope this helps (and gets stickied, but how does a topic get stickied?????).


http://i.imgur.com/WBkM2QQ.png

Offline

 

#2 2008-04-13 13:25:29

thecooltodd
Scratcher
Registered: 2008-03-08
Posts: 75

Re: Scratch Formulas

A topic gets sticked when a moderator stickes it (at least I'm assuming that).

Offline

 

#3 2008-04-13 14:46:38

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Scratch Formulas

thecooltodd wrote:

A topic gets sticked when a moderator stickes it (at least I'm assuming that).

Oh, well that sounds reasonable.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#4 2008-05-04 11:37:14

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Scratch Formulas

Ok, I have a new formula. It might help.

Fraction to Percentage

So you have the numberater and the denomonator. Here is the formula:

/                                                                          \
| (100 divided by denomonator) x numerator |
\                                                                          /

And how would this be used you ask? Well in a game it keeps track of your wins and loses. You want to find the win percentage. So you would do this:

/                                                                               \
|  /                                                         \                 |
|  | 100 divided by ( Wins + Loses ) |   x Wins |
|  \                                                         /                 |
\                                                                               /

Easy huh? Thanks.

Last edited by Lucario621 (2008-05-04 11:39:20)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#5 2008-05-09 23:58:14

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Scratch Formulas

I have one. Custom Score, health, etc display

Ones digit is easy. Just do this:

[blocks]<when green flag clicked>[/blocks]
[blocks]<forever>[/blocks]
[blocks]<switch to costume[ <{ health }>[/blocks]

This is for the tens, hundreds, thousands, etc digits. Just replace the ten with a different power of ten:

[blocks]<when green flag clicked>[/blocks]
[blocks]<forever>[/blocks]
[blocks]<switch to costume[(( ((<{ health }>  </>10  )) <-> .5 ))[/blocks]

Last edited by Bluestribute (2008-05-09 23:58:36)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

Board footer