Possible console command?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Willis
Posts: 60
Joined: Sun Jul 20, 2003 6:35 pm

Possible console command?

Post 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?
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post 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
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post 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".
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post 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.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post 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.
Mighty Duck X-treme
Posts: 272
Joined: Tue Jul 15, 2003 5:48 pm
Location: Chesterfield, Missouri

Post by Mighty Duck X-treme »

<REMOVED>
Last edited by Mighty Duck X-treme on Fri Aug 01, 2003 4:36 pm, edited 1 time in total.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Go suck on a cock. Kthx.
zarcyb
Posts: 28
Joined: Wed Jul 16, 2003 3:12 am
Location: Edinburgh/Dundee, Scotland
Contact:

Post 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.
Mighty Duck X-treme
Posts: 272
Joined: Tue Jul 15, 2003 5:48 pm
Location: Chesterfield, Missouri

Post by Mighty Duck X-treme »

<REMOVED>
Last edited by Mighty Duck X-treme on Fri Aug 01, 2003 4:36 pm, edited 1 time in total.
User avatar
Willis
Posts: 60
Joined: Sun Jul 20, 2003 6:35 pm

Post by Willis »

I did figure a way to simulate a key that increases the fov value using rather brutal tactics...

Code: Select all

[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

User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post 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.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post 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
User avatar
Sphagne
Posts: 513
Joined: Wed Jul 16, 2003 3:36 am

Post 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.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post 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.
Mighty Duck X-treme
Posts: 272
Joined: Tue Jul 15, 2003 5:48 pm
Location: Chesterfield, Missouri

Post 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.)
Last edited by Mighty Duck X-treme on Fri Aug 01, 2003 4:58 pm, edited 1 time in total.
Post Reply

Return to “General”