Need some help with Message Boxes

Post » Fri Nov 16, 2012 8:44 pm

I'm fairly new to modding and scripting, and I'm making my first real script. I'm trying to redo the mining script in this game so that instead of waiting on the animations, a message box pops up asking how much a player would like to mine out of fifteen ores available in a vein in which the options are to mine: 1 ore, 5 ores, 10 ores, and 15 ores. Problem is, how can I make the message box display the current amount of ore available in a vein (if possible), and how can I grey out some menu options in the message box, e.g. if the vein only has 10 ores remaining,how do i make the menu option to mine 15 ores unclickable (greyed out)?


Any help for a newbie be GREATLY appreciated!
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Fri Nov 16, 2012 5:35 pm

For me, the Message functionality was not so intuitive... so hopefully this will help:

You can pass the number of ore to the message in the http://www.creationkit.com/Show_-_Message function. Here's a sample from that link:
int ibutton = YetAnotherMessage.Show(afArg3 = 20)

For the buttons, you can use conditions to enable/disable them (disable makes them invisible, not greyed out). So you could create a global variabe that your script sets, then the condition for the "15" button would be something like:
Function: GetGlobalValue
Function Info:
Comp: >=
Value: 15

Here's an example how to define the global variable in your script:
GlobalVariable Property ScenicCarriagesRealCartEnabled Auto

So big picture: when your script gets called, you need to get the remaining ore (no clue on that), and set the globabl variable with that value using http://www.creationkit.com/SetValue_-_GlobalVariable. You can pass the value to the message box also, but that is just for display purposes, the buttons will be using the global value. Then your script will check which button was pressed and respond accordingly.

EDIT: I am refering to the Message object from the CK, not the Debug.MessageBox().
User avatar
Trista Jim
 
Posts: 3308
Joined: Sat Aug 25, 2007 10:39 pm

Post » Sat Nov 17, 2012 2:28 am

Thanks! When I perusing the Wiki trying to find solutions, I came across the same info you posted, but there so many other functions and paths that looked like possible solutions that I kind of got lost. But after messing around with your suggestion, it finally worked! Now all I need to do is add the sound properties and I'll done with my first script! Thanks!
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm


Return to V - Skyrim