Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

alias/bind grouping

By: a guest on Aug 11th, 2010  |  syntax: None  |  size: 4.57 KB  |  hits: 160  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //---------- eg 1 -------------------------
  2.  
  3. seta _GL "weapon 4;vstr _zFireOff"
  4. seta _RL "weapon 5;;vstr _zFireOff"
  5. seta _LG "weapon 6;vstr _zFireOn"              
  6. seta _RG "weapon 7;vstr _zFireOff"
  7.  
  8. alias +zfire "+attack;vstr _x5"  //sets crosshair style (_x5).
  9. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  10.  
  11. seta _zFireOn "bind mouse1 +zfire"
  12. seta _zFireOff "bind mouse1 +attack"
  13. //***********  the above works, BUT if you swap weapons as u hold fire -zfire doesn't trigger so you get stuck with the _cx5 crosshair
  14.  
  15.  
  16. //------------  eg 2----------------------
  17.  
  18.  
  19.  
  20. seta _GL "weapon 4;vstr _zFireOff"
  21. seta _RL "weapon 5;;vstr _zFireOff"
  22. seta _LG "weapon 6;vstr _zFireOn"              
  23. seta _RG "weapon 7;vstr _zFireOff"
  24.  
  25. alias +zfire "+attack;vstr _x5"  //sets crosshair style (_x5).
  26. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  27.  
  28. seta _zFireOn "bind mouse1 +zfire"
  29. seta _zFireOff "-zfire;bind mouse1 +attack"
  30.  
  31. //********the above version solves that problem, but now if you hold fire on lg, then change to another weapon (gaunt) then that will not fire until you let go of fire then press it again
  32.  
  33. //-----------  eg 3 --------------------
  34. bind MOUSE1 "+zfire"
  35.  
  36. seta _GL "weapon 4;vstr _zFireOff"
  37. seta _RL "weapon 5;;vstr _zFireOff"
  38. seta _LG "weapon 6;vstr _zFireOn"              
  39. seta _RG "weapon 7;vstr _zFireOff"
  40.  
  41. alias +zfire "+attack;vstr _x5"  //sets crosshair style (_x5).
  42. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  43.  
  44. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  45.  
  46. seta _zFireOn "alias +zfire "+attack;vstr _x5"  // THIS LINE DOES NOT WORK AS U THINK
  47. seta _zFireOff "alias +zfire +attack"
  48.  
  49.  
  50. //************* in the above version mouse1 is ONLY ever bound o +zfire
  51. The theory is when you change weapons now , the contents of +zfire will change, but it will never get confused changign weapons, as it will always do -zfire when u let go now, insted of mising that out and doing -attack instead as the mouse was rebound to +attack, thus missing out the other parts you may want to revert that were part of -zfire.
  52.  
  53. but it fails to perform the desired crosshair change as _zFireOn only actually sets the alias +zfire to "+attack" then  vstr _x5 runs a single time afterwards, not as part of an alias. as there is no grouping
  54.  
  55. //------------- eg 4------------------
  56.  
  57.  
  58. seta _GL "weapon 4;vstr _zFireOff"
  59. seta _RL "weapon 5;;vstr _zFireOff"
  60. seta _LG "weapon 6;vstr _zFireOn"              
  61. seta _RG "weapon 7;vstr _zFireOff"
  62.  
  63. alias +zfire "+attack;vstr _x5"  //sets crosshair style (_x5).
  64. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  65.  
  66. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  67.  
  68. seta _zFireOn "cl_noprint 1;exec zfire.cfg;cl_noprint 0"
  69. seta _zFireOff "alias +zfire +attack"
  70.  
  71. //********    this final version works but only because we have a seperate .cfg file called zfire.cfg that contains only
  72.  
  73. alias +zfire "+attack;vstr _x5"
  74.  
  75. this seperate file method is the only way to either bind to more than one thing in a script, or script to chnge an alias to do more than one thing in a sript.
  76.  
  77. if we had a way of doing grouping like (  ) or  ' ' being different to " " or soemhting then everything could be nicely done in one file, with no hit on IO.
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. // ***** SOLUTION  *****
  86. //I made _zfireOn _zfireOff aliases just for the hell of it too:
  87.  
  88. seta _GL "weapon 4; _zFireOff"
  89. seta _RL "weapon 5; _zFireOff"
  90. seta _LG "weapon 6;_zFireOn"           
  91. seta _RG "weapon 7; _zFireOff"
  92.  
  93. seta _x1 "cg_crosshairSize 24;cg_drawCrosshair   6" // dot
  94. seta _x5 "cg_crosshairSize 42;cg_drawCrosshair   2" // fine cross 38
  95. seta _cxStyle "vstr _x1" //set DEFAULT crosshair
  96.  
  97.  
  98.  
  99. alias -zfire "-attack;vstr _cxStyle"  //changes back to current default crosshair (_cxStyle).
  100. alias zFirePt2 "+attack;vstr _x5" //2nd stage alias as otherwise you can't script more than one thing to change in an alias.
  101. alias _zFireOn "alias +zfire zFirePt2"
  102. alias _zFireOff "alias +zfire +attack;vstr _cxStyle" //now it will keep firing when u swap weapon, but give you back default crosshair
  103.  
  104. // it will stop firing when you let go of fire with any weapon, as it's still running +zfire, so it calls -zfire.
  105. // this should never get stuck, or leave you with the wrong crosshair
  106. // only time you can get wrong corsshair would be on non lg, hold fire, change to lg. as +zfire with a different crosshair wouldn't be called untill you let go then press again.