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
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"
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.