Home   Help Search Login Register  

Author Topic: Fancy fonts, coloured text and format  (Read 753 times)

0 Members and 1 Guest are viewing this topic.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Fancy fonts, coloured text and format
« on: 08 Apr 2005, 09:51:58 »
I want to use coloured text and one of the in built fonts in a message that has several numbers in it.  These numbers change during the mission.  

Format works well in creating a string for use in a titletext/cut.
Code: [Select]
_string = format ["blah blah %1,blah blah %2",variable1,variable2]
titlecut [_string,"plain down", 1]

What I want is someway of combining the functionality of Format with titleRsc.

The only way I can think of achieving what I want is to define a titleRsc text line for every possible combination of numbers.  As there are 231 of these I will not be going this route.
« Last Edit: 08 Apr 2005, 09:52:42 by THobson »

Offline Blanco

  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #1 on: 08 Apr 2005, 13:56:49 »
As there are 231 of these I will not be going this route.
Quote

 :D
...
Every number contains a combinition of numbers between 0 and 9 , so basically you need only 10 titleRsc...
I 'm not sure how to this , but some time ago I saw this post

http://www.ofpec.com/yabbse/index.php?board=10;action=display;threadid=22079

Read the fifth post, ACF is talking about sounds, but it should work with titleRsc too no?
« Last Edit: 08 Apr 2005, 15:19:29 by Blanco »
Search or search or search before you ask.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #2 on: 08 Apr 2005, 15:23:59 »
You are right - I could do it with 11 titleRsc s.  One for the text and one for each of the digits.  Getting the text and the numbers lined up could be an interesting test of my patience.

The ACF script would be a good way to select the correct titleRsc for the digits.

Offline Blanco

  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #3 on: 08 Apr 2005, 15:58:33 »
Code: [Select]
Getting the text and the numbers lined up could be an interesting test of my patience.
True, that's another problem.
Positioning a titleRsc is only possible in the description.ext AFAIK
You will need 3 possible positions for the numbers (3 digits) and 1 for the text.
So if I'm right you have to define 31 (3*10 + 1) titleRsc parts in you description.ext.
Not the easiest thing to do imo  :-\

**edit**

Can you show two TitleRSc at the same time?
Won't the second override the first?




 
« Last Edit: 08 Apr 2005, 16:00:53 by Blanco »
Search or search or search before you ask.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #4 on: 08 Apr 2005, 16:15:35 »
Quote
Can you show two TitleRSc at the same time?
Won't the second override the first?
Good point.  Yes one titleRsc will replace a previous one.  You can show a titleRsc and a cutRsc simultaneously but that brings the problem of making sure they fade in and out together.

So I can use titleRsc for the text and I can only use one cutRsc for both numbers.  That brings me back to 231 possible options for the string used by the cutRsc, and if I am going to dothat I might as well just have 231 strings for the whole lot.

I think I will live with standard white text for this.
« Last Edit: 08 Apr 2005, 16:16:52 by THobson »

Offline Blanco

  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #5 on: 08 Apr 2005, 16:23:38 »
Quote
That brings me back to 231 possible options for the string used by the cutRsc.

Actually if you really want this, it's stil do-able, it's just a matter of copy and paste and changing some names.
But is it worth the effort?
Why 231 btw?


 
« Last Edit: 08 Apr 2005, 16:25:00 by Blanco »
Search or search or search before you ask.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #6 on: 08 Apr 2005, 17:00:10 »
It is not just the time it is also the number of names.  I am working hard to keep my mission away from the large samegame bug.  Adding another 231 names will not help at all!.

Why 231?
The player starts with 20 anti-personnel mines and the number is decremented each time he uses one, this gives 21 possiblities.  He also has 10 anti-vehicle mines, that is 11 possiblities.

21 x 11 = 231

Actually I now know what to do for this - forget about doing it this way and do something completely different that will remove the need for this and solve another problem at the same time.

If there is a technical solution I would be interested - but I don't need it urgently.
« Last Edit: 08 Apr 2005, 21:09:51 by THobson »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Fancy fonts, coloured text and format
« Reply #7 on: 08 Apr 2005, 21:04:07 »
You are correct that there is no way to dynamically change a titlersc during the game. However, you could use a dialog, which does allow you to do just that. The obvious drawback is that it interupts the player's control while it is displayed...

However, doing it with resources doesn't have to be as complicated as you think. First off, lining up the text and numbers shouldn't be difficult if they are both the same font size, because you have the x and y positions of everything, so you just need to match the y's, and then guess/check a few times to get the x position correct....

As for actually DEFINING all of those resources: there is a handy-dandy feature of #define that allows you to do this sort of thing in one line for each resource.

Basically, you can condense everything into 11 or 21 lines, plus one large define.

I'm not at home right now, so I can't give you exact syntax, but it works something like this:

Code: [Select]
#define my_define \
   Class %1 : class base \
   { property1 = %2; }

my_define (ClassA, 1)
my_define (ClassB, 2)
...etc
In the very abstract example above, the result in your description.ext (or config.cpp; these work there too) would be two classes: ClassA (which has property1 == 1), and ClassB (which has property2 == 2). If you just imagine a more complicated example, where you have many lines that would be the same, you can see how this sort of a define can save you a TON of space (plus you get the benifits of inheritance, so if you change the define, everything else changes too).

Like I said, bad example, but I'll try to post a specific one later. Also check out my titlersc tutorial, if you haven't already. I didn't include info on how to do these advanced defines, though; but perhaps I should...

HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Fancy fonts, coloured text and format
« Reply #8 on: 08 Apr 2005, 21:16:19 »
Quote
However, you could use a dialog, which does allow you to do just that. The obvious drawback is that it interupts the player's control while it is displayed...
That would be the killer in the situation I have.

Quote
Like I said, bad example, but I'll try to post a specific one later. Also check out my titlersc tutorial, if you haven't already. I didn't include info on how to do these advanced defines, though; but perhaps I should...
Yes thanks I have seen your tutorial - excellent, I have even recommended it to people.  An update on the more complicated stuff would be really helpful.