Menu making tutorials

broken avatar :(
Created 1409 days ago
by liamsa669
0 Members and 1 Guest are viewing this topic.
2,911 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 January 2015
Last active: 1037 days ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
Signature
×
liamsa669's Groups
liamsa669's Contact & Social Links
This is in progress, it will probably be finished LATER TODAY, so dont comment till then

Im sorry for those who know the basics, but I am teaching it from a  "noob"'s perspective. Please note I was self taught so everything was confirmed to work, but may not be the simplest or the  "most correct" method. Also I name these based on what they do since there isn't any proper documentation on the names. Within the "All Options for this:" spoilers, yellow is the option, green is what it really represents, and white is the comment. Within the Category spoilers, Orange is the script, Teal is the variable, red is a comment.

Notes:
Sorry but you are not allowed to view spoiler contents.

Definitions:
Sorry but you are not allowed to view spoiler contents.
[/color]

#include  "MENUFILE_PATH" - Just like in GSC, this allows you to reference different items from another file. The file's path has to be in a set of quotations.

Example:
Sorry but you are not allowed to view spoiler contents.

#undef  VARIABLE - This nullifies a variable.

Example:
Sorry but you are not allowed to view spoiler contents.

#define  VARIABLE - This defines a variable.

Example:
Sorry but you are not allowed to view spoiler contents.

#ifdef  VARIABLE - Checks if The variable has been defined and is not NULL

Example:
Sorry but you are not allowed to view spoiler contents.

#endif - Ends the if statement

Example:
Sorry but you are not allowed to view spoiler contents.

//  COMMENTED_TEXT - This is a comment and anything after it (  but on the same line ) will not be read in the engine.

Example:
Sorry but you are not allowed to view spoiler contents.

/*  COMMENTED_TEXT - This is the start of a multi[/b] -line comment and anything inside it will not be read.

Example:
Sorry but you are not allowed to view spoiler contents.

COMMENTED_TEXT  */ - This is the end of a multi[/b] -line comment and anything between it will not be read.

Example:
Sorry but you are not allowed to view spoiler contents.
[/spoiler]


Event Handlers:
Sorry but you are not allowed to view spoiler contents.

doubleclick - It is set-up lile a function in which when the item/menu is doubleclicked, it will run what is inside the brackets.

Example:
Sorry but you are not allowed to view spoiler contents.

onClose - It is set[/b] -up like a function in which when the item/Menu is unloaded (  deleted ), it will run what is inside the brackets.

Example:
Sorry but you are not allowed to view spoiler contents.

onEsc - It is set[/b] -up like a function in which when the user backed out of the Menu the code will run.

Example:
Sorry but you are not allowed to view spoiler contents.

onFocus - It is set[/b] -up like a function in which the script will run while hovering over an object (  Only works with specific types of items )

Example:
Sorry but you are not allowed to view spoiler contents.

leavefocus - It is set[/b] -up like a function in which the script will run after stopping hovering over an object (  Only works with specific types of items )

Example:
Sorry but you are not allowed to view spoiler contents.

action - It is set[/b] -up like a function in which the script will run after clicking on an object. (  Only works with specific types of items )

Example:
Sorry but you are not allowed to view spoiler contents.

execKey  "BUTTON_KEY" - It is set[/b] -up like a function in which the script will run after pressing a certain button/key.

Example:
Sorry but you are not allowed to view spoiler contents.
[/spoiler]

All Event Handlers are set up like this (  I used a comment to be the action but the action can be anything that is on the action list ):
Event_name {
//action here with ; at the end
}

//or

Event_name { //action here with ; at the end }

Actions:
Actions are within Event Handlers. They are what control what it should do in that situation. The following is the most popular actions to be inside an Event Handler.  These are all folowed by a ; at the end.

Sorry but you are not allowed to view spoiler contents.

open  MENU_NAME - Opens a menu by the parameter  "name".

Example:
Sorry but you are not allowed to view spoiler contents.

execnow  "DVAR_TO_EXECUTE" - Executes (  runs ) a DVAR.

Example:
Sorry but you are not allowed to view spoiler contents.

exec  "DVAR_TO_EXECUTE" - Executes (  runs ) a DVAR.

Example:
Sorry but you are not allowed to view spoiler contents.

play  "SOUNDALLIAS_NAME" - Plays a soundallias.

Example:
Sorry but you are not allowed to view spoiler contents.

hide  OBJECT_NAME - Hides a menu/object.

Example:
Sorry but you are not allowed to view spoiler contents.

show  OBJECT_NAME - Shows a menu/object.

Example:
Sorry but you are not allowed to view spoiler contents.

uiScript  SCRIPT  VALUE1 - These are a series of functions that are called easily and are in the engine. For use, look into the uiScript section.

Example:
Sorry but you are not allowed to view spoiler contents.

setitemcolor  COLOR_CODE - This adjusts the ITEM's color ( Does not work with  onFocus and  leavefocus )

Example:
Sorry but you are not allowed to view spoiler contents.

VARIABLE - Yes, thats right... You are allowed to define a variable to be a series of Actions.

Example:
Sorry but you are not allowed to view spoiler contents.

close  MENU_NAME [/b] - Closes a menu by the given name

Example:
Sorry but you are not allowed to view spoiler contents.

[/spoiler]

Parameters:
Parameters are what allow us to customize menuDef and itemDef. Event Handlers are Parameters.

Sorry but you are not allowed to view spoiler contents.

text TEXT - This allows you to make a text item. ( Only works for text items. )

Example:
Sorry but you are not allowed to view spoiler contents.

ownerdraw TEXT - This allows you to use a engine variable as text.


type TYPE_OF_ITEM - This allows you to choose the item text. Here is the full list of types of items.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

textscale SCALE_0-1 - Allows you to change the size of the text using a decimal value between 0 and 1. This also has some preset variables.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

style STYLE_TYPE - Allows you to change the style the object is displayed as.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

textfont FONT_NAME - Allows you to change the font it is displayed as.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

rect COORDINENTS - Allows you to position the item on the screen. The positioning is a set of 4-6 numbers. The numbers go as: Xpos Ypos Xsize Ysize XOrgin YOrgin.

Example:
Sorry but you are not allowed to view spoiler contents.

textalign POSITION_OF_TEXT - This allows you to choose which side of the text box should the text be displayed on.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

forecolor COLOR_CODE - Changes the color of the item.

Example:
Sorry but you are not allowed to view spoiler contents.

visible TRUE_/_FALSE - Allows you to hide an item/menu.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

visible when ( CONDITION ) - Allows you to hide an item/menu untill a condition is met.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

group GROUP_NAME - Allows you to group objects to share properties.

Example:
Sorry but you are not allowed to view spoiler contents.

border TRUE_/_FALSE_/_BORDERSTYLE - Allows a border to be drawn around the item.

Example:
Sorry but you are not allowed to view spoiler contents.

All Options for this:
Sorry but you are not allowed to view spoiler contents.

bordersize COLOR_CODE - Allows you to change the thickness of the border. This is a percentage value from 0 to 1. (  You must have a border on for this to be visible. )

Example:
Sorry but you are not allowed to view spoiler contents.

bordercolor COLOR_CODE - This allows you to change the color of the border. (  You must have a border on for this to be visible. )

Example:
Sorry but you are not allowed to view spoiler contents.

backcolor COLOR_CODE - This allows you to change the background color.

Example:
Sorry but you are not allowed to view spoiler contents.

background MATERIAL_NAME - This allows you to choose the material that is displayed. (  The material MUST be a 2D Material and the item must an image type. )

Example:
Sorry but you are not allowed to view spoiler contents.

focusColor COLOR_CODE - This allows you to change the color when you are hovering over the item. (  This ONLY works with specific item types. )

Example:
Sorry but you are not allowed to view spoiler contents.

fullscreen TRUE_/_FALSE - This allows you to make the item fill the whole screen. This is only usefull for images.

Example:
Sorry but you are not allowed to view spoiler contents.

exp VARIES - This allows you to use a variable as an value.

origin COORDINENTS - This allows you to change the origin of the object.

Example:
Sorry but you are not allowed to view spoiler contents.

setfocus ITEM_NAME - Highlights a certain menu item.

Example:
Sorry but you are not allowed to view spoiler contents.

blurWorld VALUE_0_/_1 - This allows you to blur the screen in a percentage value between 0 and 10.

Example:
Sorry but you are not allowed to view spoiler contents.
[/spoiler]

Main Menu Template:
This is the minimum that you need for a main menu to work.
#include "ui/menudef.h"
#include "ui_mp/common_macro.inc"
#include "ui/mission_select/missiondefs.menu"

#include "ui_mp/menustyle.inc"
#include "ui/choices_setup_common.menu"
#include "ui/online_status.inc"

{
    assetGlobalDef
    {
        fadeClamp       1.0                     // sets the fadeup alpha
        fadeCycle       1                       // how often fade happens in milliseconds
        fadeAmount      0.1                     // amount to adjust alpha per cycle
    }
   
    menuDef
    {
        name            main
        visible            0
        fullscreen        0
        soundloop       "BACKGROUND_SOUND_ALLIAS" // default is "music_mainmenu"
        rect            0 0 640 480
        focuscolor        1 1 1 1
        disablecolor        0 0 0 0
         style            WINDOW_STYLE_EMPTY
 
        onOpen
        {
            setDvar cl_bypassMouseInput "1";
        }

        onEsc
        {
            open quit_popmenu;
        }

        onClose
        {
            setDvar cl_bypassMouseInput "0"
        }

        menuDef
        {
            name            main_text
            fullScreen      1
            rect            0 0 640 480
            soundloop       "" // default is music_mainmenu
            focusColor      1 1 0 1
            style           WINDOW_STYLE_EMPTY
            onOpen
            {
                CLEARUIHINT
               
                execnow "ui_cinematic VIDEO_NAME 3"
                setdvar ui_showOnlineOfflineButton "1";

                // setdvar main_logo "0";

                //savegameshow resume;
                //savegamehide newgame;
            }
            onFocus
            {
                execnow "ui_cinematic VIDEO_NAME 3"; // default is bink_front_end_screen_home
            }
            onEsc
            {
                play "CLOSE_SOUND_ALLIAS"; // default is "mouse_click" 
            }

            // items go here



            // end of items 
        }   
    }
}

HUD Template:
This is the minimum that you need for a HUD menu to work.
// Soon to come

Button ITEM Template:
itemDef
{
      name            NAME_GOES_HERE
      text            "TEXT_GOES_HERE"
      type            ITEM_TYPE_BUTTON
      textscale       TEXTSIZE_DEFAULT
      style           WINDOW_STYLE_FILLED
      textfont        UI_FONT_NORMAL
      rect            30 70 50 5
      textalign       ITEM_ALIGN_MIDDLE_CENTER
      forecolor       1 1 1 1
      visible         1
      onFocus
      {
          play "mouse_over";
      }
      leavefocus
      {
         
      }
      action
      {
          play "mouse_click";
      }
}

Text ITEM Template:
itemDef
{
     name            NAME_GOES_HERE
     text            "TEXT_GOES_HERE"
     style           WINDOW_STYLE_EMPTY
     textscale       TEXTSIZE_TITLE
     rect            30 50 50 5
     textalign       ITEM_ALIGN_MIDDLE_CENTER
     forecolor       1 1 1 1
     visible         1
     decoration
}

Image ITEM Template:
itemDef 
{
      name               NAME_GOES_HERE
      rect                  35 130 200 100
      style                 WINDOW_STYLE_SHADER
      background      "MATERIAL_NAME"
      decoration
      visible              1
}

Fullscreen Image ITEM Template:
itemDef 
{
       name                 "NAME_GOES_HERE"
       rect                    FULLSCREEN
       FullScreen 1
       forecolor            1 1 1 1
       style                 WINDOW_STYLE_SHADER
       background      "MATERIAL_NAME"
       decoration
       visible               1
}

Here is a text document that may help you if you are in need: [You are not allowed to view external links. Register or Login to see them]
Last Edit: June 23, 2016, 02:09:37 pm by liamsa669
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 34 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
I changed the code boxes into TT boxes that were inside "hidden text" sections

Only reason is because the boxes are squashed in hidden text

Sometimes its ok, but this one there were a few options you scrolled past in one increment, so couldnt see them at all

Still looks sorta like code in TT just no highlighting and no box behind it

can change it back if requested
broken avatar :(
×
broken avatar :(
Location: frPontault-Combault, France
Date Registered: 18 October 2014
Last active: 14 days ago
Posts
86
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Signature
Visitez mon site : [You are not allowed to view external links. Register or Login to see them] pour rejoindre la communauté Française sur le mod tools!
visit my website : [You are not allowed to view external links. Register or Login to see them] to join french communauty on mod tools
×
Wolf_Silver's Groups
 really useful! thanks! i can really edit my main menu!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 January 2015
Last active: 1037 days ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Member
×
liamsa669's Groups
liamsa669's Contact & Social Links
updated, all i need to do is add a 'blank' hud script, which I will get to later

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...