View Single Post
Re: PODBOT2.6MM after PMB...work still pending
Old
  (#69)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: PODBOT2.6MM after PMB...work still pending - 18-04-2004

@sPlOrYgOn vbmenu_register("postmenu_12274", true);

about this name problem, retrieving the real name from a bot, old joebot has a function which does it, maybe not the most elegant way, it's already old, but it works. forgetting single letters and stuff, that's something you maybe do not need :

Code:
void CChat :: ConvertName(char *szChangP){
 char szChanged[100],szTemp[100],*szB,*szE,*szEnd;
 long lAnz;
 
 if(strlen(szChangP) < 3){
  return;
 }
 
 // copy
 strcpy(szChanged,szChangP);
 // make lowercase
 UTIL_strlwr(szChanged);
 
 //cout << szChanged << endl;
 strcpy(szTemp,szChanged);
 szEnd  = szChanged + sizeof(char) * strlen(szChanged);
 // cut out (...) stuff
 if(szB=strchr(szChanged,'(')){
  if(szB < szEnd){
   //cout <<"szb : "<<szB<<endl;
   if(szE=strchr(szChanged,')')){
	//cout <<"sze : "<<szE<<endl;
	if(szE < szEnd){
	 if(szE && szB){
	  if(szE>szB){
	   strcpy(szTemp,szChanged);
	   strcpy(szTemp + (szB - szChanged)*sizeof(char),szE+1);
	   
	  }
	  else{
	   strcpy(szTemp,szChanged);
	   strcpy(szTemp + (szE - szChanged)*sizeof(char),szB+1);
	  }
	 }
	}
   }
  }
 }
 
 if(strlen(szTemp) > 2)
  strcpy(szChanged,szTemp);
 
 strcpy(szTemp,szChanged);
 szEnd  = szChanged + sizeof(char) * strlen(szChanged);
 // cut out [...] stuff
 if(szB=strchr(szChanged,'[')){
  //cout <<"szb : "<<szB<<endl;
  if(szB < szEnd){
   if(szE=strchr(szChanged,']')){
	if(szE < szEnd){
	 //cout <<"sze : "<<szE<<endl;
	 if(szE && szB){
	  if(szE>szB){
	   strcpy(szTemp,szChanged);
	   strcpy(szTemp + (szB - szChanged)*sizeof(char),szE+1);
	  }
	  else{
	   strcpy(szTemp,szChanged);
	   strcpy(szTemp + (szE - szChanged)*sizeof(char),szB+1);
	  }
	 }
	}
   }
  }
 }
 if(strlen(szTemp) > 2)
  strcpy(szChanged,szTemp);
 
 strcpy(szTemp,szChanged);
 szEnd  = szChanged + sizeof(char) * strlen(szChanged);
 // cut out {...} stuff
 if(szB=strchr(szChanged,'{')){
  //cout <<"szb : "<<szB<<endl;
  if(szB < szEnd){
   if(szE=strchr(szChanged,'}')){
	if(szE < szEnd){
	 //cout <<"sze : "<<szE<<endl;
	 if(szE && szB){
	  if(szE>szB){
	   strcpy(szTemp,szChanged);
	   strcpy(szTemp + (szB - szChanged),szE+1);
	  }
	  else{
	   strcpy(szTemp,szChanged);
	   strcpy(szTemp + (szE - szChanged),szB+1);
	  }
	 }
	}
   }
  }
 }
 if(strlen(szTemp) > 2)
  strcpy(szChanged,szTemp);
 // just forget one letter .... sometimes
 
 lAnz = strlen(szChanged);
 if(lAnz>4 && RANDOM_FLOAT(0,100) < 10){
  long lLose = long(RANDOM_LONG(1,lAnz-2))+1;
  strcpy ( szChanged+(lLose-1)*sizeof(char),szChanged+lLose*sizeof(char));
 }
 
 // copy back
 strcpy(szChangP,szChanged);
}


  
Reply With Quote