Difference between revisions of "Talk:Show - Message"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jaysus
(Created page with "---- '''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 a...")
 
imported>Cipscis
m (Added source tags for formatting and syntax highlighting on the code)
Line 23: Line 23:
use the following for that script:
use the following for that script:


Scriptname MyMenuQuestScript extends Quest
<source lang="papyrus">Scriptname MyMenuQuestScript extends Quest
{displays a multiple choice menu}
{displays a multiple choice menu}


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


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


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


        if ibutton == 0                                    ;; 0 is the first button, 1 the second, and so on
      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
              debug.messagebox("you hit button 1")      ;;replace with whatever result function you like


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


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


        endif
      endif


MyMenuQuest.stop()                                        ;;stops the quest
MyMenuQuest.stop()                                        ;;stops the quest
endEvent
endEvent</source>


----
----

Revision as of 00:42, 19 February 2012


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)