Problem with new cvar parsing in svn

If you've had any problems with Nexuiz, or would like to report bugs, post here.

Moderators: Nexuiz Moderators, Moderators

Problem with new cvar parsing in svn

Postby animus » Sat Jul 14, 2007 5:38 am

As of svn r7466/7467, the following binds that I have no longer work properly. The toggle is fine, but displaying the value of the cvar is problematic. If I paste the binds below into config.cfg, they work as expected -- but only the first time I launch Nexuiz. The $$r_novis becomes $r_novis after the first run, then it becomes the last value for that cvar after the second. I also tried ${$r_novis} without success: Nexuiz displays "Could not expand $$r_novis".

bind h "toggle r_shadow_realtime_world; echo Realtime World Lighting: $$r_shadow_realtime_world"
bind j "toggle r_novis; echo r_noVis: $$r_novis"
animus
Member
 
Posts: 17
Joined: Sat Jul 07, 2007 8:24 pm
Location: Michigan

Postby divVerent » Sat Jul 14, 2007 7:30 am

Yes, LordHavoc wanted alias to have a special exception that no cvar expansion takes place in its arguments - then the same should go for bind and in_bind, IMHO.

Code: Select all
set x 3

bind FOO "echo $x"
// will echo the value of $x when FOO is pressed

"bind" FOO "echo $x"
// will echo 3 when FOO is pressed


Done.

Also, backslashes and quotes are now saved correctly.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby Blµb » Sat Jul 14, 2007 8:38 am

divVerent wrote:Yes, LordHavoc wanted alias to have a special exception that no cvar expansion takes place in its arguments - then the same should go for bind and in_bind, IMHO.

Code: Select all
set x 3

bind FOO "echo $x"
// will echo the value of $x when FOO is pressed

"bind" FOO "echo $x"
// will echo 3 when FOO is pressed


Done.

Also, backslashes and quotes are now saved correctly.

So, do backslashes work for quotes only, or can I use
"bind" FOO "echo \$x"
to work like
bind FOO "echo $x"
Blµb
Alien trapper
 
Posts: 277
Joined: Thu Mar 29, 2007 1:49 pm

Postby animus » Sat Jul 14, 2007 10:26 pm

Alright, these now work as expected. Thanks. :)

bind h "toggle r_shadow_realtime_world; echo Realtime World Lighting: $r_shadow_realtime_world"
bind j "toggle r_novis; echo r_noVis: $r_novis"
animus
Member
 
Posts: 17
Joined: Sat Jul 07, 2007 8:24 pm
Location: Michigan

Postby divVerent » Sun Jul 15, 2007 9:11 am

Backslash doesn't quote $, but $ does: $$ is a quoted $.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby Blµb » Tue Jul 17, 2007 9:30 am

then there's no way to have
bind x display_var "echo $$varname"

display the var defined in varname? so I toggle through a bunch of varnames, setting $varname to their name, and have $$varname display it?
like
set varname fov;
then x displays fov?

:P
Blµb
Alien trapper
 
Posts: 277
Joined: Thu Mar 29, 2007 1:49 pm

Postby divVerent » Tue Jul 17, 2007 6:45 pm

bind x "echo ${$varname}"

Indirection, which previously was possible unintendedly in alias+cvar expansion (because they were two separate steps), was reintroduced as an intentional feature.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby AceOfThumbs » Sat Jan 05, 2008 1:46 am

Indirection isn't working in 2.3 on Macs or in 2.4 on Linux. Here's an example:
set x 1
set i x
echo ${$i}

Outputs:
Warning: could not find cvar {$i}
Warning: could not find cvar i}

It works correctly in 2.3 on Linux. Didn't get it tested on Windows.
------------------------------------------------

Here's another parsing error WinstonSmith pointed out on IRC:
// blah ; echo "this shouldn't print"

Outputs:
this shouldn't print

There is a workaround for this one:
// "blah ; echo "this shouldn't print""

no output since the ; is within quotes
So much to do, so little time to do it
AceOfThumbs
Alien
 
Posts: 158
Joined: Tue Sep 04, 2007 11:12 pm

Postby divVerent » Sat Jan 05, 2008 8:17 am

Indirection works very fine here. You must be using an old engine build.

set x 1
set i x
echo ${$i}
1
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby AceOfThumbs » Sun Jan 06, 2008 12:38 am

I'm using the May 30, 2007 2.3 release for Mac. I don't have Linux, but WinstonSmith on IRC said he tested the 2.3 release on Linux and it worked, but on the 2.4 SVN it didn't.
So much to do, so little time to do it
AceOfThumbs
Alien
 
Posts: 158
Joined: Tue Sep 04, 2007 11:12 pm

Next

Return to Nexuiz - Support / Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron