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

#1 2012-01-29 10:40:30

ChunkyMonkeyGames
New Scratcher
Registered: 2012-01-28
Posts: 28

Stamping Score?

I would like a script to be able to stamp my score variable as I've seen in some other projects so I don't have to use the orange box. Thanks!

Offline

 

#2 2012-01-29 10:51:44

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Stamping Score?

You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0

(the tens is where the tens, e.g. 10 is 1 ten, go)

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the tens) y: (y position of the tens)
if <(length of (score)) > [1]>
  switch to costume (letter (1) of (score))
  stamp
  move (spacing between tens and units) steps
  switch to costume (letter (2) of (score))
else
  switch to costume (letter (1) of (score))
end
stamp

Last edited by rdococ (2012-01-29 10:54:10)

Offline

 

#3 2012-01-29 10:53:40

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: Stamping Score?

Try this.
Or search scratch resources for something similar

Last edited by hello12345678910 (2012-01-29 10:54:40)


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#4 2012-01-29 11:14:38

ChunkyMonkeyGames
New Scratcher
Registered: 2012-01-28
Posts: 28

Re: Stamping Score?

rdococ wrote:

You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0

(the tens is where the tens, e.g. 10 is 1 ten, go)

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the tens) y: (y position of the tens)
if <(length of (score)) > [1]>
  switch to costume (letter (1) of (score))
  stamp
  move (spacing between tens and units) steps
  switch to costume (letter (2) of (score))
else
  switch to costume (letter (1) of (score))
end
stamp

That only works for up to 2 digits  sad

Offline

 

#5 2012-01-29 11:19:10

ChunkyMonkeyGames
New Scratcher
Registered: 2012-01-28
Posts: 28

Re: Stamping Score?

hello12345678910 wrote:

Try this.
Or search scratch resources for something similar

Thanks, but not the technique I'm looking for. I find it unnecessary to make a sprite for each digit of the score.

Offline

 

#6 2012-01-29 12:00:45

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Stamping Score?

My project Unpredictable! uses the "stamping" method. You can download it to check out the scripts. It basically revolves around changing the x position, switching to a costume, and stamping.

Last edited by RedRocker227 (2012-01-29 12:01:03)


Why

Offline

 

#7 2012-01-29 14:15:30

ChunkyMonkeyGames
New Scratcher
Registered: 2012-01-28
Posts: 28

Re: Stamping Score?

Thanks, but I'd like a script that can do that with a score that always changes.

Offline

 

#8 2012-01-29 15:38:19

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Stamping Score?

Just put it in a "forever" block  wink


Why

Offline

 

#9 2012-01-29 16:16:09

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Stamping Score?

My project, text drawing with only 1 costume can draw text and numbers with only one costume.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#10 2012-01-29 17:15:34

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Stamping Score?

Hi, 1 sprite version that I posted a while ago here: Score Sprite

Hopefully the scripts can help you.

It does use a few variables and you may be able to cut one out if you think about it - not sure; haven't checked it in a while.


http://i50.tinypic.com/ded8m.png

Offline

 

#11 2012-01-29 21:36:54

ChunkyMonkeyGames
New Scratcher
Registered: 2012-01-28
Posts: 28

Re: Stamping Score?

Smozzick wrote:

Hi, 1 sprite version that I posted a while ago here: Score Sprite

Hopefully the scripts can help you.

It does use a few variables and you may be able to cut one out if you think about it - not sure; haven't checked it in a while.

Exactly what I was looking for, thanks!

Offline

 

#12 2012-01-30 05:30:17

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Stamping Score?

Before scripting:
Set to don't rotate.

when gf clicked
point in direction (90)
go to x:(starting x) y:(starting y)
set [currentone] to (0)
forever
repeat (length of text)
switch to costume (join [number](next change))
stamp
move (amnt2move) steps
set [currentone] to ((currentone)+(1))
set [next change] to (letter (currentone) of [score])
end
end
Extension of rdococ's script.

Last edited by bbbeb (2012-01-30 05:37:42)


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#13 2012-01-30 12:37:55

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Stamping Score?

ChunkyMonkeyGames wrote:

rdococ wrote:

You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0

(the tens is where the tens, e.g. 10 is 1 ten, go)

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the tens) y: (y position of the tens)
if <(length of (score)) > [1]>
  switch to costume (letter (1) of (score))
  stamp
  move (spacing between tens and units) steps
  switch to costume (letter (2) of (score))
else
  switch to costume (letter (1) of (score))
end
stamp

That only works for up to 2 digits  sad

I see.

Let me try to make something that works for any digit.

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the first number) y: (y position of the total number)
set [iteration v] to [1]
repeat (length of (score))
switch to costume (letter (iteration) of (score))
stamp
change x by (spacing inbetween all numbers)
change [iteration v] by (1)
end
Notice the repeat block makes it able to display an unlimited amount of digits or atleast up to where it reaches the edge.

Last edited by rdococ (2012-01-30 12:46:16)

Offline

 

#14 2012-01-30 17:48:34

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Stamping Score?

So rdococ you pretty much did the same thing I did except with a little optimization?


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#15 2012-01-30 19:24:44

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Stamping Score?

ChunkyMonkeyGames wrote:

Exactly what I was looking for, thanks!

No problem, hope it helps. Feel free to ask any questions you have on that project - I probably wouldn't remember to check here if you had any.


http://i50.tinypic.com/ded8m.png

Offline

 

#16 2012-01-30 20:30:06

puppetadventurer
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Stamping Score?

Even though I think you have what you're looking for you could use this (which I made last year)


3

Offline

 

#17 2012-01-31 06:22:20

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Stamping Score?

bbbeb wrote:

So rdococ you pretty much did the same thing I did except with a little optimization?

Looks like it, costumes work with costume numbers too, and there is only one variable instead of two.

And, if it is a non-existent costume (e.g. switch to costume (0) when there's 1, 2, 3, and 4 costume numbers) it rolls back to the opposite and continues on.

So with 1,2,3,4,5,6,7,8,9,10 costume numbers in my script, "0" means costume "10", which visually looks like a "0", so with my script it uses costume numbers, not names.

----------------------

Lol, many of my posts on these topics are in a sticky

Last edited by rdococ (2012-01-31 06:23:51)

Offline

 

#18 2012-02-07 11:11:38

jedidiahzhu
Scratcher
Registered: 2011-01-16
Posts: 85

Re: Stamping Score?

rdococ wrote:

ChunkyMonkeyGames wrote:

rdococ wrote:

You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0

(the tens is where the tens, e.g. 10 is 1 ten, go)

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the tens) y: (y position of the tens)
if <(length of (score)) > [1]>
  switch to costume (letter (1) of (score))
  stamp
  move (spacing between tens and units) steps
  switch to costume (letter (2) of (score))
else
  switch to costume (letter (1) of (score))
end
stamp

That only works for up to 2 digits  sad

I see.

Let me try to make something that works for any digit.

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the first number) y: (y position of the total number)
set [iteration v] to [1]
repeat (length of (score))
switch to costume (letter (iteration) of (score))
stamp
change x by (spacing inbetween all numbers)
change [iteration v] by (1)
end
Notice the repeat block makes it able to display an unlimited amount of digits or atleast up to where it reaches the edge.

I tried this on Scratch in one of the games I'm making, and I think that it would be better without the "clear" block; it makes the numbers flicker. Instead, this script worked fine in my game:

when gf clicked
clear
forever // Forever stamping the values
goto x: (x position of the first number) y: (y position of the total number)
set [iteration v] to [1]
repeat (length of (score))
switch to costume (letter (iteration) of (score))
stamp
change x by (spacing inbetween all numbers)
change [iteration v] by (1)
end

Offline

 

#19 2012-02-07 11:36:57

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Stamping Score?

jedidiahzhu wrote:

rdococ wrote:

ChunkyMonkeyGames wrote:


That only works for up to 2 digits  sad

I see.

Let me try to make something that works for any digit.

when gf clicked
forever // Forever stamping the values
clear
goto x: (x position of the first number) y: (y position of the total number)
set [iteration v] to [1]
repeat (length of (score))
switch to costume (letter (iteration) of (score))
stamp
change x by (spacing inbetween all numbers)
change [iteration v] by (1)
end
Notice the repeat block makes it able to display an unlimited amount of digits or atleast up to where it reaches the edge.

I tried this on Scratch in one of the games I'm making, and I think that it would be better without the "clear" block; it makes the numbers flicker. Instead, this script worked fine in my game:

when gf clicked
clear
forever // Forever stamping the values
goto x: (x position of the first number) y: (y position of the total number)
set [iteration v] to [1]
repeat (length of (score))
switch to costume (letter (iteration) of (score))
stamp
change x by (spacing inbetween all numbers)
change [iteration v] by (1)
end

Then you get shadows of the previous numbers... What I did was make another costume, the color of the background, and have it stamp, then the number.

Offline

 

#20 2012-02-10 02:18:01

jedidiahzhu
Scratcher
Registered: 2011-01-16
Posts: 85

Re: Stamping Score?

Yeah, when I added it in I noticed that. So in solution I added:

when i recieve [change v]
clear


Explanation:

The number I stamp is the GOLD amount in the game. So whenever someone buys something (in other words, the GOLD amount changes), the script broadcasts change.

Offline

 

#21 2012-04-01 19:03:21

theann16
Scratcher
Registered: 2011-12-27
Posts: 4

Re: Stamping Score?

This is helpful!!

Offline

 

#22 2012-04-02 14:16:07

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Stamping Score?

This is another example of what you can use to stamp the score.  smile

Offline

 

#23 2012-06-15 02:38:49

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: Stamping Score?

rdococ wrote:

You need 10 costumes:
- number1: the number 1
- number2
- number3
etc. up to number 9 and then add costume
- number0

(the tens is where the tens, e.g. 10 is 1 ten, go)

when gf clicked
forever // Forever stamping the values
clear
set [temporary value v] to (score)
goto x: (x position of the tens) y: (y position of the tens)
if <(length of (score)) > [1]>
  switch to costume (letter (1) of (score))
  stamp
  move (spacing between tens and units) steps
  switch to costume (letter (2) of (score))
else
  switch to costume (letter (1) of (score))
end
stamp
wait until <not <(score) = (temporary value)>>

This way reduces lag in huge games, and reduces the possibility of the score flashing while a player is interacting with your project (:


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#24 2012-06-15 09:16:16

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: Stamping Score?

You could also just change the variable color if you don't like orange!  tongue


Why are the secret organizations getting all the attention?  mad

Offline

 

#25 2012-06-23 16:35:09

CrazyTrain89
New Scratcher
Registered: 2012-06-23
Posts: 1

Re: Stamping Score?

ChunkyMonkeyGames wrote:

I would like a script to be able to stamp my score variable as I've seen in some other projects so I don't have to use the orange box. Thanks!

You just have a sprite or a few that have costumes with numbers 0-9

Offline

 

Board footer