I am trying to manipulate journal entries through scripts and custom tokens. I would like to place a couple of line breaks between entries, so I am putting two consecutive \n\n at the start of each string. For example: “\n\n This is my second entry”. But the \n\n prints in front of the text instead of converting to new lines. So I get something like
This is my first entry.\n\n This is my second entry.
Here’s an example. It’s a bit long-winded, as it’s the first one that came to hand, but you see that in essence it builds a string which is then inserted in the custom token before updating the journal. In the journal entry it appears as
The script is
object oPC = GetFirstPC();
int bAstonCastleCutscene = GetLocalInt(GetObjectByTag("trCutsceneAstonCastle"), "OneOffDone");
int bGuildhallScene = GetLocalInt(GetObjectByTag("MayorHogsbottom"), "DoOnceintro");
string sText = "HOUSE ROYSON"
+ "\n\nQueen Anne has been appointed Regent with the support of the Roysons and Fitzwilliams, in view of King Henry's mental incapacity.";
sText = sText + "\n\nHer affinity holds the South."
+ "\n\nLara Fitzwilliam's estates near Amesbridge in the North are surrounded by Evenlode supporters.";
sText = sText + "\n\nFitzwilliam supporters have begun to seize farms in the Astonbridge district."
+ "\n\nKing's Justice Hogsbottom is powerless to confront the Fitzwilliams, but has referred the matter to the High Court.";
sText = sText + "\n\nHOUSE EVENLODE"
+ "\n\nRichard Evenlode, Earl of Silbury, is concerned that the Queen's affinity have become a law unto themselves."
+ "\n\nLady Constance Caraway agreed to help him lobby for justice.";
sText = sText + "\n\nHowever, this plan failed with her cousin, William Caraway, who remains undecided after his wife, Margaret Fitzwilliam, turned their meeting into a confrontation hetween mages."
+ "\n\nHouse Evenlode holds the Midlands."
+ "\n\nWilliam Caraway may be the key to the divided North.";
sText = sText + "\n\nMAGES"
+ "\n\nEvidently, there are at least two orders of mages in town."
+ "\n\nSelene Moonglow of the Perfect Circle seems to be working for Margaret Fitzwilliam."
+ "\n\nJasper Rookfield of the Seventh Veil is employed by Lady Constance Caraway.";
RemoveJournalQuestEntry("jt_background", oPC); // Must do this because custom token is baked in
AddJournalQuestEntry("jt_background", 1, oPC, TRUE, FALSE, TRUE);
SetPanelButtonFlash(oPC, PANEL_BUTTON_JOURNAL, TRUE);
I was getting very frustrating compiler errors if I put the function call in exactly by cutting and pasting. It was giving me an undefined variable error. After a lot of systematic testing and hair pulling I discovered that it did not compile with ANY litteral string in the GetObjectByTag() call. If I put the “LineFeed” into a declared variable string sLF and put the variable in the GetObjectbyTag call it worked fine for me
string sToken="This is my first entry. " + GetDescription(GetObjectByTag(“LineFeed”))+GetDescription(GetObjectByTag(“LineFeed”))+“This is my second entry”
will not compile. yields error that variable is not defined.
string sToken="This is my first entry. " + GetDescription(GetObjectByTag(sLG))+GetDescription(GetObjectByTag(sLG))+“This is my second entry”
Added info: I do not know if this makes a difference by my functions for building the tokens are in an #include file. They are called from an action taken script.
Thanx for the help… I also will be sending a reply to your \n\n response below.
Weird, this is almost exactly the format of my text calls. The only difference I see is I keep all my text on one long line. I did not know you could break up the concatenation over multiple lines like you do. Makes for much better readability. The other difference is that I am using a token with a much higher number. i.e., CUSTOM170002. I don’t know if there is some weird collision going on - using CEP3.1.
My nwn tookset seems to have some flaws that your not experiencing. But since I have a working approach, I am not going to investigate further for now.
Oh, another difference is that my text is retrieved from other tokens using a modified GetCustomToken() call I found on NWN Lexicon called GetCustomTokenEx(). Maybe that call does something to the escape character in the string… converting them to literal characters?
I am aware of the literal limit of 511. The individual literals are 80 or less. There is one concatenation that I put in a variable that might get close to the 511 limit. I’ll have to check on that, but I thought when you concatenate string builds into a variable you could increase string length quite a bit. Still, I’ll do a clean test module with no haks to explore the situation a bit. I’ll first try reproducing the SendMessagetoPC code by Mmat, then the journal entry code you have and satisfy myself there is nothing in my module causing weirdness.