Possible console command?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Possible console command?

Postby Willis » Thu Jul 31, 2003 7:55 pm

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
Willis
pwned
 
Joined: 20 Jul 2003

Postby HotWax » Thu Jul 31, 2003 9:04 pm

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
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby HotWax » Thu Jul 31, 2003 9:30 pm

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
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby HotWax » Thu Jul 31, 2003 9:49 pm

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
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby HotWax » Thu Jul 31, 2003 10:06 pm

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.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Mighty Duck X-treme » Thu Jul 31, 2003 10:17 pm

<REMOVED>
Last edited by Mighty Duck X-treme on Fri Aug 01, 2003 4:36 pm, edited 1 time in total.
Mighty Duck X-treme
Why am I always talking to myself?
 
Joined: 15 Jul 2003
Location: Chesterfield, Missouri

Postby HotWax » Thu Jul 31, 2003 11:22 pm

Go suck on a cock. Kthx.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby zarcyb » Fri Aug 01, 2003 3:36 am

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.
zarcyb
resident fishmonger
 
Joined: 16 Jul 2003
Location: Edinburgh/Dundee, Scotland

Postby Mighty Duck X-treme » Fri Aug 01, 2003 6:55 am

<REMOVED>
Last edited by Mighty Duck X-treme on Fri Aug 01, 2003 4:36 pm, edited 1 time in total.
Mighty Duck X-treme
Why am I always talking to myself?
 
Joined: 15 Jul 2003
Location: Chesterfield, Missouri

Postby Willis » Fri Aug 01, 2003 9:07 am

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

User avatar
Willis
pwned
 
Joined: 20 Jul 2003

Postby HotWax » Fri Aug 01, 2003 12:36 pm

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
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Xaser » Fri Aug 01, 2003 12:44 pm

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
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Postby Sphagne » Fri Aug 01, 2003 12:44 pm

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
Sphagne
Just me, nothing more
 
Joined: 16 Jul 2003

Postby HotWax » Fri Aug 01, 2003 4:27 pm

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.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Mighty Duck X-treme » Fri Aug 01, 2003 4:35 pm

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.
Mighty Duck X-treme
Why am I always talking to myself?
 
Joined: 15 Jul 2003
Location: Chesterfield, Missouri

Next

Return to General

Who is online

Users browsing this forum: dragomir and 3 guests