Script fuckup


(Cerebrate) #1

I’d appreciate it if someone could help me debug this script.

This first bit binds a different crosshair to ‘F1’, ‘F2’ and ‘F3’. For instance, I prefer the latter on dark maps like Radar. The various keys and names differ from the script I use, but I changed it to make it more comprehensible to others.

bind F1 “seta CROSSHAIR cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .9; cg_crosshairalphaalt 1; vstr CROSSHAIR”

bind F2 “seta CROSSHAIR cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .6; cg_crosshairalphaalt 1; vstr CROSSHAIR”

bind F3 seta “CROSSHAIR cg_drawcrosshair 4; cg_crosshairsize 46; cg_crosshaircolor cyan; cg_crosshaircoloralt cyan; cg_crosshairalpha .4; cg_crosshairalphaalt .9; vstr CROSSHAIR”

The second part makes the crosshair smaller when crouching, and when I “uncrouch” it loads the predefined crosshair settings and resets the size of the crosshair.

seta crouchon “+movedown; cg_crosshairsize 36”

seta crouchoff “-movedown; vstr CROSSHAIR”

bind mouse2 “+vstr crouchon crouchoff”

All of this used to work when I only had one command to each of the crosshair setting; which was cg_crosshairalpha, but when I added more it just won’t work anymore. This means that there is a syntaxt error; or at least I assume it is.

The old and more simple setting (which worked ) looked like this:

bind F1 “seta CROSSHAIR cg_crosshairalpha .9; vstr CROSSHAIR”

bind F1 “seta CROSSHAIR cg_crosshairalpha .6; vstr CROSSHAIR”

bind F1 “seta CROSSHAIR cg_crosshairalpha .3; vstr CROSSHAIR”

That much for so little may seem unnecessary, but there are other scripts which refers to these things, so it’s kind of intertwined.


(IneQuation) #2

bind F1 “seta CROSSHAIR cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .9; cg_crosshairalphaalt 1; vstr CROSSHAIR”

bind F2 “seta CROSSHAIR cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .6; cg_crosshairalphaalt 1; vstr CROSSHAIR”

bind F3 seta “CROSSHAIR cg_drawcrosshair 4; cg_crosshairsize 46; cg_crosshaircolor cyan; cg_crosshaircoloralt cyan; cg_crosshairalpha .4; cg_crosshairalphaalt .9; vstr CROSSHAIR”

Watch the quotation marks, they change a lot.

How about this:

bind F1 seta CROSSHAIR “cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .9; cg_crosshairalphaalt 1”

bind F2 seta CROSSHAIR “cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .6; cg_crosshairalphaalt 1”

bind F3 seta CROSSHAIR “cg_drawcrosshair 4; cg_crosshairsize 46; cg_crosshaircolor cyan; cg_crosshaircoloralt cyan; cg_crosshairalpha .4; cg_crosshairalphaalt .9”

I’m afraid you’ll have to bind vstr CROSSHAIR to some other button since the console AFAIK does not support string escaping.


(Cerebrate) #3

Didn’t seem to work. I’ve been tampering with the quotationmarks for half an hour before I shamefully turned to this board.


(DarkangelUK) #4

You can’t have them all named CROSSHAIR, you have to name them seperately like CROSSHAIR1 and CROSSHAIR2 etc

Don’t know why you have seta in there in the 1st place tho, just simply make it a bind…

bind F1 “cg_drawcrosshair 3; cg_crosshairsize 42; cg_crosshaircolor cyan; cg_crosshaircoloralt red; cg_crosshairalpha .9; cg_crosshairalphaalt 1”


(Cerebrate) #5

DarkAngel: The whole point is that they got the same name. That’s not the issue here, I think. If I press F1, CROSSHAIR will have certain properties which can be brough back with the crouching thing, and F2 will reassign CROSSHAIR with other properties and so forth.


(Nocturne) #6

that vstr only works with 1 button right, or am I wrong?