ZeroKnight's Game Functions/Power-User Binds

ZeroKnight's Game Functions/Power-User Binds

Postby ZeroKnight » 20 Sep 2011, 22:01

Hello once again, I've written a few handy little cubescript functions to add a bit of ease of use to Red Eclipse. I've only got a few right now, but I'm always writing more as I think of something. Basically, what most of these are, are quick and easy ways, or helpful aliases to make doing things in RE a bit easier.

Just add these to a section in your autoexec file to use them!


CubeScript Extensions/References

In-Console Color Reference

For those who like adding colors in their scripts, but sometimes forget the corressponding number or letter, whenever you type the command "colors" in the console, this simple little function will print (in the corressponding color) both number and color, codes for adding color. Remember, the numbers and letters are freely interchangeable with both Form Feed (Ctrl+L) and ^f.
Here's a tip. There's actually a LOT of color possibilities by using the letters. There's more than what are below, on top of darker colors obtainable by using a capitol letter ;)

As quin also mentioned, if you use [] containers, you can use Hexadecimal coloring! Ex: ^f[0x00FF00]

{l Code}: {l Select All Code}
colors = [
    echo "By Number: 00 11 22 33 44 55 66 77 88 99"
    echo "By Letter: ^faa^fAA ^fbb^fBB ^fcc ^fCC ^fdd ^fee ^fff ^fgg^fGG ^fkk ^fmm ^fnn ^foo^fOO ^fpp ^frr^fRR ^fvv ^fww ^fyy^fYY"
]



Action Reference

Similar to the Color reference, but with all the player actions.

{l Code}: {l Select All Code}
actions = [
    echo "action 0 - primary"
    echo "action 1 - secondary"
    echo "action 2 - reload"
    echo "action 3 - ^"action^" (pick up, etc.)"
    echo "action 4 - jump"
    echo "action 5 - walk"
    echo "action 6 - crouch"
    echo "action 7 - parkour/melee"
    echo "action 8 - drop weapon"
]


Check if Alias Exists

Useful function for conditions. Will return 1 if the alias exists, and 0 if it does not.

{l Code}: {l Select All Code}
aliasexist = [ if (strcmp "" (getalias $arg1)) [ 0 ] [ 1 ] ]

Example:
if (aliasexist foo) [ foo = "bar" ] [ echo "foo doesn't exist!" ]



Create Alias if it doesn't exist

Similar to the above function, only it also creates the alias if it doesn't exist.

{l Code}: {l Select All Code}
createifne = [if (strcmp "" (getalias $arg1)) [$arg1 = $arg2]]

Example:
createifne foo "bar" // If foo already exists, nothing will happen. If foo does not exist, it will be created with the value of "bar"



Power-User Binds

Quick and Easy Command Repetition

Instead of mashing ` then UP, then ENTER to repeat a command, there's a little-known feature of the CubeScript console called "history" which stores the exact commands you have used. With a creative alias and bind, we can press a single button to repeat the last command we used! (I bound it to backslash :P)

{l Code}: {l Select All Code}
alias lastcmd [history 1] // Last used command

bind BACKSLASH lastcmd



Zoom Level Reset

Snipe frequently? Have a simple bind that resets your scope to a medium, not to close, not to far zoom level. I bound mine to middle click. Easy to get to on the fly in the heat of battle ;)

{l Code}: {l Select All Code}
bind MOUSE3 [zoomlevel 3]

TIP: Add the following line to your autoexec to always have your zoomlevel reset when you start Red Eclipse!
zoomlevel 3



Admin Power-User Binds

Reset Bots

Simple function to "reset" the current bots. If you want their scores reset, or maybe you want to update their skill level after having modified the skill vars, instead of setting botbalance/offset to 0, and then resetting it by hand, this will do that for you with one command :)

{l Code}: {l Select All Code}
resetbots = [
    resetbots_botbalance = $botbalance
    resetbots_botoffset = $botoffset
    botbalance 0
    botoffset 0
    sleep 250 [
        botbalance $resetbots_botbalance
        botoffset $resetbots_botoffset
    ]
    sleep 500 [ say "^fyBots Reset!" ]
]



Kick/Ban with Reason message

Two aliases that kick or ban a user AND supplies a message for the target user, and everyone else on the server to see.

{l Code}: {l Select All Code}
alias kickuser [say (format "^foKick Reason: ^fy%1" $arg2); kick $arg1]
alias kickban [say (format "^f[0xFF0000]KickBan Reason: ^fy%1" $arg2); ban $arg1]

Syntax for both: [kickuser|kickban] <cn> "<Reason>"
* Reason MUST be in quotations



Warn Command

If you're like most Admins, you follow a warn>kick>ban style to handling offenses. Teamkilling is a common problem in Red Eclipse, and I find myself warning users about this a lot, so I made a bind with attentive colors that warn a user that they will face punishment for further intentional teamkilling.
This evolved into a way to warn users for a multitude of things, depending on the command arguments. Depending on the second arg, you can warn for different things easily!

{l Code}: {l Select All Code}
alias warn [
    cases $arg2 "tk" [
        warnreason = "TEAM-KILL"
        punishment = "^fokick ^fyor ^f[0xFF0000]ban"
    ] "th" [
        warnreason = "TEAM-HOP/UNBALANCE"
        punishment = "^foloss of team switching privileges (^fylimit^fo)"
    ] "sp" [
        warnreason = "SPAM"
        punishment = "^fokick ^fyor ^f[0xFF0000]ban"
    ] "ad" [
        warnreason = "ADVERTISE"
        punishment = "^fokick ^fyor ^f[0xFF0000]ban"
    ] "im" [
        warnreason = "IMPERSONATE PLAYERS"
        punishment = "^fokick ^fyor ^f[0xFF0000]ban"
    ]
    warnstr = (format "^fzry%1 ^fyDO NOT ^f[0xFF0000]%2. ^fyFailure to comply will result in a %3" (getclientname $arg1) $warnreason $punishment)
    say $warnstr
]


Syntax for use: warn <cn> <reason>
Example: "/warn 3 tk" will warn the play with client number 3 to not teamkill

The client number will automatically expand into the player's name, for typing convenience ;)



Convenience/Neat Functions

Easy Powerslide Bind

Powerslide with the press of a single button! Use it for a quick kick (hard to nail though!) or clever dodging, or even sliding underneath an incoming kick! *NOTE* Due to the way Cube2 handles keypresses, you will NEED to let go of your bound key, and re-press the Forward key in order to continue moving forward again. I cannot fix this, and neither will quin/eihrul, so don't ask. It would require a pretty sizable re-write to the control code

{l Code}: {l Select All Code}
powerslide = [ action 6; forward; forward ]

bind <KEY> powerslide



Easy Unbind
Instead of having to type bind <some key> "" to take the bind off of a key, add this alias to your autoexec to be able to simply use: unbind <some key>

{l Code}: {l Select All Code}
alias unbind [ bind $arg1 "" ]
alias uneditbind [ editbind $arg1 "" ]
alias unspecbind [ specbind $arg1 "" ]



Master Volume Buttons

Simply lets you increase or decrease the game's master volume with two bound keys. (Increments of 5)
If you want to use the Keypad + and - to do this, the keys are KP_PLUS and KP_MINUS

{l Code}: {l Select All Code}
// Functions:
mastervolUp = [mastervol (+ $mastervol 5)]
mastervolDown = [mastervol (- $mastervol 5)]

// Binds:
bind <some key> mastervolUp
bind <some key> mastervolDown



Radar Style Quick Swap

Something I discovered to be very useful is to switch between the Supernova Ring Radar (where it also measures distance) and the Corner Radar, to get a great idea where people are. The advantage is that you can keep the ring radar on most of the time, as it's easier to look at while in combat, but still be able to quickly switch to the Corner radar to really pinpoint someone.
This is best bound to a Mouse Key if you have extra buttons on your mouse, but that's just my opinion ;P

As it is written, the script will only switch between the Supernova Edition Ring Compass and the Corner Radar. However, it also allows for you to easily change this, if you know some CubeScript and want to make a full cycle instead :P Just play with the if parameters ^^

{l Code}: {l Select All Code}
swapRadarStyle = [ if (= $radarstyle 1) [radarstyle 3] [radarstyle 1] ]

bind <some key> swapRadarStyle



Quick Team Cycler
This handy little function will, at the press of the bound key, instantly cycle you to the next team, in the order: Alpha>Omega>Sigma>Kappa, and display a message as well. I would recommend binding it to PERIOD, as it's in easy reach, and you can still leave F7 as the team switch GUI for legacy purposes :) Anyway once again, just add this to your autoexec, and bind it to a key. It's a bit inconvenient outside of Multi, but you could probably make a hackish condition that checks for mutators and will cycle through an appropriate cases

{l Code}: {l Select All Code}
playerteam = ""
cycleteam = [
    cases $playerteam "alpha" [
        team omega; teamstr = "^frTeam Omega"
        playerteam = "omega"
    ] "omega" [
        team sigma; teamstr = "^fgTeam Sigma"
        playerteam = "sigma"
    ] "sigma" [
        team kappa; teamstr = "^fyTeam Kappa"
        playerteam = "kappa"
    ] "kappa" [
        team alpha; teamstr = "^fbTeam Alpha"
        playerteam = "alpha"
    ] () [
        team alpha; teamstr = "^fbTeam Alpha"
        playerteam = "alpha"
    ]
    if (> (strlen $teamstr) 0) [ echo ( format "^fyYou are now on:^fS %1" $teamstr ) ]

bind <KEY> cycleteam



Automatic IRC Join
Want to join an IRC channel in game every time you play Red Eclipse? Don't want to go through the GUI every time? Well, just add this to your autoexec:

{l Code}: {l Select All Code}
ircaddclient <network name> <network address> <port> <nick>
ircaddchan <network name> <channel>


Where "<network name>" is the name of the network without the "irc." or ".net" prefix/suffix. "<network address>" is the full address of the network, ie. irc.freenode.net. The rest should be obvious.


---------------------------------------------------------------------------------------------------------------------------------

Feel free to share any of yours!
Last edited by ZeroKnight on 15 Oct 2012, 02:06, edited 13 times in total.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Zero's Useful/Random Game Functions

Postby qreeves » 21 Sep 2011, 04:33

ZeroKnight {l Wrote}:Here's a tip. There's actually a LOT of color possibilities by using the letters. There's more than what are below, on top of darker colors obtainable by using a capitol letter ;)

You can colour with arbitrary colours of your own choosing too using "[]" :) - Eg. ^f[0xC02040]
Also of interest, you can embed icons into text using "()" - Eg. ^f(textures/progress)
Quinton "quin" Reeves | Lead Developer, Red Eclipse | http://redeclipse.net/ | http://www.facebook.com/redeclipse.net
User avatar
qreeves
 
Posts: 1294
Joined: 17 Mar 2011, 03:46
Location: Queensland, Australia

Re: Zero's Useful/Random Game Functions

Postby ZeroKnight » 22 Sep 2011, 17:56

...You sir, have just made my day. That's amazing!
New idea for Extended Compass, too!
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Zero's Useful/Random Game Functions

Postby Dan the Man » 02 Oct 2011, 22:39

where's the autoexec file?
Dan the Man
 
Posts: 27
Joined: 30 Jul 2011, 22:52

Re: Zero's Useful/Random Game Functions

Postby ZeroKnight » 03 Oct 2011, 00:36

You have to create it ;)

Open notepad, add the stuff you need, and save it as "autoexec.cfg". It's important to add the ".cfg" extension. The place to save to is dependent on your OS:

Windows: %USERPROFILE%\Documents\My Games\Red Eclipse
Linux: $HOME/.redeclipse
Mac: typically /Users/<name>/Application Support/redeclipse
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Zero's Useful/Random Game Functions

Postby ZeroKnight » 23 Oct 2011, 01:01

[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: ZeroKnight's Game Functions/Power-User Binds

Postby ZeroKnight » 17 May 2012, 04:04

Bump. Updated again!
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: ZeroKnight's Game Functions/Power-User Binds

Postby bonifarz » 13 Oct 2012, 14:35

Do like ;)

I suggest a few milliseconds of sleep for the resetbots function (see viewtopic.php?f=73&t=3615&p=35930#p35930 for details).
User avatar
bonifarz
 
Posts: 379
Joined: 09 Apr 2012, 12:16
Location: switzerland

Re: ZeroKnight's Game Functions/Power-User Binds

Postby ZeroKnight » 15 Oct 2012, 01:55

bonifarz {l Wrote}:Do like ;)

I suggest a few milliseconds of sleep for the resetbots function (see viewtopic.php?f=73&t=3615&p=35930#p35930 for details).

Funny you should say that. In my weapmod scripts (which I have been too lazy to make work in 1.3 and post to my archive), I did exactly what you suggest. At the end is a short sleep, and then the text is displayed, just to make sure it's seen. I just forgot to apply it to the resetbots function in this thread, but it's done in my autoexec, haha

Thanks for that catch. I updated it.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Who is online

Users browsing this forum: No registered users and 1 guest

cron