[Mini-Release] Function global for block words

06/22/2016 15:33 VegaS ♆#1
Code:
	import dbg, app, chat
		szText = self.GetText()
		#szText_ = self.inputValue.GetText()  ## your input value
		
		try:
			szGetFile = app.OpenTextFile("locale/en/block_words_python.txt")
			count_words = app.GetTextFileLineCount(szGetFile)
		except IOError:
			dbg.LogBox("Error: Loading words !")
			app.Abort()

		for vegas in xrange(count_words):
			lineText = app.GetTextFileLine(szGetFile, vegas)
			szGetTextFromFile = str(lineText).split("\t")
			if len(szGetTextFromFile) == 0 or not szGetTextFromFile[0]:
				continue	
			if szText == szGetTextFromFile[0]:
				chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Blocked words were introduced!")
				return
			#if szText == szGetTextFromFile[0] and szText.find("b") != -1:
				#chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Check Function Test 1!")
				#return
			#iText = szGetTextFromFile[0]
			#if text and iText.find(" ") != -1:
			#if szGetTextFromFile[0] and text.find("a"):
			#if iText.strip().split(" ")[1] == text[-1:]:
			#test = self.GetText()
			#if szGetTextFromFile[0]:
				#if test.find(" "):
				#szText = szText.replace(" ", "____")
					#chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Check Function Test 2!")
					#return
			#if szText.find("vegas") != -1:
				#iText = str(iText).replace(" ", "pythonX")
locale/en/block_words_python.txt

Code:
text0
text1
text2
text3
text4
text5
text6
text7
text8
text9
text10
text11
text12
text13
text14
text15

-------------------------
Method 2 (xP3NG3Rx):

Code:
	import app, chat
	szText = "banword"

	fHandle = app.OpenTextFile("locale/en/block_words_python.txt")
	if not fHandle:
		return False

	if szText in [app.GetTextFileLine(fHandle, i).strip() for i in xrange(app.GetTextFileLineCount(fHandle))]
		chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Blocked words were introduced!")
		return
06/22/2016 16:34 悪地城#2
Thanks
06/22/2016 23:32 Laben#3
thanks
06/24/2016 23:12 MaxChri#4
Pretty useless, have a watch in locale\**\insult.txt. As you can see it's almost the same.
06/25/2016 00:33 VegaS ♆#5
Quote:
Originally Posted by MaxChri View Post
Pretty useless, have a watch in locale\**\insult.txt. As you can see it's almost the same.
With this script you can add any tape you want to check text such as:
- Box friendship request
- Box declaring war
- Box quest input
- You can block other value like a number 9,123,42,etc etc, or other sentence or words etc.
- Any other box that includes a InputValue

You need only change:
Code:
​
szText = self.GetText()
​
With this:
Code:
szText = self.yourInputValue.GetText() # Obtaining the text that you wrote in the same box
----------

And about ''As you can see it's almost the same.''

For loaded insult you need to load like this:
Code:
		if net.IsChatInsultIn(text):
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
Code:
bool CInsultChecker::IsInsultIn(const char* c_szLine, UINT uLineLen)
{
	for (UINT uPos=0; uPos<uLineLen;)
	{
		BYTE bChr=c_szLine[uPos];
		if (bChr & 0x80)
		{
			if (__IsInsult(c_szLine+uPos))
				return true;
			uPos+=2;
		}
		else
		{
			if (__IsInsult(c_szLine+uPos))
				return true;
			uPos++;
		}
	}
	return false;
}
I apologize for my English, a beautiful day still.
06/25/2016 00:42 fcsk_aim#6
Quote:
Originally Posted by MaxChri View Post
Pretty useless, have a watch in locale\**\insult.txt. As you can see it's almost the same.
Where is dislike button when you need it ?