Originally posted by JaraDaj
Besides, arguing over the internet is like running in the special olympics. No matter who wins, you still look stupid.
Ok, right off the bat, that's about the funniest thing I've heard all week. Mind if I use that?
JaraDaj: Are you a programmer by any chance? If not, you should really consider a career in Application Develoment (That's what I do), you seem to have a talent for it.
Scripting for the Quake 3 engine (JK2 is based on the Quake 3 engine and 99% of the scripts written for Quake 3 will work in JK2) is a lot like programming.
For all those who have flamed in this thread: Get over it man. Whether it's cheating or not, whether it's unfair or not, it's not going away......ever.
I'm an application developer, which means that I write the code behind programs such as media players, word processors, and video games. Lemme break it down for ya. When JK2 starts up, it reads in all the QVM files (Quake Virtual Machine). In these files are the building blocks of the game (basically the mathematical operations performed by the computer that are then translated into what you see on the screen). Then comes the audio/visual stuff: models, images, .wav files (actually JK2 utilizes MP3 sound files). After this is done, the final step is to load the configuration files (cfg). These configuration files tell the game engine which keys should perform what actions and how the graphics, audio, and other environment settings are configured on the local machine. So, you see, without the configuration files, it would be impossible to play the game because no keyboard buttons would actually do anything.
"So", you say, "Why not just 'hard code' the button configurations into the game engine itself and do away with the ability to change the default button settings all together?"
That's a good question, here's why Raven will never do it:
It would require a complete retooling of the original source code. They would have to replace certain variable names, whose values are read in from the configuration files, to their literal counterparts. We're talking about a major change-up of several thousand lines of code. Then you have to remember that the keys on a standard keyboard in America are not represented by the same characters on a standard keyboard in any other non-english speaking country. This means that Raven now has to not only re-work the code, but has to re-work the code for every single language in the world. You starting to see why this just isn't cost effective? We coders aren't cheap you know.
Ok, I'll get down off my soap box now.
I wanted to let everyone pertinent to this thread know that there are several VERY high quality tutorials on the Web for writing these things. If you'd like to learn more about how it's done, you can start by going to
http://www.planetquake.com/thebind/)
This site is written for binding in Quake 3, but for the most part it works the same in JK2.
Here are a few of my own scripts (excuse the comments in a few of em, I sometimes tend to get a little comment happy):
// When you press the bound key you crouch, press again to stand up
set crouch1 "+movedown; echo Crouching...; set crouch vstr crouch2"
set crouch2 "-movedown; echo Standing...; set crouch vstr crouch1"
set crouch "vstr crouch1"
bind c "vstr crouch"
// When you press the bound key you run, press again to walk (you have to disable the always run feature or the messages will display backwards)
set run1 "+speed; echo Running...; set run vstr run2"
set run2 "-speed; echo Walking...; set run vstr run1"
set run "vstr run1"
bind shift "vstr run"
// Press the bound key to start recording a demo, again to stop
// Record up to 80 demos in a session before they start to overwrite
// ******************************
// *Written By: =sRs=Primesghost*
// * Demo Config Ver: 1.2 *
// *
www.quakemonster.com) *
// ******************************
// Installation:
// --------------------------------------------------------------------------------------
// Place this code into a Notepad text file.
// Save the file with any filename you wish.
// Edit the file's ".txt" extension to ".cfg"
// copy the file into your "Quake III Arena\baseq3" folder
// (this folder is usually found at "driveletter:Program Files\Quake III Arena\baseq3")
// --------------------------------------------------------------------------------------
//
// Usage:
// ---------------------------------------------------
// While playing Quake 3: Arena
// Load the config (cfg) file: /exec ConfigName
// ---------------------------------------------------
// Begin code
// demo(01 - 80) are basically variables with specific commands attached to each.
// The commands attached to the demo(01 - 80) alternate the recording process.
// The first time the bound key is pressed, demo1 is triggered.
//
// demo1:
// Turns on Synchronous Client mode
// Begins recording of a demo with the filename "demo0001"
// Turns off Synchronous Client mode
// Binds the key (whichever key was bound to demo) to demo2
//
// demo2:
// Stops the recording of current demo
// Binds the key (whichever key was bound to demo) to demo3
//
// The cycle continues up to 40 demos and starts over (this will record over previous demos).
//
set demo1 "g_synchronousclients 1; record demo0001; g_synchronousclients 0; set demo vstr demo2"
set demo2 "stoprecord; set demo vstr demo3"
set demo3 "g_synchronousclients 1; record demo0002; g_synchronousclients 0; set demo vstr demo4"
set demo4 "stoprecord; set demo vstr demo5"
set demo5 "g_synchronousclients 1; record demo0003; g_synchronousclients 0; set demo vstr demo6"
set demo6 "stoprecord; set demo vstr demo7"
set demo7 "g_synchronousclients 1; record demo0004; g_synchronousclients 0; set demo vstr demo8"
set demo8 "stoprecord; set demo vstr demo9"
set demo9 "g_synchronousclients 1; record demo0005; g_synchronousclients 0; set demo vstr demo10"
set demo10 "stoprecord; set demo vstr demo11"
set demo11 "g_synchronousclients 1; record demo0006; g_synchronousclients 0; set demo vstr demo12"
set demo12 "stoprecord; set demo vstr demo13"
set demo13 "g_synchronousclients 1; record demo0007; g_synchronousclients 0; set demo vstr demo14"
set demo14 "stoprecord; set demo vstr demo15"
set demo15 "g_synchronousclients 1; record demo0008; g_synchronousclients 0; set demo vstr demo16"
set demo16 "stoprecord; set demo vstr demo17"
set demo17 "g_synchronousclients 1; record demo0009; g_synchronousclients 0; set demo vstr demo18"
set demo18 "stoprecord; set demo vstr demo19"
set demo19 "g_synchronousclients 1; record demo0010; g_synchronousclients 0; set demo vstr demo20"
set demo20 "stoprecord; set demo vstr demo21"
set demo21 "g_synchronousclients 1; record demo0011; g_synchronousclients 0; set demo vstr demo22"
set demo22 "stoprecord; set demo vstr demo23"
set demo23 "g_synchronousclients 1; record demo0012; g_synchronousclients 0; set demo vstr demo24"
set demo24 "stoprecord; set demo vstr demo25"
set demo25 "g_synchronousclients 1; record demo0013; g_synchronousclients 0; set demo vstr demo26"
set demo26 "stoprecord; set demo vstr demo27"
set demo27 "g_synchronousclients 1; record demo0014; g_synchronousclients 0; set demo vstr demo28"
set demo28 "stoprecord; set demo vstr demo29"
set demo29 "g_synchronousclients 1; record demo0015; g_synchronousclients 0; set demo vstr demo30"
set demo30 "stoprecord; set demo vstr demo31"
set demo31 "g_synchronousclients 1; record demo0016; g_synchronousclients 0; set demo vstr demo32"
set demo32 "stoprecord; set demo vstr demo33"
set demo33 "g_synchronousclients 1; record demo0017; g_synchronousclients 0; set demo vstr demo34"
set demo34 "stoprecord; set demo vstr demo35"
set demo35 "g_synchronousclients 1; record demo0018; g_synchronousclients 0; set demo vstr demo36"
set demo36 "stoprecord; set demo vstr demo37"
set demo37 "g_synchronousclients 1; record demo0019; g_synchronousclients 0; set demo vstr demo38"
set demo38 "stoprecord; set demo vstr demo39"
set demo39 "g_synchronousclients 1; record demo00020; g_synchronousclients 0; set demo vstr demo40"
set demo40 "stoprecord; set demo vstr demo41"
set demo41 "g_synchronousclients 1; record demo00021; g_synchronousclients 0; set demo vstr demo42"
set demo42 "stoprecord; set demo vstr demo43"
set demo43 "g_synchronousclients 1; record demo00022; g_synchronousclients 0; set demo vstr demo44"
set demo44 "stoprecord; set demo vstr demo45"
set demo45 "g_synchronousclients 1; record demo00023; g_synchronousclients 0; set demo vstr demo46"
set demo46 "stoprecord; set demo vstr demo47"
set demo47 "g_synchronousclients 1; record demo00024; g_synchronousclients 0; set demo vstr demo48"
set demo48 "stoprecord; set demo vstr demo49"
set demo49 "g_synchronousclients 1; record demo00025; g_synchronousclients 0; set demo vstr demo50"
set demo50 "stoprecord; set demo vstr demo51"
set demo51 "g_synchronousclients 1; record demo00026; g_synchronousclients 0; set demo vstr demo52"
set demo52 "stoprecord; set demo vstr demo53"
set demo53 "g_synchronousclients 1; record demo00027; g_synchronousclients 0; set demo vstr demo54"
set demo54 "stoprecord; set demo vstr demo55"
set demo55 "g_synchronousclients 1; record demo00028; g_synchronousclients 0; set demo vstr demo56"
set demo56 "stoprecord; set demo vstr demo57"
set demo57 "g_synchronousclients 1; record demo00029; g_synchronousclients 0; set demo vstr demo58"
set demo58 "stoprecord; set demo vstr demo59"
set demo59 "g_synchronousclients 1; record demo0030; g_synchronousclients 0; set demo vstr demo60"
set demo60 "stoprecord; set demo vstr demo61"
set demo61 "g_synchronousclients 1; record demo0031; g_synchronousclients 0; set demo vstr demo62"
set demo62 "stoprecord; set demo vstr demo63"
set demo63 "g_synchronousclients 1; record demo0032; g_synchronousclients 0; set demo vstr demo64"
set demo64 "stoprecord; set demo vstr demo65"
set demo65 "g_synchronousclients 1; record demo0033; g_synchronousclients 0; set demo vstr demo66"
set demo66 "stoprecord; set demo vstr demo67"
set demo67 "g_synchronousclients 1; record demo0034; g_synchronousclients 0; set demo vstr demo68"
set demo68 "stoprecord; set demo vstr demo69"
set demo69 "g_synchronousclients 1; record demo0035; g_synchronousclients 0; set demo vstr demo70"
set demo70 "stoprecord; set demo vstr demo71"
set demo71 "g_synchronousclients 1; record demo0036; g_synchronousclients 0; set demo vstr demo72"
set demo72 "stoprecord; set demo vstr demo73"
set demo73 "g_synchronousclients 1; record demo0037; g_synchronousclients 0; set demo vstr demo74"
set demo74 "stoprecord; set demo vstr demo75"
set demo75 "g_synchronousclients 1; record demo0038; g_synchronousclients 0; set demo vstr demo76"
set demo76 "stoprecord; set demo vstr demo77"
set demo77 "g_synchronousclients 1; record demo0039; g_synchronousclients 0; set demo vstr demo78"
set demo78 "stoprecord; set demo vstr demo79"
set demo79 "g_synchronousclients 1; record demo00040; g_synchronousclients 0; set demo vstr demo80"
set demo80 "stoprecord; set demo vstr demo1"
// Sets demo equal to demo1
set demo "vstr demo1"
// Binds F12 to the vstr demo
bind f12 "vstr demo"
// End code
Keep up the good work, I'm working on a comprehensive explanation of how scripts work and a few good scripting habits. I'll post it here when I finish it.