Core Concept
Aliases in CS2 configs work by creating command shortcuts that can be redefined at runtime. The CSAFAP framework uses this to create “state machines” where pressing the same key performs different actions based on the current state.Hotkey System Architecture
The framework establishes four main hotkey systems, each with a two-phase binding cycle:T-Side Line-up Wheel
Phase 1: Setup and Open (csafap/logic.cfg:35-36)- Initial bind:
T_hotkey1sets+T_actionand-T_actionto wheel phase 1 - User presses key →
+T_wheel_1executes (loads labels, sets up wheel) - User releases key →
-T_wheel_1executes (equips smoke, zeros view, opens radio, rebinds to phase 2) - User hovers over option and presses key again →
+T_wheel_2executes (loads commands, sets sensitivity) - User releases key →
-T_wheel_2executes (closes radio, rebinds back to phase 1, resets everything)
CT-Side Line-up Wheel
Identical architecture to T-side (csafap/logic.cfg:30-33):Movement/Crosshair Wheel
Follows the same two-phase pattern (csafap/logic.cfg:40-43):Map Selection Wheel
Simpler two-phase system (csafap/logic.cfg:24-27):Initialization Sequence
On config load, all wheels are initialized to their phase 1 state (csafap/logic.cfg:19-22):Advanced Pattern: Automatic Side Detection
The framework includes an automatic side detection system that wraps both CT and T actions (csafap/logic.cfg:46-48):Sensitivity Reset Pattern
Auto line-ups require temporary sensitivity changes. The framework uses mouse bind aliasing to auto-reset (csafap/logic.cfg:62-66):- After auto line-up activates,
sens_resetrebinds mouse axes to reset functions - On first mouse movement,
reset_mx/reset_myrestore sensitivity and rebind tooriginal_mx/original_my original_mx/original_myrestore default mouse bindings- Player can now aim normally again
Jumpthrow Reset Pattern
W-Jumpthrow requires delayed-forward cleanup (csafap/logic.cfg:77-78):
Key Principles
- State Toggle: Each hotkey system toggles between exactly two states
- Phase Separation: Labels load in phase 1, commands execute in phase 2
- Self-Rebinding: The
-(release) action of one phase rebinds the key to the next phase - Circular Flow: Phase 2 always returns to phase 1, creating a loop
- Context Preservation: Map-specific aliases (
map_CT_labels,map_T_labels) persist across phase transitions
Debugging Tips
- Use
alias <name>in console to check current definition - Check which phase you’re in by examining
+CT_action,+T_action, etc. - If stuck, manually execute the
_hotkey1alias to reset to phase 1 - Radio wheel issues often come from interrupted phase transitions (pressing ESC mid-cycle)
Performance Considerations
The framework loads aliases on-demand by usingexec statements in phase transitions. This keeps memory usage low and prevents the alias limit crashes that plagued earlier versions (see csafap/logic.cfg:255).