Xonotic Forums
[NEED HELP] How to do newlines within a setting? - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Server Administration (https://forums.xonotic.org/forumdisplay.php?fid=16)
+--- Thread: [NEED HELP] How to do newlines within a setting? (/showthread.php?tid=7459)



How to do newlines within a setting? - Antares* - 06-15-2017

For example.
Code:
alias sv_hook_gamestart_all "say ^7Welcome.; say ^7All matches on this server except CTS have a 2 minute warm up phase.; say ^7To begin the match, ready up (default key: ^1F4^7).;";
While this is more legible, it only causes the server to print a welcoming message when server.cfg is executed.
Code:
alias sv_hook_gamestart_all "\
say ^7Welcome.; \
say ^7All matches on this server except CTS have a 2 minute warm up phase."; \
say ^7To begin the match, ready up (default key: ^1F4^7).;";



RE: How to do newlines within a setting? - Mario - 06-15-2017

You can't have new lines in aliases, but what you could do is throw those into a separate config file, which you then execute from the alias:
alias sv_hook_gamestart_all "exec welcome.cfg"

The contents of welcome.cfg (which would of course go in data) would look something like this:
Code:
say ^7Welcome.
say ^7All matches on this server except CTS have a 2 minute warm up phase.
say ^7To begin the match, ready up (default key: ^1F4^7).



RE: How to do newlines within a setting? - BuddyFriendGuy - 06-15-2017

I don't think you can do it without re-writing the parser. Newlines are used as the delimiter for command (including alias):
https://gitlab.com/xonotic/darkplaces/blob/div0-stable/cmd.c#L1596

EDIT: not sure why but Mario's reply didn't show up at first.


RE: How to do newlines within a setting? - Antares* - 06-19-2017

(06-15-2017, 12:35 PM)Mario Wrote: You can't have new lines in aliases, but what you could do is throw those into a separate config file, which you then execute from the alias:
alias sv_hook_gamestart_all "exec welcome.cfg"

The contents of welcome.cfg (which would of course go in data) would look something like this:
Code:
say ^7Welcome.
say ^7All matches on this server except CTS have a 2 minute warm up phase.
say ^7To begin the match, ready up (default key: ^1F4^7).

What's the clever work around for
Code:
g_maplist "acid3dm10_q3 afterslime aggressorx_wz_04 bloodrun_a3 boil_b4 bloodprison_xon_r2 charon3dm13 crescent_q3 cpm1a cpm7 cpm10_nex_r1 cpm15 cpm16_nex_r1 cpm17 cpm24_nex_r1 cpm29_nex_r1 cucumber_v2 cure_full_r2 darkzone downer_final_r1 drain finalrage fuse hub3aeroq3a_nex_r4 imprisoned-final_r3 lostworld_ql luminar map-everything_else_is_green_v1r0 mint_r1  monsoon_q3 opium_v4 pukka3tourney2 rota3dm2 ruinerx runningman solarium silentsiege stormkeep syntheticv1 toxicity warfare xoylent "
//need to shuffle otherwise will show the first listed maps above.
g_maplist_shufflenow
where each map is ideally on its own line for legibility. (It's already in its own file).

(06-15-2017, 01:47 PM)BuddyFriendGuy Wrote: I don't think you can do it without re-writing the parser. Newlines are used as the delimiter for command (including alias):
https://gitlab.com/xonotic/darkplaces/blob/div0-stable/cmd.c#L1596

EDIT: not sure why but Mario's reply didn't show up at first.


Well at least its in C.


RE: How to do newlines within a setting? - Mario - 06-19-2017

I guess if you have an idea of how you want them organized, you could split them into addtolist calls:


Code:
g_maplist "a few unsorted maps"
alias addmaps "addtolist g_maplist ${* ?}"

addmaps "solarium darkzone runningman solarium silentsiege stormkeep warfare xoylent"
addmaps "opium_v4 downer_final_r1"



RE: How to do newlines within a setting? - Antares* - 06-22-2017

I wanted them organized alphabetically.
On their own lines.
Can't I just suggest you people to tinker with the parser a bit?


RE: How to do newlines within a setting? - BuddyFriendGuy - 07-05-2017

I'd love a more powerful parser, but I can't really justify that being a high priority. How about write your own config pre-processor (in say Python or Perl) that produces Xonotic's cfg from whatever better syntax you'd like to use?