SLIC-Reference : StringCompare
CTP2 Bureau
The Modding
Apolyton CTP2 forums
Apolyton CTP2 archives
Source Code Project SVN

SLIC-Reference : : StringCompare  

Arguments: string1, string2

Returns true if string1 equals string2

This function did not work as supposed in the original game and has been fixed by Martin Gühmann for CTP2 AE. In addition it has been overloaded to allow the comparison of strings passed as strings, string IDs and builtin variables containing strings.


SFN_ERROR Slic_StringCompare::Call(SlicArgList *args)
	if(args->Count() != 2)

	//Added by Martin Ghmann to allow string comparision, between string IDs and plain strings
	char *string1 = 0;
	char *string2 = 0;

	const char *cstring1, *cstring2;
	StringId stringId1, stringId2;

	if(!args->GetString(0, string1)){
		if(args->GetStringId(0, stringId1)){
			cstring1 = g_theStringDB->GetNameStr(stringId1);
		else if(args->m_argValue[0].m_type == SA_TYPE_INT_VAR){
			cstring1 = g_theStringDB->GetNameStr(args->m_argValue[0].m_symbol->GetStringId());
		string1 = const_cast(cstring1);
	if(!args->GetString(1, string2)){
		if(args->GetStringId(1, stringId2)){
			cstring2 = g_theStringDB->GetNameStr(stringId2);
		else if(args->m_argValue[1].m_type == SA_TYPE_INT_VAR){
			cstring2 = g_theStringDB->GetNameStr(args->m_argValue[1].m_symbol->GetStringId());
		string2 = const_cast(cstring2);

	if ( !stricmp(string1, string2) )
		m_result.m_int = 1;
	else {
		m_result.m_int = 0;

	return SFN_ERROR_OK;

Information last updated by BureauBert on 26.06.2009

User Comments:

Using this form you may add your own observations concerning the above item, e.g. additional hints for usage, limitations, oddities etc. Please note this is not the place for asking questions or carrying out discussions about modding - please refer to the Apolyton CTP2 Modification Forum on that purpose.

Subject / Title*:
(A maximum of characters left)
Your name:*
Your website (URL):

*) Required fields

No user comments yet.

This site is currently maintained by: BureauBert (Webmaster)  Maquiladora (Manager)  Legal Notice: Legal Notice Statistics: 105545 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne
Share this page:  VK Facebook Twitter LiveJournal OK MR Google+ LinkedIn tumblr Pinterest Blogger Digg Evernote