Page 1 of 2

Possible console command?

PostPosted: Thu Jul 31, 2003 7:55 pm
by Willis
for moddifying console variables with standard math functions?

e.g: modvar FOV +5 would add 5 to the cvar "FOV"
e.g: modvar chase_dist *2 would multiply the chase distance by 2

and you could have *, /, -, +

I can see this being helpfull on nurmerous occasions, there isnt all ready anything like this is there?

PostPosted: Thu Jul 31, 2003 9:04 pm
by HotWax
Yes.

There are two commands currently implemented which will allow you to use mathematics to display information and/or manipulate variables.

The first is:

test <expression> <iftrue> [iffalse]

If <expression> evaluates to TRUE, executes <iftrue>. If not, and [iffalse] exists, executes [iffalse]. Remeber to enclose arguments in quotation marks when you need spaces.

Example:

test "zoomfov == 1" "fov 20" "fov 90"

If the custom cvar, "zoomfov" has been set to 1, will set the FOV to 20, otherwise will set the FOV to 90... In theory. In practice, I can't get this to work, but know it's possible.

The second command is:

eval <expression> [variable]

Evaluate <expression>. If [variable] is specified, store the result in [variable]. If not, report the result to the console.

<expression> uses some screwed up kinda notation that I don't fully understand, but is easy to use if you just need to do simple things. For example, instead of:

2 + 3 or 2 * (5 + 3)

you use:

+ 2 3 or * 2 + 5 3

Why? I don't know. :P Also, do NOT enclose the calculation in quotation marks. (Otherwise it'll evaluate it as a string)

Again, variables *should* work in the expression, so to do your request you would use:

eval + fov 5 fov

However, as I previously stated, I can't get cvars to work. Anybody know what I'm doing wrong?

[EDIT] My second example was flawed because of the quotations. Fixed. [/EDIT]

[EDIT #2] A quick check to the console.html and I found out how to use cvars. Along the way, I found a bug. Yay!

To use cvars in the eval function, you use $, followed by the command name. To use the example given in console.html:

eval - $screenblocks 1 screenblocks

This take the value stored in "screenblocks", reduces it by 1, and stores the result in screenblocks, reducing the visible area of your screen by 1 setting. The example works perfectly.

However, this doesn't:

eval + $fov 5 fov

Why not? Because $fov is treated as a string even though FOV is a legal variable... Randy? [/EDIT]

[EDIT #3! I'm on a roll!] A few tests for you to chew on:

> fov
fov is 90
> eval + $fov 5
$fov5
> eval + $fov 5 fov
unknown variable fov
> unset fov
> fov
fov is 90

PostPosted: Thu Jul 31, 2003 9:30 pm
by HotWax
I refuse to edit that post anymore.

Also, I am an idiot. In fact, I think I've done this before. Oh well.

FOV is not a cvar, it is a command. Therefore, its value cannot be used in the eval command, nor can it be used to hold the result. This is what we shall hence forth refer to as a "major bummer".

PostPosted: Thu Jul 31, 2003 9:49 pm
by HotWax
Now watch the magic of aliases at work:

>set fovvar 90
>fov 90
>alias maxcheck "test > $fovvar 90 \"set fovvar 90; fov 90\""
>alias mincheck "test < $fovvar 20 \"set fovvar 20; fov 20\""
>alias morezoom "eval - $fovvar 5 fovvar"
>alias lesszoom "eval + $fovvar 5 fovvar"
>alias zoomin "morezoom; fov $fovvar; mincheck"
>alias zoomout "lesszoom; fov $fovvar; maxcheck"
>bind mwheelup zoomin
>bind mwheeldown zoomout

Roll your mouse wheel forward to zoom in. Roll it back to zoom out.

PostPosted: Thu Jul 31, 2003 10:06 pm
by HotWax
Hahaha. If you wanna get REAL technical, add the following to the above:

>alias activezoom "wait; activezoom"
>alias +zoomin "alias activezoom \"zoomin; wait; activezoom\""
>alias -zoomin "alias activezoom \"wait; activezoom\""
>alias +zoomout "alias activezoom \"zoomout; wait; activezoom\""
>alias -zoomout "alias activezoom \"wait; activezoom\""
>bind m +zoomin
>bind n +zoomout
>activezoom

Hold M to zoom in. Hold N to zoom out.

Oh lord I have too much free time.

PostPosted: Thu Jul 31, 2003 10:17 pm
by Mighty Duck X-treme
<REMOVED>

PostPosted: Thu Jul 31, 2003 11:22 pm
by HotWax
Go suck on a cock. Kthx.

PostPosted: Fri Aug 01, 2003 3:36 am
by zarcyb
Mighty Duck X-treme wrote:hey thanks for the postcount++++


Coming from the ZDoom forum spammer.

HotWax: nice work :) I'll need to check it out sometime.

PostPosted: Fri Aug 01, 2003 6:55 am
by Mighty Duck X-treme
<REMOVED>

PostPosted: Fri Aug 01, 2003 9:07 am
by Willis
I did figure a way to simulate a key that increases the fov value using rather brutal tactics...

Code: Select allExpand view
[Doom.ConsoleAliases]
Name=zoom4
Command=FOV 90;R_DRAWPLAYERSPRITES 1;bind c zoom;echo "ZOOM DISABLED"
Name=zoomoff
Command=FOV 90;R_DRAWPLAYERSPRITES 1;bind c zoom;ECHO "ZOOM DISABLED"
Name=zoom
Command=FOV 68;R_DRAWPLAYERSPRITES 0;bind c zoom2;echo "ZOOM 125%"
Name=zoom3
Command=FOV 23;R_DRAWPLAYERSPRITES 0;bind c zoom5;echo "ZOOM 175%"
Name=zoom2
Command=FOV 45;R_DRAWPLAYERSPRITES 0;bind c zoom3;echo "ZOOM 150%"
Name=zoom5
Command=FOV 0;R_DRAWPLAYERSPRITES 0;bind c zoom4;echo "ZOOM 200%"

[Doom.Bindings]
x=zoomoff
c=zoom


PostPosted: Fri Aug 01, 2003 12:36 pm
by HotWax
Mighty Duck X-treme wrote:
zarcyb wrote:Coming from the ZDoom forum spammer.


Wonderful, go tell that to Zell as well


Zell has not yet started a thread that didn't have to do with ZDoom.
Zell has not made a complete ass of himself in nearly every post he's made.
Zell is not a blatant forum troll.

Seriously, why don't you go find somewhere else to post your useless blather? It's getting to the point where I just skip to the next post whenever I see your avatar.

Some people are a complete waste of oxygen.

PostPosted: Fri Aug 01, 2003 12:44 pm
by Xaser
ROFL! It's gotten to the point where you two fight so much that it's stupid. So stupid, it's funny. Heck, Hotwax made my day when I looked at that post in which he said "Open mouth, insert foot". The war that is going on between you two is so hilariously stupid. I don't mean that in a bad way, you two really add life to these forums! :D

PostPosted: Fri Aug 01, 2003 12:44 pm
by Sphagne
Comeon, he has become a lot better than when he first started, we shall wait and see if he keeps getting better or not.

PostPosted: Fri Aug 01, 2003 4:27 pm
by HotWax
Xaser wrote:ROFL! It's gotten to the point where you two fight so much that it's stupid. So stupid, it's funny. Heck, Hotwax made my day when I looked at that post in which he said "Open mouth, insert foot". The war that is going on between you two is so hilariously stupid. I don't mean that in a bad way, you two really add life to these forums! :D


"gotten to the point"? The first post I made that was addressed to him was done last night. You talk as if we've been going on long enough that historians already refer to it as World War 3.

Sphagne wrote:Comeon, he has become a lot better than when he first started, we shall wait and see if he keeps getting better or not.


That is an opinion that I do not share.

PostPosted: Fri Aug 01, 2003 4:35 pm
by Mighty Duck X-treme
That discussion is over. Let's get back to where we were, shall we, gentlemen?

(Please note I might also need to learn some forum language next time.)