OpenArena Message Boards

OpenArena => Technical Snafus => Topic started by: cowberrian on December 20, 2016, 09:47:19 PM



Title: New command
Post by: cowberrian on December 20, 2016, 09:47:19 PM
Hello peeps!
What I'm trying to achieve is define a command that would connect me to some server when entered in console.

This is my first thought:
Code:
set _someservername "connect someserveraddress"
But when I enter "_someservername" in consile I get: _someservername is "connect _someserveraddress", the default
Ok. If I bind somekey "vstr _someservername", it is working as expected.
So I try 
Code:
set someservername "vstr _someservername"
But this one yields: someservername is "vstr _someservername", the default

Please advise on this matter :)


Title: Re: New command
Post by: Gig on December 21, 2016, 01:07:37 AM
If you want a one-key command, I suppose you may try simply
Code:
bind <key> connect <serveraddress>
However IIRC binded keys do work only when you are actually playing, not from menu.

If you want something to be written in console (to be used also when not playing), but to do not write the full server address each time, I can guess something like
Code:
set <variable> "connect <serveraddress>"
then
Code:
vstr <variable>
should work.

As example, in case you use "serv1" as variable and 127.0.0.1:27960 as serveraddress:
Code:
set serv1 "connect 127.0.0.1:27960"
then
Code:
vstr serv1

Note: Maybe using "seta" instead of "set" for setting the variable and then using "/writeconfig" should allow to store your user-created variable to your configuration, to do not have to recreate it each time you open OpenArena. It's years I don't try that, I'm not sure it works (however I suppose it should).
Alternatively, you may add the set <variable> "connect <serveraddress>" command to your autoexec.cfg file, to automatically re-create the variable each time you launch OpenArena.

Other alternatives:
1) Putting the "connect <serveraddress>" command into a .cfg plain text file in your baseoa folder, and then invoke that .cfg file with "exec <filename>" or "exec <filename.cfg>". (While "vstr" is the command to "run" a variable containing commands, "exec" is the command to "run" text files containing commands and variables.)
2) Creating a new shortcut in your OS to OpenArena executable, adding "+connect <serveraddress>" after its path... something like
Code:
"C:\Games\OpenArena\openarena.exe" "+connect 127.0.0.1:27960"
That would automatically connect to the specified server on startup.
3) Using Favorites: (DO NOT LINK) h t t p s : / / openarena . wikia . com/wiki/Favorites

Note: I haven't actually tried these right now, I may have done some small imprecision.

See also: (DO NOT LINK) h t t p s : / / openarena . wikia . com/wiki/Command_console


Title: Re: New command
Post by: cowberrian on December 21, 2016, 01:35:25 AM
Thanks for your dedication, man! :) I am indeed writing it in autoexec which for me is even less hassle then favorites from game menu, and wiki doesn't have the answer that is why asking here.
So you are saying that there is no possibility to invoke this from console without preceding it with vstr or exec? Because I'd love to compact it into a single word :)

Edit: Oh and binding it won't do because I have a heap of addresses and one keyboard will not be enough. Besides, informative commands are easier to memorize. I'm an unix guy, cli is my type of tool.


Title: Re: New command
Post by: Gig on December 21, 2016, 01:50:29 AM
So you are saying that there is no possibility to invoke this from console without preceding it with vstr or exec? Because I'd love to compact it into a single word :)
Shorter command I can think about is "vstr a" or "exec a" (with "a" being a variable or a .cfg file, respectively)...

There are many things I don't know, maybe someone else may know some other trick. However typing 6 characters (including the space) does not seem a big price...


Title: Re: New command
Post by: cowberrian on December 21, 2016, 01:53:36 AM
K then. Vstr will do for now. Thanks for support, man!


Title: Re: New command
Post by: Gig on December 21, 2016, 02:09:08 AM
You're welcome.