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

#1 2012-03-20 18:22:23

k9lego
Scratcher
Registered: 2011-09-29
Posts: 59

Math I need for my script. please help!

if you input [2], how do you make it turn into 50% when you click a button?


Hey, I make cool games! WHY NO CLOUD DATA?!?!?!?!!!!!!!! Copy this
Click Here! Stats: http://blocks.scratchr.org/API.php?user=k9lego&action=onlineStatus

Offline

 

#2 2012-03-20 18:36:15

k9lego
Scratcher
Registered: 2011-09-29
Posts: 59

Re: Math I need for my script. please help!

I would like a reply...


Hey, I make cool games! WHY NO CLOUD DATA?!?!?!?!!!!!!!! Copy this
Click Here! Stats: http://blocks.scratchr.org/API.php?user=k9lego&action=onlineStatus

Offline

 

#3 2012-03-20 18:38:59

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Math I need for my script. please help!

I'm assuming you are getting your input from an answer?

Simply divide it by 2.

You could even store it in a variable, so that it is visible.

when gf clicked
ask [Please enter an input number] and wait
set [input number v] to (answer)
set [answer v] to ((answer)/[2])
say (answer)

Last edited by jji7skyline (2012-03-20 18:39:37)


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#4 2012-03-20 18:48:40

k9lego
Scratcher
Registered: 2011-09-29
Posts: 59

Re: Math I need for my script. please help!

when gf clicked
set [everything] to (0)
ask [Please input a number]
set [click # times] to ((answer))
set [points for click] to ( [ (( click # times </> 2 )) ] )
(I type 4)
I get 2 points every answer...

Last edited by k9lego (2012-03-20 18:49:08)


Hey, I make cool games! WHY NO CLOUD DATA?!?!?!?!!!!!!!! Copy this
Click Here! Stats: http://blocks.scratchr.org/API.php?user=k9lego&amp;action=onlineStatus

Offline

 

#5 2012-03-20 18:52:05

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Math I need for my script. please help!

k9lego wrote:

when gf clicked
set [everything] to (0)
ask [Please input a number]
set [click # times] to ((answer))
set [points for click] to ( [ (( click # times </> 2 )) ] )
(I type 4)
I get 2 points every answer...

So you want a variable to be halved every time you click a button?

Ok then.

when [sprite1] clicked
set [variable v] to ((variable)/(2))

Last edited by jji7skyline (2012-03-20 18:52:51)


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#6 2012-03-20 18:57:47

k9lego
Scratcher
Registered: 2011-09-29
Posts: 59

Re: Math I need for my script. please help!

jji7skyline wrote:

k9lego wrote:

when gf clicked
set [everything] to (0)
ask [Please input a number]
set [click # times] to ((answer))
set [points for click] to ( [ (( click # times </> 2 )) ] )
(I type 4)
I get 2 points every answer...

So you want a variable to be halved every time you click a button?

Ok then.

when [sprite1] clicked
set [variable v] to ((variable)/(2))

I'm just asking how you get (number) to 100.
(example: I type 4, 4 = 25.)


Hey, I make cool games! WHY NO CLOUD DATA?!?!?!?!!!!!!!! Copy this
Click Here! Stats: http://blocks.scratchr.org/API.php?user=k9lego&amp;action=onlineStatus

Offline

 

#7 2012-03-20 19:03:50

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Math I need for my script. please help!

You want percentages?  (2 = 50, 3 = 33.33, 4 = 25, 5 = 20, etc.)

((100) / (input))

Offline

 

#8 2012-03-20 19:15:20

k9lego
Scratcher
Registered: 2011-09-29
Posts: 59

Re: Math I need for my script. please help!

THANK YOU! k9lego


Hey, I make cool games! WHY NO CLOUD DATA?!?!?!?!!!!!!!! Copy this
Click Here! Stats: http://blocks.scratchr.org/API.php?user=k9lego&amp;action=onlineStatus

Offline

 

Board footer