2 or more files.

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

Postby shaggy » Fri May 11, 2007 8:22 am

I just thought i'd let you know what i mean is can i make like 2 files and use it a almost a nav page?

I have tryed but i cant seem to get it to work!
shaggy
Alien trapper
 
Posts: 419
Joined: Tue Apr 03, 2007 6:12 am

Postby Blµb » Fri May 11, 2007 8:35 am

I'll copy some text I wrote for my site I might upload somewhere some time if I get more stuff for it...
This should explain some ways of having `heaps of binds and aliases'

I'd just add a link, but it's on my local machine so it'd only work when I'm online

If you find any mistakes, tell, if you find any HTML tags left in the text... then ignore them...

Advanced 力exuiz Configurations

There are enough texts about basic configuration files for 力 out there anyway, so I'll only cover the more advanced parts.

Multiple configurations
Multiple files
The most basic method of having multiple configurations, multiple binds on one key, is to use multiple files, and to make one or more keys execute the different configurations.
-- autoexec.cfg
Code: Select all
      bind F11 "exec bindmap1.cfg"
      bind F12 "exec bindmap2.cfg"

-- bindmap1.cfg
Code: Select all
      bind A "say This is map 1, key A"
      bind B "say This is map 1, key B"

-- bindmap2.cfg
Code: Select all
      bind A "say This is map TWO, key A"
      bind B "say This is map TWO, key B"


Bindmaps
Bindmaps are something serverownsers like to screw around with a lot... so forget them :D I don't use them and don't know how they work, and I don't care.
Variable-rotation / Multi-content-file
There are ways to have different configurations stored in one file and changing them on the fly.
The reload-myself configuration
This is the most beautiful way in my opinion, since it improves readability of the configuration file a lot. You have multiple bind commands in one file, all prefixed with their `map name'.
(eg.: [$tm_ctf bind a b] or [$tm_kh bind a b])
-- messages.cfg - contains the aliases for all team messages
Code: Select all
    alias nocmd // do not execute whatever command
    alias docmd "$*" // execute the command - [b]unfortunately[/b] you [b]cannot[/b] provide arguments to `inner' commands
    set tmm_gen docmd // general binds (standard)
    set tmm_ctf nocmd
    set tmm_kh nocmd

    // Command to set no-mode, and to echo out the mode `menu'
    alias mode_none "set tmm_gen nocmd; set tmm_ctf nocmd; set tmm_kh nocmd; set mm_gen O; set mm_ctf O; set mm_kh O"
    alias mode_echo "echo ^1---------------------------; echo $mm_gen General binds; echo $mm_ctf CTF binds; echo $mm_kh KeyHunt binds"
   
    // The MODES cycle
    alias mode_gen "mode_none; set tmm_gen docmd; set mm_gen >; mode_echo; alias mode_next mode_ctf; alias mode_prev mode_kh"
    alias mode_ctf "mode_none; set tmm_ctf docmd; set mm_ctf >; mode_echo; alias mode_next mode_kh;  alias mode_prev mode_gen"
    alias mode_kh  "mode_none; set tmm_kh  docmd; set mm_kh >;  mode_echo; alias mode_next mode_gen; alias mode_prev mode_ctf"
   
    // initial mode_next and modee_prev
    alias mode_next mode_ctf
    alias mode_prev mode_kh

    set msg_loc "^6(@^7%l^6)"
    set msg_team_info "^1%h^7:^2%a^7:^4<^7%w^4>"
   
    alias msg_hello "say Hello ^5/ ^7Good Luck and Have Fun!"
    alias msg_cya   "say Cya ^5 / ^7Balance the teams please!"
   
    alias gen_help "say_team help me!^8\n$msg_loc"
    alias ctf_attacking "say_team ^7[^1ATK^7] ^5Attacking^8\n$msg_team_info^8\n$msg_loc"
    alias ctf_defending "say_team ^7[^2DEF^7] ^5Defending^8\n$msg_team_info^8\n$msg_loc"
    alias kh_attacking "say_team ^5Attacking Key Carrier^8s\n$msg_team_info^8\n$msg_loc"
    alias kh_defending "say_team ^5Defending Key Carrier^8s\n$msg_team_info^8\n$msg_loc"

-- msgkb.cfg - contains the keyboard-mapping
Code: Select all
    // NEXT / PREV mode KEYS
    bind UPARROW "mode_prev; exec teamkb.cfg" // EXEC TEAMKB.CFG IS IMPORTANT HERE (could be in the aliases though)
    bind DOWNARROW "mode_next; exec teamkb.cfg"
   
    // General binds, note: you cannot use [$tmm_gen bind KP_1 say_team something!], the reason is given on top of the kb file
    $tmm_gen bind KP_1 msg_hello
    $tmm_gen bind KP_2 msg_cya
   
    // CTF binds
    $tmm_ctf bind KP_1 ctf_attacking
    $tmm_ctf bind KP_2 ctf_defending
   
    // KeyHunt binds
    $tmm_kh bind KP_1 kh_attacking
    $tmm_kh bind KP_2 kh_defending

See some screenshots of this system: (only work when I'm online:)
Shot 1
Shot 2
Shot 3

The variable-aliases way
With this way you make aliases for each message/action and use the same suffix for each alias which belongs to the same map. <b>This is a per-key system!</b>

-- messages.cfg - A PER-KEY map!
Code: Select all
    set msg_loc "^6(@^7%l^6)"
    set msg_team_info "^1%h^7:^2%a^7:^4&lt;^7%w^4&gt;"
   
    alias KP_1_msg "say Hello ^5/ ^7Good Luck and Have Fun!"
    alias KP_2_msg   "say Cya ^5 / ^7Balance the teams please!"
   
    alias KP_1_ctf "say_team ^7[^1ATK^7] ^5Attacking^8\n$msg_team_info^8\n$msg_loc"
    alias KP_2_ctf "say_team ^7[^2DEF^7] ^5Defending^8\n$msg_team_info^8\n$msg_loc"
    alias KP_3_ctf "say_team ^7SOMETHING YOU SAY IN CTF BUT DON'T WANT A KEY FOR IN KEYHUNT"
    alias KP_1_kh "say_team ^5Attacking Key Carrier^8s\n$msg_team_info^8\n$msg_loc"
    alias KP_2_kh "say_team ^5Defending Key Carrier^8s\n$msg_team_info^8\n$msg_loc"
    alias KP_3_kh // an empty key to avoid error messages when pressing it
    alias KP_4_ctf "echo EMPTY KEY! CURRENT MODE: $$bind_mode"
    alias KP_4_kh  "say_team KEYS ARE FUN"
   
   
    set bind_mode msg // use the msg-suffixed binds
   
    // The MODES cycle
    alias mode_msg "set bind_mode msg; echo GENERAL binds; alias mode_next mode_ctf; alias mode_prev mode_kh"
    alias mode_ctf "set bind_mode ctf; echo CTF binds;     alias mode_next mode_kh;  alias mode_prev mode_gen"
    alias mode_kh  "set bind_mode kh;  echo KeyHunt binds; alias mode_next mode_gen; alias mode_prev mode_ctf"
   
    // initial mode_next and modee_prev
    alias mode_next mode_ctf
    alias mode_prev mode_kh
    // NEXT / PREV mode KEYS
    bind UPARROW "mode_prev" // NOT reloading the config this time!
    bind DOWNARROW "mode_next"
   
    // Binds, use $$ to avoid variable-resolution
    bind KP_1 KP_1_$$bind_mode
    bind KP_2 KP_2_$$bind_mode
Blµb
Alien trapper
 
Posts: 277
Joined: Thu Mar 29, 2007 1:49 pm

Postby KadaverJack » Fri May 11, 2007 8:46 am

@Blµb: you might wanna try in_bind and in_bindmap.
That way you can keep all your binds in one config file and don't need to unbind keys that you don't need in a specific configuration...
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby Blµb » Fri May 11, 2007 8:52 am

KadaverJack wrote:@Blµb: you might wanna try in_bind and in_bindmap.
That way you can keep all your binds in one config file and don't need to unbind keys that you don't need in a specific configuration...

those bind maps are screwed around with on the RBI server :P
btw. i mentioned bindmaps up there anyway
Blµb
Alien trapper
 
Posts: 277
Joined: Thu Mar 29, 2007 1:49 pm

Previous

Return to Nexuiz - General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron