Umenu tutorial?

Discussions about Coding and Scripting
User avatar
TheDane
Masterful
Posts: 660
Joined: Tue Feb 12, 2008 2:47 pm
Personal rank: Happy fool :-)

Re: Umenu tutorial?

Post by TheDane »

ehmm .... ran into problems haha :-)

When closing the window using the 'UWindowSmallCloseButton' class the players mouse button is still moving arround like the window is still opened, is there something I need to do in order for the player to switch to aim mode automaticly when closing the window? Like a console command? Sorry for the noob question, but I'm going blind searching the classes for answers :loool:

If i hit escape it goes to aim mode - which should be a "ShowMenu" console command? However, it won't work when I call it from inside the window (function Notify).
Retired.
~V~
Average
Posts: 39
Joined: Thu Dec 13, 2012 5:13 am

Re: Umenu tutorial?

Post by ~V~ »

Well there are Close() and EscClose() that you could call.

This is one of the drawback of using QuickKeyEnable. It can take a lot of messing around to get rid of the mouse cursor.
irc.globalgamers.net #uscript
http://irc.lc/globalgamers/uscript
User avatar
TheDane
Masterful
Posts: 660
Joined: Tue Feb 12, 2008 2:47 pm
Personal rank: Happy fool :-)

Re: Umenu tutorial?

Post by TheDane »

~V~ wrote:Well there are Close() and EscClose() that you could call.

This is one of the drawback of using QuickKeyEnable. It can take a lot of messing around to get rid of the mouse cursor.
Yeah .... it's tricky ... or buggy? I dunno :noidea All the stuff I've tried so far doesn't make much sence and honestly I think the umenu and uwindows system is far too limited for what I am planning to do here ... sadly..... So... back to the drawing board and expand my own little HUD menu thingy :mrgreen:

Thanks for all your help though! I'm sure this topic will be extremely useful for someone who wants to learn the basics of this system. :gj:
Retired.
UT99.org

Re: Umenu tutorial?

Post by UT99.org »

billybill wrote:The problem with that though is clients resolution is going to produce a different mouse axis. What drove me nuts is whenever I wanted to make an editbox or another control bigger it would shift position, so both these have to be in sync. Then there were other problems, *sigh*. Not easy but still easier than the alternative which is what you are trying to do now
~V~
Average
Posts: 39
Joined: Thu Dec 13, 2012 5:13 am

Re: Umenu tutorial?

Post by ~V~ »

TheDane wrote:
~V~ wrote:Yeah .... it's tricky ... or buggy? I dunno :noidea All the stuff I've tried so far doesn't make much sence and honestly I think the umenu and uwindows system is far too limited for what I am planning to do here ... sadly..... So... back to the drawing board and expand my own little HUD menu thingy
Tricky, rather than buggy. If you look at BudyListFWindow.uc at the close function you can see how I do it:

Code: Select all

    root.Console.bQuickKeyEnable = False;
    bLeaveOnScreen = False;
    ClientArea.Close(True);
    Super.Close(bByParent);
Those are the important bits.
irc.globalgamers.net #uscript
http://irc.lc/globalgamers/uscript
Spectra
Masterful
Posts: 542
Joined: Tue Jan 22, 2013 5:23 pm
Personal rank: Nullified!
Location: (X) Unable To Locate....

Re: Umenu tutorial?

Post by Spectra »

Hey ~V~, can you teach how to add Combo Control in the Mod menu?? And also the settings??
Like If I select the first option, then this should also affect the settings of Mutator class, right?? How to do that?? Some sort of If conditions in Notify() function??
~V~
Average
Posts: 39
Joined: Thu Dec 13, 2012 5:13 am

Re: Umenu tutorial?

Post by ~V~ »

Here are some snippets from the name colour combo in XConsole. I tried to clean it up a bit and put in some comments. It's not from the mod menu, but you only have to add it to the client window in your mod menu code. Not quite sure what you mean by affect the Mutator class - it will affect whatever you tell it to:

Code: Select all

// Declare our combo
var UWindowComboControl NameCombo;

// Create a struct to hold our colours:
struct Colours{
    var string Name;
    var color Value;
};

// Make an arrary of 20 of them
var config colours Colour[20];

Code: Select all

    // The following could go in Created() or where you find convenient that is called from Created():
    // Set up the combo
    NameCombo = UWindowComboControl(CreateControl(class'UWindowComboControl', CCXOffset, CCYOffset, ComboWidth, 1));
    NameCombo.SetText(NameText);
    NameCombo.SetFont(F_Normal);
    NameCombo.SetEditable(False);
    NameCombo.Align = TA_Left;
    NameCombo.SetHelpText(NameHelpText);

    // Add some values into it from the Colours struct:
    for (i=0; i<20 && Colour[i].Name!=""; i++)
        NameCombo.AddItem(Colour[i].Name);

    NameCombo.bAlwaysBehind=true;

Code: Select all

// What happens when the combo is changed
function Notify(UWindowDialogControl C, byte E)
{
     // Check that this isn't triggered when combo is first created
    // bCreated is set to True at the end of the Created() function.
    if (!bCreated) return;

    switch(E)
    {   
        case DE_Change:
            switch(C)
            {   
                // If Name Combo has been changed then call a function
                 case NameCombo:NameChanged();break;
            }
     }
    Super.Notify(C, E);
}

final function NameChanged()
{
     // GetSelectedIndex() tells us the index number of the selection. It returns a number which is used to map the colour
     // in the Colours struct: Colour[index].Value which is a color in the form (r=N1, g=N2, b=N3). N1,2,3 are byte values.
    TeamNameColour = NameCombo.GetSelectedIndex();
    
    class'TeamSayMessagePlus'.default.GreenColor = Colour[TeamNameColour].Value;
    
    // Save our new setting
    saveconfig();
}
Hope this helps you
irc.globalgamers.net #uscript
http://irc.lc/globalgamers/uscript
Post Reply