The Alias Carousel

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

Sun Jun 07, 2009 6:04 pm

  • I had a few aliases that became tiring to type out with colors and crap, so I built a simple carousel to take care of it for me. I built it with 4 aliases, but more can be added easily. Most of the documentation is inline, so here it is.

    Code: Select all
    //======================================================================
    // Alias Switcher V3 | Last Updated 6/7/09
    //======================================================================
    // Credits:
    // PlasmaSheep - Code
    // ---------------------------------------------------------------------
    // This script implements a player profile/alias carousel. -------------
    // ---------------------------------------------------------------------

    //Config
    //This is the message that shows when you have switched a profile
    alias is_switchmessage "echo ${nn_gmessagepre}Identity shifted! (Name is ^4$_cl_name^1)${nn_gmessagepos}"

    //Both Insert and Delete must be pressed to disengage safeties.
    alias +is_inslevel "bind DEL \"is_safeties\""
    alias -is_inslevel "unbind DEL"

    //This turns the safeties off, binds F12 to switch nicks, and then waits
    //15 seconds to turn safeties on again

    //These aliases prevents safeties being turned on twice (once when
    //carousel is executed, once when player model switches)
    alias is_safetyswitchm "$is_safetyswitch"
    alias is_safetyswitch "unbind F12; echo ${nn_gmessagepre}Safeties ^4on^1!${nn_gmessagepos}" //this will never be modified

    alias is_safeties "alias is_safetyswitchm \"is_safetyswitch\"; echo ${nn_gmessagepre}Safeties off!${nn_gmessagepos}; bind F12 \"$is_gateway\"; defer 15 \"is_safetyswitchm\";"

    //This points to whichever alias will be selected
    set is_gateway "is_shift1"

    //Now a list of aliases

    //Each of these first change settings (name, playermodel, skin),
    //then echo that the identity has changed, alias gateway to next
    //carousel stop, re-engage safeties (unbind F12), and prevent safeties
    //from being re-engaged by the defer process
    alias is_shift1 "name XYZ; playermodel models/player/insurrectionist.zym; is_switchmessage; alias is_gateway \"is_shift2\"; unbind F12; alias is_safetyswitchm \"\";"

    alias is_shift2 "name ZYX; playermodel models/player/nexus.zym; playerskin 0; is_switchmessage; alias is_gateway \"is_shift3\"; unbind F12;alias is_safetyswitchm \"\";"

    alias is_shift3 "name ABC; playermodel models/player/pyria.zym; is_switchmessage; alias is_gateway \"is_shift4\"; unbind F12;alias is_safetyswitchm \"\";"

    alias is_shift4 "name CBA; playermodel models/player/specop.zym; is_switchmessage;  alias is_gateway \"is_shift1\"; unbind F12;alias is_safetyswitchm \"\";"

    //Set the wheels in motion by binding INS
    bind INS "+is_inslevel"


    Here's how I set nn_gmessagepos and nn_gmessagepre elsewhere (I use the ninja pack):
    Code: Select all
    set nn_gmessagepre "^8-^7=^1["
    set nn_gmessagepos "^1]^7=^8-"

    Put those in the top of the file if you want to use those.

    Installation
    Save it as is_identityswitcher.cfg in your nexuiz data folder (~./nexuiz/data on *nix). Add this line to autoexec.cfg, also in the data folder:
    Code: Select all
    exec is_identityswitcher.cfg

    It will load automatically every time you start nexuiz.

    Use
    Press ins+del together to disengage the safety mechanism. You now have 15 seconds to press F12 before the safeties re-engage. Pressing F12 will execute is_shift1, the first carousel stop. Disengage safeties again and press F12 again, you will be at is_shift2, the second carousel stop. The stops modify both name and player model. This only has two stops, but more can be added if you like aliases.

    *Update v2*
    Changes:
    You can switch profiles while unconnected (dur dur dur): "is_nextprofile" in console.
    Message shown when switching displays new name.
    Message shown when switching is stored in an alias.
    Carousel now picks up where it left off, even if you restart nexuiz.

    *Updates v3*
    Changes:
    The "safeties on" message appears only if the time has run out and no shift has occurred. Before, it was when time has run out with or without an identity switch.
    Last edited by Roanoke on Mon Jun 08, 2009 3:17 am, edited 8 times in total.
    Roanoke
    Advanced member
     
    Posts: 96
    Joined: Fri Dec 26, 2008 2:32 am
    Location: Camping mortar spawn

Sun Jun 07, 2009 8:02 pm

  • The name alias switcher confused me off at first. I now understand it's a more of an Identity or 'Player Profile' switcher.

    If it's a carousel, you should add more identities as an example because when there are just 2 shown, it's still unknown to the user the exact functionality.

    Otherwise, nice config, well organized and I like that you made use of message formatters as variables.
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Sun Jun 07, 2009 9:04 pm

  • Added two more aliases. The only problem is that the carousel resets each time nexuiz starts up.
    Roanoke
    Advanced member
     
    Posts: 96
    Joined: Fri Dec 26, 2008 2:32 am
    Location: Camping mortar spawn



Return to Nexuiz - General Discussion




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest