ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
String Table Text Formatting

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  08:37:09  1 November 2013
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454
String Table Text Formatting

In the string tables, there are a few ways of formatting text differently. For instance I know about $$FOOBAR$$ to reference keybinds and %c[A,R,G,B] to define a color. There are also a few other things I've seen like %d that I don't understand the function of. Are these documented anywhere? Does anyone know of some others?
What I would really like to do is reference string ids within a string, like "This weapon is loaded with [ammo-11.43x23-fmj]", and things like that. Even better would be being able to access fields in the .ltxs, but I won't get my hopes up for that.
Thank you.
  22:30:30  1 November 2013
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
Check here for more info on string manipulations and patterns :
[link]http://www.lua.org/manual/5.2/manual.html#6.4[/link]

As for accessing info in the ltx, it is available through the system ini as well as accessing info via packets, which is well discussed on these forums, just search for packet_utils.
  01:15:53  2 November 2013
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454

---QUOTATION---
Check here for more info on string manipulations and patterns :
[link]http://www.lua.org/manual/5.2/manual.html#6.4[/link]

As for accessing info in the ltx, it is available through the system ini as well as accessing info via packets, which is well discussed on these forums, just search for packet_utils.
---END QUOTATION---



That's not the issue, I know how to use Lua to mess with strings and I've done plenty of .ltx reading. I want to know if it's possible to embed more complicated formatting or logic in the string tables themselves, for making item descriptions that can integrate other elements from the string tables inside them, and things like that.
  23:28:53  2 November 2013
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

---QUOTATION---
Check here for more info on string manipulations and patterns :
[link]http://www.lua.org/manual/5.2/manual.html#6.4[/link]

As for accessing info in the ltx, it is available through the system ini as well as accessing info via packets, which is well discussed on these forums, just search for packet_utils.

That's not the issue, I know how to use Lua to mess with strings and I've done plenty of .ltx reading. I want to know if it's possible to embed more complicated formatting or logic in the string tables themselves, for making item descriptions that can integrate other elements from the string tables inside them, and things like that.
---END QUOTATION---



Ah sorry, totally misread the question.
  00:18:02  4 November 2013
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
 

Message edited by:
ThunderFreak
11/04/2013 0:20:04
Messages: 685

---QUOTATION---
String Table Text Formatting

In the string tables, there are a few ways of formatting text differently. For instance I know about $$FOOBAR$$ to reference keybinds and %c[A,R,G,B] to define a color. There are also a few other things I've seen like %d that I don't understand the function of. Are these documented anywhere? Does anyone know of some others?
What I would really like to do is reference string ids within a string, like "This weapon is loaded with [ammo-11.43x23-fmj]", and things like that. Even better would be being able to access fields in the .ltxs, but I won't get my hopes up for that.
Thank you.
---END QUOTATION---



To translate string IDs to clear text you need the function game.translate_string( "string" ).
For example:

string.format("This weapon is loaded with [%s]",game.translate_string("ammo-11.43x23-fmj"))

would show you the text "This weapon is loaded with [.45 ACP]".
%s is the placeholder for strings
%d is the placeholder for numbers
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2021 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.