Show a Message from an array

Post » Sun Nov 18, 2012 10:12 am

Need some help here as I'm a little lost on the syntax in this matter. I'm trying to show a certain message from an array of messages, but I don't know how I can do that, this is a partial setup of the script:

message[] property commonCreatedMSG auto ; I have 6 messages from 0 to 5

int ccMSG = commonCreatedMSG.Length

Now my problem is to how show a certain message, I first set the integer to the number of the message I want, but then how I show the message itself based on the integer number?

Couldn't find anything on the Skyrim script to use as reference so I'm lost.

I'm trying to make a smaller script that instead of calling each message everytime I just call a function that do the job for everything.

Thanks in advance.
User avatar
matt white
 
Posts: 3444
Joined: Fri Jul 27, 2007 2:43 pm

Post » Sun Nov 18, 2012 12:18 am

The Hello World! Papyrus tutorial on the creation kit website would be a good place to start mate :)
User avatar
helen buchan
 
Posts: 3464
Joined: Wed Sep 13, 2006 7:17 am

Post » Sun Nov 18, 2012 4:47 am

Is not a problem of programming in skyrim, is just the syntax to that specific thing. I've already made the whole script working, but is a load of useless code, and would like to make it more slim using arrays.
User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm

Post » Sun Nov 18, 2012 12:46 pm

There are no arrays in Papyrus, so you're probably stuck using conditional code.

Like:

If thisVariable == 1 then show message01

If thisVariable == 2 then show message 02

etc.

I don't really know what it is, exactly, that you're trying to do, so this is my best guess under the circumstances as to what approach you could use... sorry if it doesn't help :(
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Sun Nov 18, 2012 10:37 am

There are no arrays in Papyrus, so you're probably stuck using conditional code.

http://www.creationkit.com/Arrays_(Papyrus)...

To the OP: Papyrus uses square brackets to specifiy which element in an array you want. So something like

commonCreatedMSG[n].Show()

or for a menu

Int iChoice = commonCreatedMSG[n].Show()

should work, where "n" is between 0 and 5 (edit: or a variable containing such a number).
User avatar
Nicola
 
Posts: 3365
Joined: Wed Jul 19, 2006 7:57 am

Post » Sun Nov 18, 2012 8:24 am

http://www.creationkit.com/Arrays_(Papyrus)...


I've been messing with Papyrus since the CK came out and I didn't know that... where's the facepalm smiley?

:facepalm:
User avatar
James Smart
 
Posts: 3362
Joined: Sun Nov 04, 2007 7:49 pm


Return to V - Skyrim