Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An array of strings does not work properly as a parameter. #2

Open
Mirgosoft opened this issue Nov 28, 2023 · 2 comments
Open

An array of strings does not work properly as a parameter. #2

Mirgosoft opened this issue Nov 28, 2023 · 2 comments

Comments

@Mirgosoft
Copy link

Mirgosoft commented Nov 28, 2023

Instead of displaying all buttons normally, the whole array is just shown as a name in 1 button.
For example, The Text of a single button becomes this:

Снимок

At first I thought that Utility.CreateStringArray() was not supported, but then the example I gave in the second post didn't work either.

@Mirgosoft
Copy link
Author

Mirgosoft commented Nov 28, 2023

I did a little testing and realized that the problem wasn't the Utility.CreateStringArray() arrays.

This default example code gives me the same strange result (as 1 button with array contents displayed):

string[] buttons = new string[2]
buttons[0] = "Ok"
buttons[1] = "Cancel"

int sel_btn = SkyMessage.Show("Hello, world!", buttons, getIndex = true) as int

Hmm...

@Mirgosoft Mirgosoft changed the title The Utility.CreateStringArray() as an array for button names is not supported. An array of strings does not work properly as a parameter. Nov 28, 2023
@Mirgosoft
Copy link
Author

Mirgosoft commented Nov 28, 2023

I think my regional settings have a comma rather than a dot separator (InvariantCulture problem).
I had a similar problem with the C# code here (First answer):
stackoverflow link

I think it would be nice to fix this in the source code as well, or just use a simple Papyrus fix like this:

int function ShowSkyMessage_Fixed(string msg_text, string[] source_btns_arr) global
    string[] btns = Utility.CreateStringArray(10, "") ; 10 buttons max with empty string values
    int i = 0
    while i < btns.Length && i < source_btns_arr.Length
        btns[i] = source_btns_arr[i]
        i += 1
    endWhile
    return SkyMessage.Show(msg_text, btns[0], btns[1], btns[2], btns[3], btns[4], btns[5], btns[6], btns[7], btns[8], btns[9], getIndex = true) as int
endFunction

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

No branches or pull requests

1 participant