Talk:Show - Message

From the CreationKit Wiki
Revision as of 00:42, 19 February 2012 by imported>Cipscis (Added source tags for formatting and syntax highlighting on the code)
Jump to navigation Jump to search

how to make a quick menu with 3 different buttons that runs once when the game starts the first time after loading this mod:


1. create a quest and give it an ID (contrary to intuition do not enable "star game enabled" (it now means that it will start everytime the game loads or somin, not only to start once like in FO3 and co, quests automaticly start without conditions now)


2. create a message and add 3 buttons giving them some text (not too long, buttons will be displayed next to each other with this script)


3. add a script to your quest and add properties for your quest and message


4. use the following for that script:

Scriptname MyMenuQuestScript extends Quest
{displays a multiple choice menu}

message property MyMenuQuestMessage auto                 ;;declare your properties/variabels
quest property MyMenuQuest auto

event OnInit()                                            ;;begins when script or its parent quest gets initialized

int ibutton = MyMenuQuestMessage.show()                   ;;shows the message item

       if ibutton == 0                                    ;; 0 is the first button, 1 the second, and so on
               debug.messagebox("you hit button 1")       ;;replace with whatever result function you like

       elseif ibutton == 1
               debug.messagebox("you hit button 2")

       else 
               debug.messagebox("you didnt hit button 1 or 2 hence must have hit 3")

       endif

MyMenuQuest.stop()                                        ;;stops the quest
endEvent

5. autofill the scripts properties and youre done, start the game and see your menu appear

--Jaysus 04:31, 18 February 2012 (EST)