| 1 |
// ***** BEGIN LICENSE BLOCK ***** |
| 2 |
// Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 3 |
// |
| 4 |
// The contents of this file are subject to the Mozilla Public License Version |
| 5 |
// 1.1 (the "License"); you may not use this file except in compliance with |
| 6 |
// the License. You may obtain a copy of the License at |
| 7 |
// http://www.mozilla.org/MPL/ |
| 8 |
// |
| 9 |
// Software distributed under the License is distributed on an "AS IS" basis, |
| 10 |
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 11 |
// for the specific language governing rights and limitations under the |
| 12 |
// License. |
| 13 |
// |
| 14 |
// The Original Code is the toekk.org QuakeWorld timer script. |
| 15 |
// |
| 16 |
// The Initial Developer of the Original Code is |
| 17 |
// Alexander Ahern - toekk at toekk dot org. |
| 18 |
// Portions created by the Initial Developer are Copyright (C) 2005 |
| 19 |
// the Initial Developer. All Rights Reserved. |
| 20 |
// |
| 21 |
// Contributor(s): |
| 22 |
// |
| 23 |
// Alternatively, the contents of this file may be used under the terms of |
| 24 |
// either the GNU General Public License Version 2 or later (the "GPL"), or |
| 25 |
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
| 26 |
// in which case the provisions of the GPL or the LGPL are applicable instead |
| 27 |
// of those above. If you wish to allow use of your version of this file only |
| 28 |
// under the terms of either the GPL or the LGPL, and not to allow others to |
| 29 |
// use your version of this file under the terms of the MPL, indicate your |
| 30 |
// decision by deleting the provisions above and replace them with the notice |
| 31 |
// and other provisions required by the GPL or the LGPL. If you do not delete |
| 32 |
// the provisions above, a recipient may use your version of this file under |
| 33 |
// the terms of any one of the MPL, the GPL or the LGPL. |
| 34 |
// |
| 35 |
// ***** END LICENSE BLOCK ***** |
| 36 |
|
| 37 |
// $Id: teamtime.cfg,v 1.1 2006-04-20 18:49:00 johnnycz Exp $ |
| 38 |
|
| 39 |
// Bindings: |
| 40 |
// The variables "__kt_X" indicate the keys you should bind. |
| 41 |
// __kt_reset - resets the timer, if you make a mistake entering a time. |
| 42 |
// __kt_spam - tell your teammates the time on the currently selected timer. |
| 43 |
// __kt_nudgeup - increment current item's time by 1. |
| 44 |
// __kt_nudgedown - you can guess! |
| 45 |
// __kt_zero/one... - typically these are the the numeric keypad. |
| 46 |
|
| 47 |
// Installation: |
| 48 |
// Put the timer.cfg in your quakeworld/id1 directory, and then place |
| 49 |
// "exec timer.cfg" in your config somewhere. This will bind all the |
| 50 |
// keys and set your timers to zero. The script will not be much use unless |
| 51 |
// you also set "cl_gameclock 1" in your config! |
| 52 |
|
| 53 |
// Usage: |
| 54 |
// At the moment, the timer only records quad, rl, pent, ra and ya times. |
| 55 |
// To enter a time, first select the item you wish to record: |
| 56 |
// 1: yellow armour |
| 57 |
// 2: red armour |
| 58 |
// 4: quad |
| 59 |
// 6: pent |
| 60 |
// 7: rocket launcher |
| 61 |
// Then type the time you took the item. As an example, suppose we collect rl |
| 62 |
// on 47 seconds. Type "7", "4", "7" and the script will report that the next |
| 63 |
// rl is on 17. |
| 64 |
// |
| 65 |
// (these instructions assume you have the standard numeric keypad bindings) |
| 66 |
|
| 67 |
// Customisation: |
| 68 |
// To change your message, the alias __kt_spam can be redefined. |
| 69 |
|
| 70 |
// Contact: |
| 71 |
// The author, toekk, can usually be found on QuakeNet IRC, |
| 72 |
// channel #knockback. |
| 73 |
// JohnNy_cz, 1.13->1.13j updater - #qw.cz |
| 74 |
|
| 75 |
set __kt_reset "kp_enter" |
| 76 |
set __kt_spam "kp_star" |
| 77 |
set __kt_nudgeup "kp_plus" |
| 78 |
set __kt_nudgedown "kp_minus" |
| 79 |
set __kt_zero "kp_0" |
| 80 |
set __kt_one "kp_1" |
| 81 |
set __kt_two "kp_2" |
| 82 |
set __kt_three "kp_3" |
| 83 |
set __kt_four "kp_4" |
| 84 |
set __kt_five "kp_5" |
| 85 |
set __kt_six "kp_6" |
| 86 |
set __kt_seven "kp_7" |
| 87 |
set __kt_eight "kp_8" |
| 88 |
set __kt_nine "kp_9" |
| 89 |
|
| 90 |
set __t_quad "00" |
| 91 |
set __t_rl "00" |
| 92 |
set __t_pent "00" |
| 93 |
set __t_ra "00" |
| 94 |
set __t_ya "00" |
| 95 |
|
| 96 |
set __t_tens 0 |
| 97 |
set __t_units 0 |
| 98 |
set __t_item 0 |
| 99 |
set __t_tmp 0 |
| 100 |
|
| 101 |
// Save the temporary time __t_tmp into the correct item's time |
| 102 |
alias _t_save "if $qt,$__t_item,$qt isin $qt,quad,rl,pent,ya,ra,$qt then set __t_$__t_item $__t_tmp" |
| 103 |
|
| 104 |
// Load the selected item's time into the temporary time __t_tmp |
| 105 |
alias _t_load "if $qt,$__t_item,$qt isin $qt,quad,rl,pent,ya,ra,$qt then _t_load$__t_item" |
| 106 |
alias _t_loadquad "set __t_tmp $__t_quad" |
| 107 |
alias _t_loadrl "set __t_tmp $__t_rl" |
| 108 |
alias _t_loadpent "set __t_tmp $__t_pent" |
| 109 |
alias _t_loadra "set __t_tmp $__t_ra" |
| 110 |
alias _t_loadya "set __t_tmp $__t_ya" |
| 111 |
|
| 112 |
// Show the current time as an echo |
| 113 |
alias _t_echo "echo $__t_item on $__t_tmp" |
| 114 |
|
| 115 |
// Spam the current time |
| 116 |
alias _t_spam "say_team $\$nick $__t_item $__t_tmp; _t_bindselect" |
| 117 |
|
| 118 |
// Panic button to stop setting a time if you make a mistake |
| 119 |
alias _t_reset "bf; echo reset - selection mode; _t_bindselect" |
| 120 |
|
| 121 |
// Select item to set/report it's time |
| 122 |
alias _ts_ya "echo yellow selected; _t_save; set __t_item ya; _t_load; _t_bindtens;" |
| 123 |
alias _ts_ra "echo red selected; _t_save; set __t_item ra; _t_load; _t_bindtens;" |
| 124 |
alias _ts_quad "echo quad selected; _t_save; set __t_item quad; _t_load; _t_bindtens" |
| 125 |
alias _ts_rl "echo rl selected; _t_save; set __t_item rl; _t_load; _t_bindtens" |
| 126 |
alias _ts_pent "echo pent selected; _t_save; set __t_item pent; _t_load; _t_bindtens" |
| 127 |
|
| 128 |
// Bind all the keys to item selection |
| 129 |
alias _t_bindselect "unbind $__kt_zero; bind $__kt_one _ts_ya; bind $__kt_two _ts_ra; unbind $__kt_three; bind $__kt_four _ts_quad; unbind $__kt_five; bind $__kt_six _ts_pent; bind $__kt_seven _ts_rl; unbind $__kt_eight; unbind $__kt_nine;" |
| 130 |
|
| 131 |
// Bind all the keys to unit selection |
| 132 |
alias _t_bindunits "bind $__kt_zero _tu_zero; bind $__kt_one _tu_one; bind $__kt_two _tu_two; bind $__kt_three _tu_three; bind $__kt_four _tu_four; bind $__kt_five _tu_five; bind $__kt_six _tu_six; bind $__kt_seven _tu_seven; bind $__kt_eight _tu_eight; bind $__kt_nine _tu_nine" |
| 133 |
|
| 134 |
// Bind keys to tens selection |
| 135 |
alias _t_bindtens "bind $__kt_zero _tt_zero; bind $__kt_one _tt_one; bind $__kt_two _tt_two; bind $__kt_three _tt_three; bind $__kt_four _tt_four; bind $__kt_five _tt_five; unbind $__kt_six; unbind $__kt_seven; unbind $__kt_eight; unbind $__kt_nine" |
| 136 |
|
| 137 |
// Take a weapon, this adds 30 seconds |
| 138 |
// this works for any gameclock settings the same - JohnNy_cz |
| 139 |
alias _t_weapon "inc __t_tmp 30; if $__t_tmp >= 60 then inc __t_tmp -60; _t_pad" |
| 140 |
|
| 141 |
// Take an armour, this adds 20 seconds |
| 142 |
// <JohnNy_cz> |
| 143 |
alias _t_armour "if $cl_gameclock == 1 _t_armour_cw else if $cl_gameclock == 3 _t_armour_cw else _t_armour_ccw" |
| 144 |
alias _t_armour_cw "inc __t_tmp 20; if $__t_tmp >= 60 then inc __t_tmp -60; _t_pad" |
| 145 |
alias _t_armour_ccw "inc __t_tmp -20; if $__t_tmp < 0 then inc __t_tmp 60; _t_pad" |
| 146 |
// </JohnNy_cz> |
| 147 |
|
| 148 |
// Pad with leading zeros |
| 149 |
alias _t_pad "if $__t_tmp < 10 then set __t_tmp 0$__t_tmp" |
| 150 |
|
| 151 |
// Set the time |
| 152 |
alias _t_settime "set __t_tmp $qt$__t_tens$__t_units$qt; if $__t_item == rl then _t_weapon else if $qt,$__t_item,$qt isin $qt,ra,ya,$qt then _t_armour" |
| 153 |
alias _t_nudgeup "inc __t_tmp; if $__t_tmp >= 60 then inc __t_tmp -60; _t_pad; _t_echo" |
| 154 |
alias _t_nudgedown "inc __t_tmp -1; if $__t_tmp < 0 then inc __t_tmp 60; _t_pad; _t_echo" |
| 155 |
|
| 156 |
// Units |
| 157 |
alias _tu_zero "set __t_units 0; _t_settime; _t_spam; _t_bindselect" |
| 158 |
alias _tu_one "set __t_units 1; _t_settime; _t_spam; _t_bindselect" |
| 159 |
alias _tu_two "set __t_units 2; _t_settime; _t_spam; _t_bindselect" |
| 160 |
alias _tu_three "set __t_units 3; _t_settime; _t_spam; _t_bindselect" |
| 161 |
alias _tu_four "set __t_units 4; _t_settime; _t_spam; _t_bindselect" |
| 162 |
alias _tu_five "set __t_units 5; _t_settime; _t_spam; _t_bindselect" |
| 163 |
alias _tu_six "set __t_units 6; _t_settime; _t_spam; _t_bindselect" |
| 164 |
alias _tu_seven "set __t_units 7; _t_settime; _t_spam; _t_bindselect" |
| 165 |
alias _tu_eight "set __t_units 8; _t_settime; _t_spam; _t_bindselect" |
| 166 |
alias _tu_nine "set __t_units 9; _t_settime; _t_spam; _t_bindselect" |
| 167 |
|
| 168 |
// Tens |
| 169 |
alias _tt_zero "echo 0...; set __t_tens 0; _t_bindunits" |
| 170 |
alias _tt_one "echo 1...; set __t_tens 1; _t_bindunits" |
| 171 |
alias _tt_two "echo 2...; set __t_tens 2; _t_bindunits" |
| 172 |
alias _tt_three "echo 3...; set __t_tens 3; _t_bindunits" |
| 173 |
alias _tt_four "echo 4...; set __t_tens 4; _t_bindunits" |
| 174 |
alias _tt_five "echo 5...; set __t_tens 5; _t_bindunits" |
| 175 |
|
| 176 |
// Setup |
| 177 |
|
| 178 |
_t_bindselect |
| 179 |
bind $__kt_reset "_t_reset" |
| 180 |
bind $__kt_spam "_t_spam" |
| 181 |
bind $__kt_nudgeup "_t_nudgeup" |
| 182 |
bind $__kt_nudgedown "_t_nudgedown" |
| 183 |
|
| 184 |
echo "timer.cfg $Revision: 1.1 $" |