User panel stuff on forum
  6 posts on 1 page  1
Advanced Configuration
2011-03-17, 10:53
Member
21 posts

Registered:
Apr 2007
ezquake site wrote:
ezQuake Manual: Variable cl_curlybraces

Description

Enables new syntax to be used for Quake scripting allowing you to enclose commands into curly braces

Support: Windows: OpenGL Windows: Software Linux: GLX Linux: X11 Linux: SVGA Mac OS X FreeBSD
Default:
Values

value description
1
0
See scripting manual for further info

I wasn't able to find any example how to use new syntax provided by setting cl_curlybraces to 1.

I found out one way to use this, for example:

cl_curlybraces 1

alias _took "\
if ('$health' < '1' and '$took' = '$tp_name_quad') then .took.quad.died \
else if ('$health' < '1' and '$took' = '$tp_name_ring') then .took.rind.died \
else if ('$health' < '1' and '$weapon' != '$tp_name_rl' and '$weapon' != '$tp_name_lg') then .took.took.died \
else if ('$health' < '1' and '$weapon' = '$tp_name_lg') then .took.lg.dropped \
else if ('$health' < '1' and '$weapon' = '$tp_name_rl') then .took.rl.dropped \
else if ('$took' = '$tp_name_backpack') then .took.backpack \
else if ('$took' = '$tp_name_nothing') then .took.echo \
else .took"

I noticed that '\' mark works as line changer indicator and there cannot be any characters (especially tab character) after the indicator mark (otherwise there will be errors when executing config). I wasn't able to find how to do nested if-else structures. If someone knows a syntax for nested structure, please post an example here!

Anyway, I created this post to give an example how the curlybraces works.
2011-03-17, 16:30
Member
133 posts

Registered:
Dec 2008
{} behaves just as "" with cl_curlybraces 1
but it can be placed inside:

bind q "if $use_ssg = 1 {impulse 3;} else { impulse 2;}; +attack"
2011-03-17, 22:15
Member
485 posts

Registered:
Feb 2006
It allows you to break lines. It's a pretty impractical feature because curlybraces are is used for colors too. So in message configs where it would be most useful, you have to add too many \'s.
2011-03-18, 06:25
Member
21 posts

Registered:
Apr 2007
So in my example I'm using cl_curlybraces without braces, but I still can break lines with \ character. Breaking lines is the only feature of cl_curlybraces ?
2011-03-18, 07:52
Member
133 posts

Registered:
Dec 2008
$R &G $B lights are more than enough. So it is very practical feature.
Also you can enable feature where you need it and disable right after its usage:
cl_curlybraces 1;
bind q "if $use_ssg = 1 {impulse 3;} else { impulse 2;}; +attack"
cl_curlybraces 0;

Braking line should not be feature of cl_curlybraces but it may be implemented so. If so it is a bug.
2011-03-18, 09:40
Member
485 posts

Registered:
Feb 2006
Dunno what I was talking about with the breaking lines. Sorry about the confusion.


Having {}'s for two different purposes is still bad though. I guess it's because of merging features from different clients.

It's not a perfect solution to turn them on/off when needed, because then you might leave it to wrong value for some other config. This is better:
set .temp_curly $cl_curlybraces; cl_curlybraces 0
<config here>
cl_curlybraces $.temp_curly; unset .temp_curly

But you might still get problems when using cfg_save etc... :/
  6 posts on 1 page  1