String concatenation?
String concatenation?
I can't find much on this; can you do it in QC? o_O
Re: String concatenation?
Cannot be done in standard QuakeC.Downsider wrote:I can't find much on this; can you do it in QC? o_O
without frik_file, only limited forms of string concatenation exist.
localcmds can be concatinated by just not using any \ns.
same with stuffcmds. so you can 'concatinate' map names and cfg names and stuff if you need to do that.
centerprint (with sprint, and bprint, but those are not interesting) can concatinate multiple input strings, up to the qcvm max of 8 args.
Just add additional clones of the builtin but with additional string arguments (and thus different names). This'll work with any engine/qcc.
full string concatination?... well there are some hacks... like stuffcmding the name cvar and then reading it back again in qc... but those are so hacky and unreliable that they're of no practical use. fun though.
otherwise, do without, or use FRIK_FILE.
localcmds can be concatinated by just not using any \ns.
same with stuffcmds. so you can 'concatinate' map names and cfg names and stuff if you need to do that.
centerprint (with sprint, and bprint, but those are not interesting) can concatinate multiple input strings, up to the qcvm max of 8 args.
Just add additional clones of the builtin but with additional string arguments (and thus different names). This'll work with any engine/qcc.
full string concatination?... well there are some hacks... like stuffcmding the name cvar and then reading it back again in qc... but those are so hacky and unreliable that they're of no practical use. fun though.
otherwise, do without, or use FRIK_FILE.
the original strcat implementation is somewhat a 1-liner.
void PF_strcat(void)
{
G_INT(OFS_RETURN) = PF_VarString(0) - pr_strings;
}
but such a simple builtin is a real pain to use.
(basically a cross between centerprint and ftos)
A more useful implementation would be to adapt PF_VarString to cycle internal buffers (DP_MULTIPLE_TEMPSTRINGS mandates 16, but does also affect ftos).
void PF_strcat(void)
{
G_INT(OFS_RETURN) = PF_VarString(0) - pr_strings;
}
but such a simple builtin is a real pain to use.
(basically a cross between centerprint and ftos)
A more useful implementation would be to adapt PF_VarString to cycle internal buffers (DP_MULTIPLE_TEMPSTRINGS mandates 16, but does also affect ftos).