Advanced coloured text function!

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

Advanced coloured text function!

Postby lcl » Wed Apr 06, 2011 7:03 pm

Hello!

I'm here now with my latest creation, function,
that lets you print text with many colours!



Here is the source code:
colouredText.zip
(29.28 KiB) Downloaded 710 times



There is six escape sequences:

/| - new line
/r - red
/g - green
/b - blue
/y - yellow
/w - white

They are usable like this:
Code: Select all
print("/gThis is just/| /rexample /gline.", 100, 100);

Using code like this, it would print following text to position 100, 100.
This is just
example line.


At create actor event of view, there is function startupDef(7, 12);
It sets the characters to be 7 pixels away from each other in x axis and 12 pixels away from
other lines in y axis.

The .zip contains versions with and without typewriting effect.
I made the one without it for those who don't know so much about scripting for the typewriting codes
not to confuse those people.

It's all based on cloning the text actor and setting the clones
r, g and b values.


If there is something in the code you don't understand, but you want,
don't hesitate to ask me! I would be glad to help people understand this.


Give me feedback about it. :)

-lcl -

colors.png
colors.png (1010 Bytes) Viewed 11897 times
Last edited by lcl on Fri Apr 08, 2011 9:17 am, edited 5 times in total.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Advanced coloured text function!

Postby schnellboot » Wed Apr 06, 2011 7:27 pm

Nice man!
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Advanced coloured text function!

Postby Camper1995 » Wed Apr 06, 2011 7:36 pm

Wow great! 8)
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Advanced coloured text function!

Postby lcl » Wed Apr 06, 2011 10:36 pm

Thanks guys! :)
I wish that will be useful for someone. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Advanced coloured text function!

Postby Bee-Ant » Mon Apr 25, 2011 8:21 am

Indeed nice !!!
And +1 for your hard work !!! :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Advanced coloured text function!

Postby lcl » Mon Apr 25, 2011 9:42 am

Bee-Ant wrote:Indeed nice !!!
And +1 for your hard work !!! :D

Thanks! :)
I realised that I have to make one update to this.
It doesn't currently seem so nice with normal fonts because the
distance between letters is always the same. I have to make it to change the position by the width of the letter. I hope someone understood that.. :lol:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Advanced coloured text function!

Postby Bee-Ant » Mon Apr 25, 2011 10:16 am

lcl wrote:I wish that will be useful for someone. :)

That would be me !!! :P

lcl wrote:I realised that I have to make one update to this.

You better would !!! :P

Hmmm, it seems that you would be the pyrometal replacement to me.
He offered such great helps back then :)
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Advanced coloured text function!

Postby lcl » Mon Apr 25, 2011 11:23 am

Bee-Ant wrote:
lcl wrote:I wish that will be useful for someone.

That would be me !!! :P

lcl wrote:I realised that I have to make one update to this.

You better would !!! :P

Hmmm, it seems that you would be the pyrometal replacement to me.
He offered such great helps back then :)

I'm glad you may find it useful!
Wow, to be compared to pyrometal is really great honor for me! :)
I will work with that update as soon as possible! :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Advanced coloured text function!

Postby lcl » Tue Apr 26, 2011 4:41 pm

That update seems to be quite difficult to make because it seems
like GE doesn't get text actors width and height right.. :P
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Advanced coloured text function!

Postby Bee-Ant » Tue Apr 26, 2011 6:35 pm

It's not the GE, but the font.
I prefer fixed width font anyway :)
It's easier to manage and estimate.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Advanced coloured text function!

Postby lcl » Tue Apr 26, 2011 7:03 pm

Bee-Ant wrote:It's not the GE, but the font.
I prefer fixed width font anyway :)
It's easier to manage and estimate.

I like those fonts too, they are easier to work with.
But I think Ge really doesn't get the width and height right because I
tried to make the code set the characters (every of them is a clone) positions
according to the previous ones position and width and the current ones width.
It worked with some characters, but not with some other ones. :P
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Advanced coloured text function!

Postby Hblade » Thu Apr 28, 2011 7:55 pm

Amazing!!! :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Advanced coloured text function!

Postby lcl » Thu Apr 28, 2011 7:56 pm

Hblade wrote:Amazing!!! :)

Thanks! :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest

cron