Skip to content

Adds AddNoteFromText() to DXRStartMap. Uses it to give the player the hangar code note on a Hangar start.#1328

Draft
MQDuck wants to merge 1 commit intoDie4Ever:developfrom
MQDuck:note-from-text
Draft

Adds AddNoteFromText() to DXRStartMap. Uses it to give the player the hangar code note on a Hangar start.#1328
MQDuck wants to merge 1 commit intoDie4Ever:developfrom
MQDuck:note-from-text

Conversation

@MQDuck
Copy link
Copy Markdown
Contributor

@MQDuck MQDuck commented Nov 13, 2025

No description provided.

}

#ifdef transcended
function DeusExNote AddNoteFromText(#var(PlayerPawn) player, bool bEmptyNotes, name textName, optional string textpackage, optional bool bRemoveBlankLines, optional bool bUserNote, optional bool bShowInLog, optional string strSource)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name should probably be "AddNoteFromTextTag", any time you're adding a note, it's probably "from text". Text Tag is a bit more specifically accurate. Likewise, the "textName" parameter should be "textTag", because that's what we actually call those.

"bRemoveBlankLines" seems like an odd option also - why would you want to not import the text from the text tag exactly as intended?

Copy link
Copy Markdown
Contributor Author

@MQDuck MQDuck Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name should probably be "AddNoteFromTextTag"

You're right. The current name isn't even accurate (it doesn't take a DeusExText as a parameter.

bRemoveBlankLines" seems like an odd option

Some datacubes have newlines removed when added to your notes. For instance, the hangar code datacube. Some don't.

Likewise, the "textName" parameter should be "textTag"

Yep, I like that a lot better. But I was following the naming convention of the vanilla code I was looking at.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure those extra newlines aren't from tags that you aren't handling in the text?

<DC=255,255,255>
<P>Juan asked me for the hangar code, Decker, so it's 5914.  Tell Young not to get his ass shot off -- you know how I feel about him.  And I _will_ kill you if something happens.
<P>
<P>Take care,
<P>Erin

if (parser == None) return None;

parser.OpenText(textName, textpackage);
while(parser.ProcessText()) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should likely look at how ProcessText is used in InformationDevices. I don't think there are any magic "blank lines" to be ignored, I think you're skipping tag information. This logic as-is likely would not function properly for text files that include references to the player name, use any formatting, etc. The logic here is missing all handling of the Tag property.

parser = new(None) Class'DeusExTextParser';
if (parser == None) return None;

parser.OpenText(textName, textpackage);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the textTag/textPackage combo doesn't actually exist? How does this handle that? OpenText appears to return a bool, which is presumably for success or failure. Look at other uses of this function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

}

if (text == "") {
note = note $ "|n";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a CR() instead of |n?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that's the character used in other locations doing equivalent logic (It's a Carriage Return + Line Feed)

note = note $ text;
}
}
CriticalDelete(parser);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text should be closed before deleting the parser object. This may leave a dangling file reference or something. Not sure how bad this may be, exactly, but it should be done if only for correctness.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered closing it but the vanilla code doesn't do that. I thought we weren't doing that either but I missed it. So yeah, I agree.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See line 143 of InformationDevices from vanilla. I only mentioned it because Vanilla does it.

@@ -716,6 +716,52 @@ function DeusExNote AddNoteFromConv(#var(PlayerPawn) player, bool bEmptyNotes, n
return None;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a high-level comment, I feel like this function should probably be in DXRActorsBase rather than in DXRStartMap

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree with this, and it should be moved there along with all the rest of the Add*From* functions. I was just putting this one along with its cousins.

if (bEmptyNotes == false) {
return None;
}
parser = new(None) Class'DeusExTextParser';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all this logic to extract the string from the text be in this specific function, or should it be broken out to a different one that just returns the string from the text tag for you? Seems like that would be generally useful.

@MQDuck MQDuck marked this pull request as draft November 19, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants