Results 1 to 10 of 10

Thread: Close menu

  1. #1
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts

    Close menu

    Hi,

    I made a small pop-up menu on the center of the screen. And my question: is it any function what closes the menuDef if I click the outside of the menu?

    Thanks the answers!

  2. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by randall View Post
    Hi,

    I made a small pop-up menu on the center of the screen. And my question: is it any function what closes the menuDef if I click the outside of the menu?

    Thanks the answers!
    Answering the question specifically: no, there is no engine function to close a MenuDef{} if you click outside its rectangle. The closest you will come to this is to close the popup by using the Escape button:

    Code:
    		onEsc 
    		{
    			close <nameofmenu>;
    		}
    However, having answered that quesiton specifically, if you don't want to use the escape button to manually close a popup, and insist on using a mouse click, simply place itemDef{} all around the center safe area (= the area of the menu which will be drawn no matter what the resolution or aspect ratio is) where the rectangle is limited to the boundaries of the popup only. Then, have a scriptmenureponse in the action{} and monitor it in _menus.gsc to close the menu when detected.

    This wouldn't work for my pop menus as I draw them full screen (640x480) and simply have the background smaller so it "looks" like a smaller menu. But, if you are sizing your pop menu much smaller than the center safe area, then this could work for you.

  3. The Following 2 Users Say Thank You to Tally For This Useful Post:

    kung foo man (4th June 2013),randall (3rd June 2013)

  4. #3
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    Sadly the mouseclick only works the inside the menuDef, so it's not solution to place a fullscreen-button behind the other itemDefs. (i tried this at first )

    EDIT: Ok i solved, i opened an other menuDef in the background. Thanks Tally the rapid help!
    Last edited by randall; 3rd June 2013 at 17:21.

  5. #4
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    check out rfactory (google it)

    its called "outofboundsclick" and it is an attribute in your menuDef, similar used like popup

  6. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (5th June 2013)

  7. #5
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    check out rfactory (google it)

    its called "outofboundsclick" and it is an attribute in your menuDef, similar used like popup
    You have to be careful referencing Quake 3 items. The COD2 engine is not a Quake 3 engine. It has only 30% legacy code from the engine they used for COD1 (which was a heavily modified Team Arena UberTools engine) , but the other 70% is proprietary, built from the ground up, and developed in-house by Infinity Ward themselves. The menu system is part of that legacy code, but it is heavily modified, and many many items from their COD1 engine don't work any more.

    Now, I'm not saying outofboundsclick wont work - I have no idea because I haven't tried it - but looking at a resource site like rfactory will be very much a hit-and-miss affair.
    Last edited by Tally; 5th June 2013 at 11:54.

  8. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (5th June 2013)

  9. #6
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Tally View Post
    but looking at a resource site like rfactory will be very much a hit-and-miss affair
    you are right about that, but many ppl in here are asking now things about ui-modding
    and rfactory is the best start-off of basic ui-scripting i have found in the web
    there are good explanations about itemDef's, rects, alignments and ui_scripts
    in my eyes its better to look around there for some hours by yourself (not you Tally, i mean the beginners :] ) instead of hunting your ui-mod-wishes with closed eyes.

    just look around there and compare what is done in cod2 and youll know what is possible

    http://rfactory.org/

    there are 2 sites, the tutorial one and the documentary one


    but btw, i would also go with Tally, do a menuDef with 640x480 and a menuDef with 640x480 that will close when clicked and just draw your menu above the close-itemDef

  10. #7
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    you are right about that, but many ppl in here are asking now things about ui-modding
    and rfactory is the best start-off of basic ui-scripting i have found in the web
    there are good explanations about itemDef's, rects, alignments and ui_scripts
    in my eyes its better to look around there for some hours by yourself (not you Tally, i mean the beginners :] ) instead of hunting your ui-mod-wishes with closed eyes.

    just look around there and compare what is done in cod2 and youll know what is possible

    http://rfactory.org/

    there are 2 sites, the tutorial one and the documentary one


    but btw, i would also go with Tally, do a menuDef with 640x480 and a menuDef with 640x480 that will close when clicked and just draw your menu above the close-itemDef
    I did have a look around rfactory. I know a fair bit about Quake UI modding (I used to mod for Quake 2 before I became a COD modder), but I still learnt some stuff from it I didn't know before (like what "decoration" is - it stops things like roll over blink on rectangles). So, it is a useful resource site if you know what you're doing. But I have never forgotten the hours and hours of frustration when COD2 came out trying to do things in the UI system we used to do with COD1 (like animated shaders - waving team flags on the menus were one of my specialities in COD1) only to find you couldn't do them any more. I'm just trying to save people that pain. Just be aware that if you can't get it to work first time, chances are it wont ever work, so move on.
    Last edited by Tally; 5th June 2013 at 12:32.

  11. #8
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Tally View Post
    But I have never forgotten the hours and hours of frustration when COD2 came out trying to do things in the UI system we used to do with COD1
    Hell yeah... i did all of my menus thsi way, and also almost everything from rfactory/cod4 and the macro testing... it was such a pain... and as you know, i didnt know about that menu-syntax-error were printed in the console.log


    Happy scripting

  12. #9
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Hm, why you look in console.log for menu-errors? They should be all written in the developer-console (Shift+Console)?
    timescale 0.01

  13. #10
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by kung foo man View Post
    Hm, why you look in console.log for menu-errors? They should be all written in the developer-console (Shift+Console)?
    Because you don't have to run your server in developer mode in order to see errors in log files. For example, testing on a dedicated server - which I do most of the time because it reveals things a Listen server wont reveal - doesn't allow for developer mode. But you can still see errors in log files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •