Post: Creating Variables using cfg's. Good or a Bad idea
11-01-2011, 03:02 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hi Guys

Wish I could change the title as I meet CONSTANTS not variables.

Is there any downside to creating your controller defaults like this

set RSHLDR "bind BUTTON_RSHLDR "+attack"
set LSHLDR "bind BUTTON_LSHLDR +speed_throw"
set RTRIG "bind BUTTON_RTRIG +frag"
set LTRIG "bind BUTTON_LTRIG +smoke"
set RSTICK "bind BUTTON_RSTICK +stance"
set LSTICK "bind BUTTON_LSTICK +breath_sprint"
set START_BUTTON "bind BUTTON_START togglemenu"
set A_BUTTON "bind BUTTON_A +gostand"
set B_BUTTON "bind BUTTON_B +melee"
set X_BUTTON "bind BUTTON_X +usereload"
set Y_BUTTON "bind BUTTON_Y weapnext"
set GO_UP "bind DPAD_UP vstr StartMenu"
set GO_DOWN "bind DPAD_DOWN +actionslot 2"
set GO_LEFT "bind DPAD_LEFT +actionslot 3"
set GO_RIGHT "bind DPAD_RIGHT +actionslot 4"

then for example I have to call all the commands like this
set SET_BUTTONS "vstr RSHLDR;vstr LSHLDR;vstr RTRIG;vstr LTRIG;vstr RSTICK;vstr LSTICK;vstr START_BUTTON;vstr A_BUTTON;vstr B_BUTTON;vstr X_BUTTON;vstr Y_BUTTON;vstr GO_UP;vstr GO_DOWN;vstr GO_LEFT;vstr GO_RIGHT";
vstr SET_BUTTONS

This may seem long winded but it makes it very easy in all other commands to set button actions back to there default eg

set whatever "bind BUTTON_A vstr superJump; bind BUTTON_B vstr ExitMenu"

Then ExitMenu could be just set ExitMenu"Exit_Menu;vstr A_BUTTON;vstr BUTTON"

You could even make make smalll combo's of regular performed tasks

set resetAB "vstr A_BUTTON;vstr B_BUTTON";

then exit could be set ExitMenu "Exit_Menu;vstr resetAB"

I'm finding I am constantly having to reset buttons back to their default values, another positive is that it cuts down on coding errors by resetting to the wrong default.

Be interested in your thoughts. Especially if there will be a massive performance loss. I have tested it and in practice it works fine.

Thanks in advance.

---------- Post added at 03:02 PM ---------- Previous post was at 02:54 PM ----------

Sorry just realised I have posted this in the wrong Forum, rather than create a duplicate please can a mod move this to the correct section. Sorry my BAD :(
(adsbygoogle = window.adsbygoogle || []).push({});
11-01-2011, 03:17 PM #2
just ****in get on with it
11-01-2011, 03:35 PM #3
Originally posted by joolsno1killa View Post
just ****in get on with it


Judging by your previous posts you clearly have no idea how to develop properly. I have 10 years experience as a web developer and system designer and the way you write your code can have a huge impact on performance and maintainability. Look at all the decent patches they are well written and bug free then there's the lechers full of bugs and never work how you expect. You my friend will just be ignored.
11-01-2011, 04:15 PM #4
.DeadlyMoDz25
Who’s Jim Erased?
Originally posted by Powder77 View Post
Judging by your previous posts you clearly have no idea how to develop properly. I have 10 years experience as a web developer and system designer and the way you write your code can have a huge impact on performance and maintainability. Look at all the decent patches they are well written and bug free then there's the lechers full of bugs and never work how you expect. You my friend will just be ignored.


If your just trying to your, lets say, A instead of BUTTON_A like for your menu, you could just do this
    set SetButtons "bind BUTTON_LTRIG vstr L2;bind BUTTON_RTRIG vstr R2;bind BUTTON_LSHLDR vstr L1;bind BUTTON_RSHLDR vstr R1;bind DPAD_UP vstr UP;bind DPAD_DOWN vstr DOWN;bind DPAD_LEFT vstr LEFT;bind DPAD_RIGHT vstr RIGHT;bind BUTTON_RSTICK vstr R3;bind BUTTON_LSTICK vstr L3;bind BUTTON_Y vstr Y;bind BUTTON_A vstr A;bind BUTTON_B vstr B;bind BUTTON_X vstr X;"


then in the menu instead of using something like this
    set Main1 "^2==^7Essentials_Menu^2==;bind BUTTON_A vstr Menu1;bind DPAD_DOWN vstr Main2;bind DPAD_UP vstr Main23;bind BUTTON_B vstr Exit"


You Could Do This
    set Main1 "^2==^7Essentials_Menu^2==;set A vstr Menu1;set DOWN vstr Main2;set UP vstr Main23;set B vstr Exit"


in your exit menu code you have to put the buttons back to normal just do this
    set ResetButtons "bind BUTTON_RSHLDR +attack;bind BUTTON_LSHLDR +speed_throw;bind BUTTON_RTRIG +frag;bind BUTTON_LTRIG +smoke;bind BUTTON_RSTICK +stance;bind BUTTON_LSTICK +breath_sprint;bind BUTTON_START togglemenu;set gpad_button_rstick_deflect_max 1;set gpad_button_lstick_deflect_max 1;bind BUTTON_A +gostand;bind BUTTON_B +melee;bind BUTTON_X +usereload;bind BUTTON_Y weapnext;bind DPAD_UP vstr <your menu open>;bind DPAD_DOWN +actionslot 2;bind DPAD_LEFT +actionslot 3;bind DPAD_RIGHT +actionslot 4;"
11-01-2011, 05:23 PM #5
Originally posted by .DeadlyMoDz25 View Post
If your just trying to your, lets say, A instead of BUTTON_A like for your menu, you could just do this
    set SetButtons "bind BUTTON_LTRIG vstr L2;bind BUTTON_RTRIG vstr R2;bind BUTTON_LSHLDR vstr L1;bind BUTTON_RSHLDR vstr R1;bind DPAD_UP vstr UP;bind DPAD_DOWN vstr DOWN;bind DPAD_LEFT vstr LEFT;bind DPAD_RIGHT vstr RIGHT;bind BUTTON_RSTICK vstr R3;bind BUTTON_LSTICK vstr L3;bind BUTTON_Y vstr Y;bind BUTTON_A vstr A;bind BUTTON_B vstr B;bind BUTTON_X vstr X;"


then in the menu instead of using something like this
    set Main1 "^2==^7Essentials_Menu^2==;bind BUTTON_A vstr Menu1;bind DPAD_DOWN vstr Main2;bind DPAD_UP vstr Main23;bind BUTTON_B vstr Exit"


You Could Do This
    set Main1 "^2==^7Essentials_Menu^2==;set A vstr Menu1;set DOWN vstr Main2;set UP vstr Main23;set B vstr Exit"


in your exit menu code you have to put the buttons back to normal just do this
    set ResetButtons "bind BUTTON_RSHLDR +attack;bind BUTTON_LSHLDR +speed_throw;bind BUTTON_RTRIG +frag;bind BUTTON_LTRIG +smoke;bind BUTTON_RSTICK +stance;bind BUTTON_LSTICK +breath_sprint;bind BUTTON_START togglemenu;set gpad_button_rstick_deflect_max 1;set gpad_button_lstick_deflect_max 1;bind BUTTON_A +gostand;bind BUTTON_B +melee;bind BUTTON_X +usereload;bind BUTTON_Y weapnext;bind DPAD_UP vstr <your menu open>;bind DPAD_DOWN +actionslot 2;bind DPAD_LEFT +actionslot 3;bind DPAD_RIGHT +actionslot 4;"



Thanks for that all makes sense and certain cuts down on the code, especially if it's a large menu. Just one question, "bind BUTTON_LTRIG vstr L2" is L2 already a built in predefined command, or like I think your saying I still have to define it but why use a longer name like I have done. By the way love your patches have learned so much from them, will be sure to give credit, even though have no plans to release a patch to the public.

Also is there any performance issue doing it this way, as never seen many menu's built this way. But al new to MW2 patches just doing it for a bit of fun.

You have a good knowledge of this forum, I am thinking of building a "Noob" friendly web based menu creator, not one that requires XML, user just selects Main and sub headings from a form that expands using ajax as they add more items, and select the command they wish to run(Full credits would be given). Would this be a good idea of a bad one seeing it would make it so easy to create "Noob" menu. Don't want to piss people off as there's a lot of politics on this forum. Could even work on decompressing and re compressing the patch and giving them the actually fully working patch.
11-01-2011, 08:11 PM #6
.DeadlyMoDz25
Who’s Jim Erased?
Originally posted by Powder77 View Post
Thanks for that all makes sense and certain cuts down on the code, especially if it's a large menu. Just one question, "bind BUTTON_LTRIG vstr L2" is L2 already a built in predefined command, or like I think your saying I still have to define it but why use a longer name like I have done. By the way love your patches have learned so much from them, will be sure to give credit, even though have no plans to release a patch to the public.

Also is there any performance issue doing it this way, as never seen many menu's built this way. But al new to MW2 patches just doing it for a bit of fun.

You have a good knowledge of this forum, I am thinking of building a "Noob" friendly web based menu creator, not one that requires XML, user just selects Main and sub headings from a form that expands using ajax as they add more items, and select the command they wish to run(Full credits would be given). Would this be a good idea of a bad one seeing it would make it so easy to create "Noob" menu. Don't want to piss people off as there's a lot of politics on this forum. Could even work on decompressing and re compressing the patch and giving them the actually fully working patch.


i dont think L2 is a command already and no there will be no performance issue

you should make a program like the old 1.11 patch making programs where u select what u want in it, and the codes are already programed into the creator, ill pm u to see what we can get started Happy

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo