Welcome,
Guest
. Please
login
or
register
.
November 13, 2024, 10:33:47 PM
News:
tastyspleen.net has a new discord server:
http://discord.tastyspleen.net
Home
Forum
Help
TinyPortal
Search
Calendar
Login
Register
tastyspleen::quake 2 community
»
Forum
»
Quake Related Topics
»
Quake
(Moderator:
[BTF]DeathStalker
) »
Configs, Variables, & Modifiers, Oh My!
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Configs, Variables, & Modifiers, Oh My! (Read 1896 times)
Disco Karate
Full Member
Posts: 133
*~Funkjazztikal Tricknology~*
Rated:
Configs, Variables, & Modifiers, Oh My!
«
on:
November 04, 2005, 09:11:35 AM »
Okay, I am in the process of writing a Quake II config that suits my needs, but I have run into a few snags.
Firstly, I have no knowledge of programming languages, and all this "variable" stuff confuses me. A typical explanation from a tutorial on Quake II config-writing:
"The dollar sign is the $ character. This character is special in a sense that it allows for the substitution of a variable name preceded with the dollar sign character into the value which is held by that variable."
What? What the fuck does THAT mean? Am I reading too deep into that? How the hell do I use the thing?
Can someone give me a plain english explanation as to how variables work and what they do? I know that $mapname will display the map I am currently on, and $name will display my name (I think), but how do you program variables, and how do they allow me to do cool and snazzy stuff with my scripts?
My next question concerns modifiers. I know that if you do this:
+attack
-attack
The +attack is what happens when you press the key and -attack is what happens when you release it.
However... some scripts I have written give me errors and say that -whatever is bad. Like if I program an alias with the modifiers +whatever and -whatever... it will execute +whatever and then not do -whatever. Am I doing something wrong? Is there a format to follow for modifiers?
Man, all this Quake II config-wriiting is tougher than I thought...
Thanks in advance.
Logged
Kyper
Full Member
Posts: 100
Forum lurker
Rated:
Re: Configs, Variables, & Modifiers, Oh My!
«
Reply #1 on:
November 05, 2005, 10:25:53 AM »
Variables basically store information, be it a number or a string of text. Let's take the variable 'name.' As you already know, this thing stores your name. If you type 'name' in the console, it will display the current value of 'name'. If you wanted to change your name to something else, you modify the 'name' variable to whatever you want by typing 'name sumthinelse'.
So, knowing how variables can store a number or text, you can write binds that either change the value of variables or display them on the screen. If you wanted to bind a key that toggled walking off, for example, the key variable here to modify would be 'cl_run', where '1' means you'll always run and '0', you'll walk. To accomplish this:
bind c "cl_run 0"
This bind sets "cl_run" to have a value of "0", which turns it off. This'll set your movement to walking.
As for the $ thingy, you pretty much know what it does. It displays the value contained within the variable. It only really needs to be used and when you want to echo/say something. Map location reporting ($loc_here states your current map location, $loc_there, the location you're looking toward) is a good example. So, if you wanted to say to your team that "ENEMY @ <location you're looking at>", then one such bind would be:
bind x say_team "ENEMY @ $loc_there !"
When you press x while looking at the railgun area, for example, you'll say:
(Player): ENEMY @ RAILGUN !
The $ before loc_there is necessary so that it will say the contents of the variable 'loc_there'. If you didn't put it in, Q2 won't recognize that you're trying to say a variable, and you'll report:
Player: ENEMY @ loc_there !
Hopefully, I explained it well enough for you to understand. To recap, a variable stores a number or text. To change that value it stores, just type <variable> <value> (to be extra-sure, or so that you don't get confused, you can write 'set <variable> <value>'. The $ is used if you want to print the contents of that variable. To tell everyone on the server that you're playing q2dm2 for example, you can make a bind that has the command "say Hey everyone, we're playing $mapname !".
As for modifiers in aliases, I think they don't execute the -command. If you had an alias like:
alias blah +attack
bind mouse1 blah
-attack won't ever happen, and your weapon will continue firing.
Oh...you also mentioned errors that say your -whatever is bad? Is the console actually spamming messages or does it simply not work?
Logged
Disco Karate
Full Member
Posts: 133
*~Funkjazztikal Tricknology~*
Rated:
Re: Configs, Variables, & Modifiers, Oh My!
«
Reply #2 on:
November 07, 2005, 04:14:44 PM »
Thanks for the reply.
No, the console doesn't spam messages. Sometimes when I write a script that involves a modifier alias it will perform the +command part of it, but not the -command. What might cause that?
Thank you for the explanation btw. Cleared some stuff up for me.
Logged
Disco Karate
Full Member
Posts: 133
*~Funkjazztikal Tricknology~*
Rated:
Re: Configs, Variables, & Modifiers, Oh My!
«
Reply #3 on:
November 07, 2005, 04:21:07 PM »
K didn't read your reply well enough.
The +attack modifier is what happens when you press down the key.
The -attack modifier is what happens when you release the key. The -attack modifier is implied and unnecessary, since the presence of the + in +attack implies the subsequent presence of -attack. Otherwise you would attack forever without stopping.
Let's say I wanted to walk whenever I held down a button. I wanted to stop walking when I released it. Well, luckily there is already a command for that: +speed.
The +speed tells Quake 2 to allow me to walk, and when I release the button -speed is activated telling Quake 2 that the button was released.
You can program your own modifier aliases, so if I wanted to lob a grenade or something and then switch back to my previous weapon, I would do something like this:
alias +grenade "use grenades;+attack"
alias -grenade "-attack;weapprev"
This would tell Quake 2 to switch to grenades and throw one when the button was pressed, and then stop attacking and switch to the previous weapon when the button was released. However, sometimes when I write a modifier alias and activate in Quake 2... Q2 will tell me that the "-" part of the command (-grenade or whatever) is not valid.
What would cause this?
Logged
Kyper
Full Member
Posts: 100
Forum lurker
Rated:
Re: Configs, Variables, & Modifiers, Oh My!
«
Reply #4 on:
November 09, 2005, 01:03:27 PM »
I can't think of anything specific that would cause that...maybe you could provide the modifier you wrote?
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
tastyspleen::quake 2 community
»
Forum
»
Quake Related Topics
»
Quake
(Moderator:
[BTF]DeathStalker
) »
Configs, Variables, & Modifiers, Oh My!
El Box de Shoutamente
Last 10 Shouts:
Costigan_Q2
November 11, 2024, 06:41:06 AM
"Stay cozy folks.
Everything is gonna be fine."
There'll be no excuses for having TDS after January 20th, there'll be no excuses AT ALL!!!
|iR|Focalor
November 06, 2024, 03:28:50 AM
RailWolf
November 05, 2024, 03:13:44 PM
Nice
Tom Servo
November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.
Costigan_Q2
November 04, 2024, 03:37:55 PM
Stay cozy folks.
Everything is gonna be fine.
|iR|Focalor
October 31, 2024, 08:56:37 PM
Costigan_Q2
October 17, 2024, 06:31:53 PM
Not activated your account yet?
Activate it now! join in the fun!
Tom Servo
October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
|iR|Focalor
October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
rikwad
October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.
Show 50 latest
User
Welcome,
Guest
. Please
login
or
register
.
November 13, 2024, 10:33:47 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search
Advanced search