MessageBox and Suggestion

Feedback on past, current, and future development.
Post Reply
Equinox
Posts: 21
Joined: 31 Jul 2018, 20:13

MessageBox and Suggestion

Post by Equinox » 06 Apr 2020, 17:38

OpenMW implementation of messagebox has in fact improved a little over the OG MW one. The %s can now be used, although kinda useless because there is no string variable in Morrowind. But I noticed a slight peculiarity regarding its usage in OpenMW, see below:

Code: Select all

messagebox "String = %s" "\n"

Code: Select all

messagebox "String = %s%s" "\" "n"

Code: Select all

messagebox "String = %s%s%s" "\" "" "n"

The result of all of the above is

Code: Select all

String =
 
I expected

Code: Select all

String = \n
to show instead.

Is there a way to make messagebox properly show "\n" without interpreting it as a newline? If not, should this issue be fixed?

Finally for a suggestion, can we make it so %s at least accept GMST string values?

Jodiwe
Posts: 23
Joined: 16 Sep 2014, 12:10

Re: MessageBox and Suggestion

Post by Jodiwe » 07 Apr 2020, 08:51

Not that I've looked at the OpenMW code for a long time, but that looks like it's interpreting the backslash as an escape code/character. I'd guess after it goes through a printf/sprintf or whatever c++ uses in code, it gets printed to a separate buffer as a format string, which then escapes the backslash.

You may need to escape the backslash with another backslash.
i.e:

Code: Select all

"String = %s" "\\n"
That should include both backslashes in the subsequent string object:

Code: Select all

"String = \\n"
which is then printed as

Code: Select all

String = \n

Post Reply