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

#1 2013-01-05 15:25:41

chrisbown
Scratcher
Registered: 2011-07-29
Posts: 100+

how would this formula work in operators scripts?

the formula is : ((2xLevel+10)/250*attack/defense*Base power+2)*critical hit* charge*0.85-1.00.

Last edited by chrisbown (2013-01-05 15:26:01)


check out this: Tank physicshttp://scratch.mit.edu/projects/hamstercake11/3082288

Offline

 

#2 2013-01-05 15:52:50

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: how would this formula work in operators scripts?

I'm not 100% sure of your order of operations, but going by PEMDAS I'd say it should look like this:
http://i49.tinypic.com/346475l.gif

Last edited by Kileymeister (2013-01-05 15:54:49)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2013-01-05 15:59:26

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: how would this formula work in operators scripts?

Wowzers, that's a long equation!  tongue 


When I am making a long equation like that in Scratch, I usually first put in extra parenthesis that will remind me of the order:

( ( ( ( ((2xLevel+10)/(250*attack)) /((defense*Base power)+2) )*critical hit) * charge) *0.85)-1.00

Then I very carefully put the script together. Usually I would start from the outside parenthesis and go in, so I would start with a

(() - (1.0))
block and then go to
((() * (0.85)) - (1.0))
and add stuff to make it more complicated from there. When I get to a "hole" that should just have a number or variable in it (instead of another block), I fill it in so I don't get lost.

Good luck with your project!  smile

Last edited by scmb1 (2013-01-05 16:00:29)


http://i48.tinypic.com/2z5pqad.png

Offline

 

#4 2013-01-05 16:27:31

chrisbown
Scratcher
Registered: 2011-07-29
Posts: 100+

Re: how would this formula work in operators scripts?

Problem solved:)


check out this: Tank physicshttp://scratch.mit.edu/projects/hamstercake11/3082288

Offline

 

#5 2013-01-05 18:21:16

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: how would this formula work in operators scripts?

Closed by request of the topic owner.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer