Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Smoerble

Cannot use HTML in localize in createDiaryRecord (Briefing)

Recommended Posts

Hi all,

I want to create a briefing in my init.sqf. I want to use the localization feature (stringtable.xml) and would like to use HTML in the breifing text.

So basically I need something like this:

player createDiaryRecord["Diary", [localize "smotrans_briefing1Title", toString [parseText localize "smotrans_briefing1Description"]]];

Questions:

1) the code above does not work, error: "Type Text, expected String". How can I use HTML in stringtabel and still display it inside the brieifing please?

2) as far as I understand, the code above is not meant to run on a COOP/multiplayer campaign. How should I change it please?

Share this post


Link to post
Share on other sites

Use the str not toString which is for converting char arrays into strings.

Share this post


Link to post
Share on other sites
Use the str not toString which is for converting char arrays into strings.

Thank you, this helped.

Next question: my stringtable.xml contains:

			<Key ID="smotrans_briefing1Description">
			<Original>There are marked areas on the map. To capture these areas, all enemies in each area needs to be eliminated. Once BLUFOR takes control of an area, this unlocks: <li>a new spawnpoint in this area</li> <li>new loadouts (in some areas)</li></Original>
		</Key>

Everything after "unlocks:" is not displayed. According to https://community.bistudio.com/wiki/parseText , there is no list command to be used with ArmA3? Or do I miss anything?

---------- Post added at 16:42 ---------- Previous post was at 16:36 ----------

And another question:

The stirngtable.xml gets cached. I always need to end the Preview, get back to the editor, load a different mission, load the original mission again and hit Preview to see any changes in the localized texts.

Any better way? e.g. can I somehow delete the cache from the init.sqf?

---------- Post added at 16:48 ---------- Previous post was at 16:42 ----------

I tried to get a formatting with line breaks, but they are ignored in the briefing. In hints it works fine. Anyone has an idea please?

			<Key ID="smotrans_briefing1Description">
			<Original>There are marked areas on the map. To capture these areas, all enemies in each area needs to be eliminated. Once BLUFOR takes control of an area, this unlocks:<br />
			+ a new spawnpoint in this area< br/>
			+ new loadouts (in some areas)<br/></Original>
			<German>Gebiete erobern</German>
		</Key>

And another question:

The stirngtable.xml gets cached. I always need to end the Preview, get back to the editor, load a different mission, load the original mission again and hit Preview to see any changes in the localized texts.

Any better way? e.g. can I somehow delete the cache from the init.sqf?

Share this post


Link to post
Share on other sites

You're correct in assuming there's no list command. Although, using stars and <br/> will work just as well to "simulate" a list. As for your caching, simply saving the mission in the editor will reload it, as it should be the same as the description.ext (which also only gets updated when saving / loading mission again)

Edit

Linebreaks are simply <br />, nothing else.

Share this post


Link to post
Share on other sites

Hmmm does not seem to work with parseText

e.g

player createDiarySubject ["info","info"];
player createDiaryRecord["info", ["info", str parseText "<br />hello<br />world<br />"]];

but composeText does work

player createDiarySubject ["info","info"];
player createDiaryRecord["info", ["info", str composeText ["<br />hello<br />world<br />"]]];

As tryteyker says if its like description.ext just pressing save should be enough to make the editor reload the files.

Share this post


Link to post
Share on other sites

Thank you for testing the break issue. Unfortunately I need to work with localization, so this is gonna be a mess ;)... but so be it ;).

Share this post


Link to post
Share on other sites

?

No different to what you had other than parseText is Now composeText and the localisation is wrapped in []

player createDiaryRecord["Diary", [localize "smotrans_briefing1Title", str composeText [localize "smotrans_briefing1Description"]]];  

May make it look neater and easier to work with

_title = localize "smotrans_briefing1Title";
_description = str composeText [localize "smotrans_briefing1Description"];
player createDiaryRecord["Diary", [ _title , _description]];

Does that work?

Edited by Larrow

Share this post


Link to post
Share on other sites

Thanks @tryteyker and @Larrow.

The trick with saving helped.

But more important: when creating a briefing with localization... do NOT use the parseText. The following is tested and works fine:

stringtable.xml:

			<Key ID="strSmo_briefing1Description6">
			<Original>
			<img image='BombratsMission1Briefing1.jpg'/><br/><br/>We need to destroy the anti air vehicles near the coast. Your squad starts the mission with very limited resources. <><br/>Find vehicles at postion (1), there you can also find a slightly better equipment.<br/><br/>After that find the extraction point to end the mission.<br/></Original>
			<German>Das Gebiet wurde befreit. Ein neuer Spawnpunkt und neue Loadouts wurden freigeschaltet.</German>
		</Key>

init.sqf:

player createDiaryRecord["Diary", [localize "strSmo_briefing1Title", localize "strSmo_briefing1Description6"]];

Share this post


Link to post
Share on other sites

Lol ok, I never tested just a straight localize :) i thought i read in your first post that it didnt work and thats why you were trying parseText but on rereading i see you didnt oh well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×