MODULE: Sprite fonts v1.20 : multi-coloured text!

Started by SSH, Thu 08/12/2005 16:10:17

Previous topic - Next topic

SSH

Here we go, no longer are you restricted to printing text in one boring colour at a time. No longer are you restricted to less than 100 printable characters. No longer does text need to be printed horizontally! SSH presents.... the Sprite Font module. Includes 4 free example fonts..

Now updated for AGS 3.0 (and 2.72), but v1.02 still available for the 2.71 release.

Download v1.20 here (Requires AGS v2.72beta4a or later (includes AGS 3.0))
Documentation


Download v1.02 here (Requires AGS v2.71 only)

12

SSH

There are lots of fonts to use with this module on this site

I have put a few of them into .cha files for import in this download
12

Joseph DiPerla

Wow, I actual like this Module!

Good Job.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

SSH

#3
I've found an issue if you have a 320x200 game that you set up to run at 640x400, the printing goes awry, so I'll try and fix this at some point..

Edit:

I fixed the bug and uploaded v1.02
12

scourge

Hey this looks really cool! Now i'm gonna upgrade to 2.71.

SSH

Now updated for the latest beta. See first post for details.

btw, Aquilo (or anyone else) please let me know when you release any projects with my modules in, as I love to see my stuff being used!
12

Aquilo

Thanks a lot for this important update. When I release my project (which may take up to a year to complete, because I work solo with no team to speed up the process) I'll surely let you (and everyone else ;) )know. You'll be fully credited, of course. It's the stuff worth being used!
(Here follows a sample of the text written using this module, the font itself is custom):

SSH

Awesome font, Aquilo. Once you've released your game, I'd really encourage you to share the font with others, but of course that is up to you!
12

EnterTheStory (aka tolworthy)

Quote from: SSH on Thu 08/12/2005 16:10:17SSH presents.... the Sprite Font plugin.

This looks like exactly what I want! But can someone clarify if this is a module (from the tppic description) or a plugin (from the above quote)? i.e. would it work on Linux? Sorry of this is a newbie question :)

Scorpiorus

This is a script module and as such should work on any platform supported :)

EnterTheStory (aka tolworthy)


SSH

This will need some adaptation to work with AGS 3.0, unless you turn off the force-object-orientation option
12

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SSH

However, now you can use the new version and it works with AGS 3.0+ with no modification! Woot!
12

Simon the Sorcerer

That solved my problem. It wuz an old template(extreeemly old  ;D)
Thanks.

Hello sorcerer fans!

Jakerpot

nice work! but i dont get wow it works, its the new function no? Ok, so i will use an example:
Display("This is so cool! I gained a Super Bannana!") i wanted to change the Supper Bannana to red. How can i apply the module to it? Thanks.



monkey0506

#16
[EDIT:] Actually I was just reading over your post, and I think what you're looking for is the Hypertext module. That should allow you to change the font in the middle of the String...

***********************************

The first post links to the module's documentation. Without actually perusing the code, I'd say that it's not directly possible to create a Display-style box, unless you're using "Always display text as speech" in which case you could do something like this:

Code: ags
// script header
import Overlay* SaySprite(this Character*, String message, bool transparent=true);
import SpriteFont SpriteSpeechFont;

// script body

SpriteFont SpriteSpeechFont;
// ...load sprites into speech font...

void SaySprite(this Character*, String message, bool transparent) {
  DynamicSprite *sprite = SpriteSpeechFont.TextOnSprite(message);
  int width = sprite.Width;
  int height = sprite.Height;
  int x = this.x - (width / 2);
  if ((x + width) > System.ViewportWidth) x = (System.ViewportWidth - width);
  if (x < 0) x = 0;
  ViewFrame *frame = Game.GetViewFrame(this.View, this.Loop, this.Frame);
  int y = (this.y - (((Game.SpriteHeight[frame.Graphic] * this.Scaling) / 100) + height + 2)) - 6;
  if ((y < 0) || ((y + height) > System.ViewportHeight)) y = (System.ViewportHeight - height);
  return Overlay.CreateGraphical(x, y, sprite.Graphic, transparent);
}

// and finally...in any script
player.SaySprite("This is some text in a sprite font displayed over my head.");


Note that this method does *NOT* provide speech animation...for that you'd have to keep track of which character was speaking, how long the text should be displayed, how long the text has already been displayed...if you ask nicely I'm sure you could convince SSH to include a proper speech function into the module code...

SSH

Thanks for replying, yes, I think the Hypertext module would do the trick.
12

StillInThe90s

Hi people! Is anyone still using this module?
Anyway, I gave it a go, but could not make it work.
Is there a step-by-step tutorial or an open source code around?

SSH

I'll try and have a loook at making this work under 3.2 when I have a chance.
12

StillInThe90s

Are you sure this version is not working already?
I could not really tell, see.

StillInThe90s

Anyone knows if ther ever was an update of the sprite fonts -module, compatible with ags 3.2.1?
Thanks.



Not sure where to post this but I guess the good community mods can move this if necessary.
I would have posted in the module topic, but last time I posted in an old thread I got fish in the mail.

Gilbert

Post merged.

It's actually more appropriate to post in the module's own thread than starting a new one in the Technical forum. If you feel it's not right to necro an old thread (which is the case here) you may drop a PM to the author of the module instead.

abstauber

I'm using it for ages and it still works in 3.2.1. Although I'm not sure if I had to adjust a few things.

StillInThe90s

I think I found one of the problems.
The script uses "GetGameParameter" which does not work anymore. Problem is, I don't know how to translate this to "Game.SpriteHeight" and so on, since the manual assumes that I am working with room objects.

Ex:    int height=GetGameParameter(GP_SPRITEHEIGHT, spr, 0, 0);
and:  this.SetFontSprite(firstchar+i, GetGameParameter(GP_FRAMEIMAGE, v, loop, frame));

Ideas?

Khris

1)
Code: ags
  int height = Game.SpriteHeight[spr];


2)
Code: ags
  ViewFrame*vf = Game.GetViewFrame(v, loop, frame);
  this.SetFontSprite(firstchar + i, vf.Graphic);


Didn't test it though.

I believe you can make old commands work again by changing a setting in General settings; replacing them with the current ones is better practice though.

abstauber

In case you don't want to make these edits, here's mine:
http://shatten.sonores.de/wp-content/uploads/2011/04/SpriteFont.zip

Of course Khris' edits are working too :)

StillInThe90s

Hat of to you lads.
However, my scripting skills are not what they ought to be. I still can't get it running, only now it is a question of incompetence. How do I call the mod functions from the global script? I. e. how do I swap from ordinary font to sprite font? Using SSH:s included *.cha seemed easy enough, but no. I have searched the wiki and gone through the doc.

Khris

To be clear, you can't use this font as native speech font or something to that effect, you can only draw it to the background, a DynamicSprite or an Overlay.

So if you want your characters to talk using the sprite font you have to script a replacement for the Character.Say function and use only that.

Calin Leafshade

There is an option in the plugin interface to replace the font renderer.. Someone should make a sprite font renderer for it, that would be nice.

StillInThe90s

Quote from: Khris on Wed 27/04/2011 20:19:48
To be clear, you can't use this font as native speech font or something to that effect, you can only draw it to the background, a DynamicSprite or an Overlay.

So if you want your characters to talk using the sprite font you have to script a replacement for the Character.Say function and use only that.

So this mod is actually no more than a fancy way of showing overlays. Which makes it useless to me if I don't want to rework all of my dialogues...?
Maybe for next project then.

SSH

Find and Replace is your friend. It doesn't take much to create a character.SprSay function. But certainly it won't work with dialog scripts. I like Calin's suggestion, though. Sprint font rendering is pretty simple.

It would probably be better to have another way to import a set of sprites as a script-identifiable group than just using .cha files, though.

I'm pretty sure I did upgrade the module myself at one point, I'll have a look to find it, but no promises!
12

SMF spam blocked by CleanTalk