Inside3D!
     

String concatenation?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Wed Nov 18, 2009 11:02 pm    Post subject: String concatenation? Reply with quote

I can't find much on this; can you do it in QC? o_O
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Wed Nov 18, 2009 11:12 pm    Post subject: Re: String concatenation? Reply with quote

Downsider wrote:
I can't find much on this; can you do it in QC? o_O


Cannot be done in standard QuakeC.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Nov 19, 2009 1:51 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Thu Nov 19, 2009 2:12 am    Post subject: Reply with quote

I can add my own builtin to do it, though? Didn't even think of that, really. I don't want to do anything I don't have to, including adding frik_file builtins, for the sake of joining strings.

Thanks for the suggestion Smile
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Nov 19, 2009 2:34 am    Post subject: Reply with quote

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).
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
lth



Joined: 11 Nov 2004
Posts: 129

PostPosted: Thu Nov 19, 2009 1:28 pm    Post subject: Reply with quote

FRIK_FILE is the defacto standard, isn't it? Better to just support the standard than come up with your own special way of doing things, if you want other people to be able to mod for your engine.
_________________
randomviolence - tactical combat boardgame
Back to top
View user's profile Send private message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Thu Nov 19, 2009 10:24 pm    Post subject: Reply with quote

lth wrote:
FRIK_FILE is the defacto standard, isn't it? Better to just support the standard than come up with your own special way of doing things, if you want other people to be able to mod for your engine.


I don't really plan on making an engine so much as a game itself.
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Thu Nov 19, 2009 11:45 pm    Post subject: Reply with quote

is there any type of documentation of FRIK FILE?
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Mon Nov 30, 2009 11:28 pm    Post subject: Reply with quote

ceriux wrote:
is there any type of documentation of FRIK FILE?


dpextensions.qc has a reasonable explanation of how to use it.
_________________
Apathy Now!
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Mon Nov 30, 2009 11:36 pm    Post subject: Reply with quote

MauveBib wrote:
ceriux wrote:
is there any type of documentation of FRIK FILE?


dpextensions.qc has a reasonable explanation of how to use it.


ahh thank you! iv been posting about it every time it comes up. thank you for the info!
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group