Create an account

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using rcon with ${....}

Hello Community,

i read this thread:

and i was impressed about the power of the xonotic console to deal with the cvar-system. So i decided to make some rcon scripts to use on my server

i tested this one (i was clientsided connteced as a player to the server):

rcon set tmp_hostname ${hostname}

when i then called

rcon tmp_hostname

it showed the contend of my local cvar hostname not from my server cvar hostname.
Is it possible to store the content for the server cvar "hostname" in another cvar?

I tried it another way, i have written a rcon tool with winapi to administrate my xonotic server. Works fine with all this secure stuff. But when i type

set tmp_hostname ${hostname}

and then prove the cvar tmp_hostname, then it's content is ${hostname}. Does that mean that all this cool cvar script stuff only works clientsided?

You could try using an alias to get the expansion you want: rcon "alias backup_hostname \"set tmp_hostname ${hostname}\"; backup_hostname"

You can escape ${hostname} by doing rcon set tmp_hostname $${hostname}

As for your winapi tool, I don't know why it would do that. There is a rcon client script in the "server" directory ( Does that fail too?

TimePath suggests aliases, maybe it's worth noting that aliases can not return their output through rcon, so you get no feedback (unless this has changed recently?). In this case it's no big deal, though.

@Mr. Bougo, thx i tested double escape without success.

I dont know how to use this script (, i'm a windows user, but i can explain, what i have done to test all this stuff:

For the test environment i use my windows pc, vmware workstation with "ubuntu 12.04-64Bit server" as a guestsystem, wireshark for recording the networktraffic, an UDP-Send tool, my rcon tool, a selfwritten serverbrowser:

I started 2 dedicated servers, one on my windows pc and one on vmware with ubuntu guest. Servers have been up, checked with serverbrowser and by connecting and playing! So next step...

I send the following as UDP to the servers (rcon_secure = 0): ÿÿÿÿrcon my_rconpassword set tmp_hostname "${hostname}" (all this recorded with wireshark)

And then i checked tmp_hostname, the content is "${hostname}", not "Xonotic 0.8.0 Server" as expected!!. In the xonotic server console i can read about a successfull rcon recieve. That is logical, how else could the former not existing cvar tmp_hostname now has a value!

The same when i use rcon_secure = 1 and do all the nice "ÿÿÿÿsrcon HMAC-MD4 TIME ........." stuff. Again: in the server console i can read about successfull rcon. BTW all the other rcon things, secure or not, successfully run with my rcon-tool and my udp-send tool. So i think i can say the tools are not the problem. As wireshark tells me that my strings are exactly send as i typed them.

When i'm directly type set tmp_hostname "${hostname}" on my xonotic consolewindow and then check tmp_hostname, then and only then it really has the content of hostname set. I can't imagine what's going wrong.

Has ever anyone tested this with a remote client or by directly sending the commands as udp?

Eh, you're right, it seems that rcon commands aren't subject to variable expansion (except when expanding aliases). I had no idea. There isn't much you can do then, other than follow TimePath's suggestion.

There are different expansions rules on whether a command is executed in the console directly, as an alias or via rcon.

If you send commands via rcon, all characters which usually have special behaviour (double quotes, dollar sign, and semicolon) are treated as plain text, without any expansion of any kind.

If you want to write a tool to read/write cvars the best option is to do expansion on your side.
You can query for a cvar value by sending the cvar name as a single rcon line, the server will reply with "cvar_name" is "value" ["default_value"].

Ok thx for reply

the point was not to write a tool for rcon, which can handle the $ stuff. I only used my tools to do a forensic analyse of the problem. My primary goal was to do this rcon stuff with the xonotic client. But i can follow your advice, if i decide to improve my rcon tool.

Maybe this is a topic for a request to the developers.

Possibly Related Threads…
Thread Author Replies Views Last Post
  [META] Deploying Xonotic using GKE Game Servers? FAF 4 1,945 09-14-2022, 08:32 AM
Last Post: cushinga
Thumbs Up rcon and bots billyjoe 3 3,730 04-13-2017, 12:08 PM
Last Post: billyjoe
Brick Shell script to execute rcon commands Melanosuchus 0 7,365 06-05-2014, 04:17 PM
Last Post: Melanosuchus
  Another RCON IRC bot Melanosuchus 5 7,511 04-27-2014, 02:10 PM
Last Post: Melanosuchus
  rcon command resets bots, gamtype etc. darkzun 12 11,926 10-03-2013, 02:01 PM
Last Post: Mr. Bougo
  [WIP] Xon_Rcon - In-Game Rcon Tool sqamsqam 12 13,502 06-20-2013, 12:20 PM
Last Post: Mr. Bougo
  When using ./all run dedicated multiple instance different cfg file end user 1 3,076 04-29-2013, 01:19 AM
Last Post: Mr. Bougo
  Rcon via HLSW Problem Highlander 11 14,724 10-20-2012, 06:08 PM
Last Post: kidx
  [SOLVED] [Q] Restrict RCON sessions to local host only nonenone 4 6,911 04-12-2012, 06:48 AM
Last Post: nonenone

Forum Jump:

Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-