Set Command with DarkPlaces

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Set Command with DarkPlaces

Post by Baker »

I made a superzoom alias in DarkPlaces that restores the FOV and sensitivity to whatever value was being used prior to using it.

You just do the old ...

bind mouse3 +superzoom

... and it works fine.
alias +superzoom "set scratch1 $fov; set scratch2 $sensitivity; fov 70; sensitivity 4; wait; fov 58; sensitivity 3.25; wait; fov 45; sensitivity 2.50; wait; fov 32; sensitivity 1.74; wait; fov 20; sensitivity 14.0"

alias -superzoom "fov 32; sensitivity 1.75; wait; fov 45; sensitivity 2.50; wait; fov 58; sensitivity 3.25; wait; sensitivity 4; wait; set sensitivity $scratch2; set fov $scratch1"
However, I get an onscreen messages saying this:
7Warning: could not find cvar fov; when expanding alias +superzoom
set scratch1 $fov; set scratch2 $sensitivity; fov 70; sensitivity 4; wait;
fov 58; sensitivity 3.25; wait; fov 45; sensitivity 2.50; wait; fov 32;
sensitivity 1.74; wait; fov 20; sensitivity 14.0

Warning: could not find cvar sensitivity; when expanding alias +superzoom
set scratch1 $fov; set scratch2 $sensitivity; fov 70; sensitivity 4; wait;
fov 58; sensitivity 3.25; wait; fov 45; sensitivity 2.50; wait; fov 32;
sensitivity 1.74; wait; fov 20; sensitivity 14.0

Warning: could not find cvar scratch2; when expanding alias -superzoom
fov 32; sensitivity 1.75; wait; fov 45; sensitivity 2.50; wait; fov 58;
sensitivity 3.25; wait; sensitivity 4; wait; set sensitivity $scratch2; set fov
$scratch1

Warning: could not find cvar scratch2; when expanding alias -superzoom
fov 32; sensitivity 1.75; wait; fov 45; sensitivity 2.50; wait; fov 58;
sensitivity 3.25; wait; sensitivity 4; wait; set sensitivity $scratch2; set fov
$scratch1
Any ideas on why the script would work fine, but I get these warning messages?
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

After doing everything to try to figure this out myself, I ended up asking LordHavoc and the answer was that a space needs to follow the cvars in the SET statements otherwise it thinks I'm trying to use "fov;" as a cvar.

The following works fine:
alias +superzoom "set fov- $fov ; set sensitivity- $sensitivity ; fov 70; sensitivity 4; wait; fov 58; sensitivity 3.25; wait; fov 45; sensitivity 2.50; wait; fov 32; sensitivity 1.74; wait; fov 20; sensitivity 14.0"
alias -superzoom "fov 32; sensitivity 1.75; wait; fov 45; sensitivity 2.50; wait; fov 58; sensitivity 3.25; wait; sensitivity 4; wait; set sensitivity $sensitivity- ; set fov $fov-"
Gilgamesh
Posts: 67
Joined: Tue Oct 26, 2004 6:08 pm
Location: Brazil
Contact:

Post by Gilgamesh »

Thanks for the info! :)
#EOP
Post Reply