Format Control Strings in GE textNumber function??

You must understand the Game Editor concepts, before post here.

Format Control Strings in GE textNumber function??

Postby Just4Fun » Wed Jun 07, 2006 5:14 pm

I am not sure if this is the correct place to post this question. It isn't very advanced, but it is 'C' related. Here goes:

------------> 1. I have two actors: num1 & num2.
------------> 2. Each actor generates a random number between 1 and 100.

------------> Problem: I would like to have the numbers display using right justification.

So... the console display for the two actors would look something ike this:

-------------->33
------------> 100

As it stands now, I get a left justification (GE default?)

------------> 33
------------> 100

This is such a simple thing to do in 'C' with printf. Any ideas? Can this be accomplished in GE?

Image
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Wed Jun 07, 2006 9:23 pm

Just use the sprintf function. If you want display the variable count, try this:

Code: Select all
sprintf(text, "%5d", count);


The result will be:
Code: Select all
    1
   10
  100
 1000
10000
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Just4Fun » Wed Jun 07, 2006 9:52 pm

100,000 thanks Makslane.

It worked! Image
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest