Jump to content

string arrays need help


3aq

Recommended Posts

still stumped

 

solved--stupid me, should've used string array properly.

 

 

 

here's the code

;--- word bank
string t_10 = "hi"
string t_11 = "hello"
string t_12 = "how are you"
string t_13 = "goodbye"

;--- arrays for loops
int n
int o
int[] pt_1a


;--- the loop
					n = -1
					while (n < 4)
					n += 1
						pt_1a[n] = AddToggleOption("["+n+"]"+" - "+t_1[o], false)
					endWhile

what I am trying to accomplish.. a loop function that will put out lines with differing text based off the t_1[o]

 

problem is I do not know the proper way to make t_1[o] actually happen.

 

if I removed t_1[o] it'll work but then what's the point, but when I include it won't compile, if I add string[] t_1 it'll crash on startup

 

help is deeply appreciated, thank you

 

Edited by 3aq
Link to comment
Share on other sites

welp, I'm still stump. I assume papyrus would function somewhat similar to java and c... but I can't seem to get this to work despite the angle I look from.

        String x[] = {"hi", "hello", "how are you", "goodbye"};
        int  i = 0;
        while(i < x.length) {
            int temp = i+1;
            System.out.println("[" + temp + "]" + " - " + x[i]);
            i++;
Link to comment
Share on other sites

Adapting functional well known programming language schemes to papyrus, I can tell you will be a royal pain in the butt - it's possible, but you will usually have a small short coming. It's like trying to translate a synthetic language to an analytical language directly, word for word.

String[] strings = new String[5]
strings[0] = "Hello World"
strings[1] = "Hello Earth"
strings[2] = "Hello Universe"
strings[3] = "Hello...?"
strings[4] = "Bye bye"

int i = 0
int index = strings.length

while i < index
    debug.trace("["+i+"] - "+strings[i])
    i += 1
endwhile

That's the closest I could think of to the above snippet you posted. I'm not sure the i+1 part in papyrus will give the expected results, so I left that out. This basically prints the index of the element and the containing string of the element to the log(the closest to system.out I guess).

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...