The Daily Click ::. Forums ::. Klik Coding Help ::. Counters
 

Post Reply  Post Oekaki 
 

Posted By Message

Gregorian Chan



Registered
  12/05/2006
Points
  7
12th May, 2006 at 06:41:51 -

Hey Everyone. I am needing 2 questions answered regarding counters
First off i will say I want one counter to display a random number between 0 and 999999 which is easy enough.
But when the number is displayed if it is below 100000 it displays the numbers like this, eg: 2340 11223 etc.
Is there any way i can get the counter to still display the whole 6 digits but have a zero at the front if required using the examples again 002340 and 011223.

Secondly I want 5 other counters to display info feeding off the 6 digit counter.
For example If the 6 digit counter randomly reads 658092 How would I go about getting the first of the 5 counters (A) to disply the first 2 digits of the counter in this case - (65), then the second counter (B) to diplay (5, (C) = (80), (D) = 09) and finally (E) = 92.

Hope ppl understand
Any help here would be GRREATTLY APPRECIATED - Thanx - Greg

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
12th May, 2006 at 07:44:00 -

The zero-part is not possible using counters, but you can use a string for it. It's easy to do in mmf, im not really sure how to do it in tgf though.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
12th May, 2006 at 08:13:05 -

Yup, using a string would probably the only way (at least, the only way I know of).

Add a string, set put Str$(score) into it, then check the length of the string, and add a few zeros before it.

 
Old member (~2004-2007).

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
12th May, 2006 at 08:51:58 -

Either that or uncheck "Display as background" for the counter and put in a couple of background objects that look like the counter's zeroes in front of it (this only works on things like LED-like displays where the entire background of the counter is opaque and the digits are of a fixed width).

The String method (or Text Object if you're using TGF) is a much easier way to go, and also allows you to use Mid$() to get the individual values out.

 
http://www.davidn.co.nr - Games, music, living in America

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
12th May, 2006 at 11:37:05 -

The way I do it is to create an active object that displays the digits 0-9 in animation directions 0-9. Then I have a 'real value' counter, and have an Always event that sets each clone of the active to a direction equal to the value of the digit in that place in the number (using the mod function). Works great.

 
n/a

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
12th May, 2006 at 17:09:28 -

I was gonna say divide by 1000000.0 but the other 0's go away.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Werbad



Registered
  18/09/2002
Points
  235
12th May, 2006 at 18:55:38 -

Why use 6 actives when you can use one string?

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
13th May, 2006 at 06:50:01 -

Something called Bring to front.

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
13th May, 2006 at 12:18:31 -

use Layer Object?

Image Edited by the Author.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click