[^idm0]@Posted: Tue Mar 04, 2008 3:35 pm :
Hi, this is not a scripting question but a console question. I am wondering if there is any way to get a value from a cvar? So I could use a cvar at the console such as "say ui_name" would print "Player" in the game? Actually, what I am trying to do is bind multiple strings to a key. I was thinking something like +bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say k" but maybe this is not possible?



rich_is_bored@Posted: Wed Mar 05, 2008 5:30 am :
There's no means to pipe the output of one command into another. It would require code changes.



6th Venom@Posted: Wed Mar 05, 2008 11:58 am :
I remember something similar when i played the Prey demo... but maybe some code changes were made for.
When some messages like: "for crouch press C" (if C were the touch you bound for exemple)

Even in the ROE strings you got some "%s^0 has your flag" so i suppose %s is the player's name...
(cause ^0 is to reset the text color in the case the player name use some different colors)



simulation@Posted: Wed Mar 05, 2008 12:13 pm :
[^idm0] wrote:
Hi, this is not a scripting question but a console question. I am wondering if there is any way to get a value from a cvar? So I could use a cvar at the console such as "say ui_name" would print "Player" in the game? Actually, what I am trying to do is bind multiple strings to a key. I was thinking something like +bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say k" but maybe this is not possible?


bind x "say $ui_name"

will display your ui_name value. You can use $ to expand CVar values.

Sim



[^idm0]@Posted: Wed Mar 05, 2008 3:03 pm :
Thank you Simulation, thats exactly what I wanted. The commands work fine now as:

Code:
(if k is not set) seta k "anything"
bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say $k"


Now I can make my binds better!



rich_is_bored@Posted: Thu Mar 06, 2008 8:42 am :
Intresting. I didn't realize you could do that. :)



simulation@Posted: Thu Mar 06, 2008 10:45 am :
rich_is_bored wrote:
Intresting. I didn't realize you could do that. :)


Me either. I only found this recently when I was plodding through some random SDK code for some reason.

I'm sure the old-school Quakers will be amazed that we don't know these things ;)



AnthonyJa@Posted: Thu Mar 06, 2008 1:54 pm :
I didnt know either, and I dont think Q3 supports that so I guess most dont know about it ;)

I was going to suggest vstr, since you can use that to do what the OP wanted, but didnt get around to coming up with the precise binds.

BTW, any "new" cvars created for things like this should probably be named "ua_bleh" (where ua stands for User Alias), so that it doesnt whine about them being cheat protected.



rich_is_bored@Posted: Fri Mar 07, 2008 10:18 am :
Would you know by chance if this is Quake 4 specific or if it can be done in any idTech 4 game?



simulation@Posted: Fri Mar 07, 2008 10:55 am :
rich_is_bored wrote:
Would you know by chance if this is Quake 4 specific or if it can be done in any idTech 4 game?


Just tried in D3 and "bind p say $ui_name" did the trick



rich_is_bored@Posted: Fri Mar 07, 2008 12:32 pm :
Thanks. I've updated the wiki...

http://www.modwiki.net/wiki/Console



[^idm0]@Posted: Tue Mar 04, 2008 3:35 pm :
Hi, this is not a scripting question but a console question. I am wondering if there is any way to get a value from a cvar? So I could use a cvar at the console such as "say ui_name" would print "Player" in the game? Actually, what I am trying to do is bind multiple strings to a key. I was thinking something like +bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say k" but maybe this is not possible?



rich_is_bored@Posted: Wed Mar 05, 2008 5:30 am :
There's no means to pipe the output of one command into another. It would require code changes.



6th Venom@Posted: Wed Mar 05, 2008 11:58 am :
I remember something similar when i played the Prey demo... but maybe some code changes were made for.
When some messages like: "for crouch press C" (if C were the touch you bound for exemple)

Even in the ROE strings you got some "%s^0 has your flag" so i suppose %s is the player's name...
(cause ^0 is to reset the text color in the case the player name use some different colors)



simulation@Posted: Wed Mar 05, 2008 12:13 pm :
[^idm0] wrote:
Hi, this is not a scripting question but a console question. I am wondering if there is any way to get a value from a cvar? So I could use a cvar at the console such as "say ui_name" would print "Player" in the game? Actually, what I am trying to do is bind multiple strings to a key. I was thinking something like +bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say k" but maybe this is not possible?


bind x "say $ui_name"

will display your ui_name value. You can use $ to expand CVar values.

Sim



[^idm0]@Posted: Wed Mar 05, 2008 3:03 pm :
Thank you Simulation, thats exactly what I wanted. The commands work fine now as:

Code:
(if k is not set) seta k "anything"
bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say $k"


Now I can make my binds better!



rich_is_bored@Posted: Thu Mar 06, 2008 8:42 am :
Intresting. I didn't realize you could do that. :)



simulation@Posted: Thu Mar 06, 2008 10:45 am :
rich_is_bored wrote:
Intresting. I didn't realize you could do that. :)


Me either. I only found this recently when I was plodding through some random SDK code for some reason.

I'm sure the old-school Quakers will be amazed that we don't know these things ;)



AnthonyJa@Posted: Thu Mar 06, 2008 1:54 pm :
I didnt know either, and I dont think Q3 supports that so I guess most dont know about it ;)

I was going to suggest vstr, since you can use that to do what the OP wanted, but didnt get around to coming up with the precise binds.

BTW, any "new" cvars created for things like this should probably be named "ua_bleh" (where ua stands for User Alias), so that it doesnt whine about them being cheat protected.



rich_is_bored@Posted: Fri Mar 07, 2008 10:18 am :
Would you know by chance if this is Quake 4 specific or if it can be done in any idTech 4 game?



simulation@Posted: Fri Mar 07, 2008 10:55 am :
rich_is_bored wrote:
Would you know by chance if this is Quake 4 specific or if it can be done in any idTech 4 game?


Just tried in D3 and "bind p say $ui_name" did the trick



rich_is_bored@Posted: Fri Mar 07, 2008 12:32 pm :
Thanks. I've updated the wiki...

http://www.modwiki.net/wiki/Console



[^idm0]@Posted: Tue Mar 04, 2008 3:35 pm :
Hi, this is not a scripting question but a console question. I am wondering if there is any way to get a value from a cvar? So I could use a cvar at the console such as "say ui_name" would print "Player" in the game? Actually, what I am trying to do is bind multiple strings to a key. I was thinking something like +bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say k" but maybe this is not possible?



rich_is_bored@Posted: Wed Mar 05, 2008 5:30 am :
There's no means to pipe the output of one command into another. It would require code changes.



6th Venom@Posted: Wed Mar 05, 2008 11:58 am :
I remember something similar when i played the Prey demo... but maybe some code changes were made for.
When some messages like: "for crouch press C" (if C were the touch you bound for exemple)

Even in the ROE strings you got some "%s^0 has your flag" so i suppose %s is the player's name...
(cause ^0 is to reset the text color in the case the player name use some different colors)



simulation@Posted: Wed Mar 05, 2008 12:13 pm :
[^idm0] wrote:
Hi, this is not a scripting question but a console question. I am wondering if there is any way to get a value from a cvar? So I could use a cvar at the console such as "say ui_name" would print "Player" in the game? Actually, what I am trying to do is bind multiple strings to a key. I was thinking something like +bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say k" but maybe this is not possible?


bind x "say $ui_name"

will display your ui_name value. You can use $ to expand CVar values.

Sim



[^idm0]@Posted: Wed Mar 05, 2008 3:03 pm :
Thank you Simulation, thats exactly what I wanted. The commands work fine now as:

Code:
(if k is not set) seta k "anything"
bind "]" "toggle k '^1Nice Shot!' '^2Nice Shot!' '^3Nice Shot!';say $k"


Now I can make my binds better!



rich_is_bored@Posted: Thu Mar 06, 2008 8:42 am :
Intresting. I didn't realize you could do that. :)



simulation@Posted: Thu Mar 06, 2008 10:45 am :
rich_is_bored wrote:
Intresting. I didn't realize you could do that. :)


Me either. I only found this recently when I was plodding through some random SDK code for some reason.

I'm sure the old-school Quakers will be amazed that we don't know these things ;)



AnthonyJa@Posted: Thu Mar 06, 2008 1:54 pm :
I didnt know either, and I dont think Q3 supports that so I guess most dont know about it ;)

I was going to suggest vstr, since you can use that to do what the OP wanted, but didnt get around to coming up with the precise binds.

BTW, any "new" cvars created for things like this should probably be named "ua_bleh" (where ua stands for User Alias), so that it doesnt whine about them being cheat protected.



rich_is_bored@Posted: Fri Mar 07, 2008 10:18 am :
Would you know by chance if this is Quake 4 specific or if it can be done in any idTech 4 game?



simulation@Posted: Fri Mar 07, 2008 10:55 am :
rich_is_bored wrote:
Would you know by chance if this is Quake 4 specific or if it can be done in any idTech 4 game?


Just tried in D3 and "bind p say $ui_name" did the trick



rich_is_bored@Posted: Fri Mar 07, 2008 12:32 pm :
Thanks. I've updated the wiki...

http://www.modwiki.net/wiki/Console