Jump to content

Auto chat responder


sirskitzo
 Share

Recommended Posts

If I am about to implement an auto chat responder to my script, how do I know if the chat was directed to me? I will start by adding something. Maybe

  • If they call the character name
  • If my character and the messager positions are close
  • If they say hi/bot/lvl, what else?

Questions:

What are good auto chat responder ideas and ways to deal with it?

How to handle incoming text?
 

I have my own ideas and I would like to hear your suggestions guys.

After every update, I am uploading progress logs. Currently in a JFrame for debugging as still under development. Any other suggestions/notes are welcome and muchly appreciated.

Spoiler

Spoiler for logs

Screenshot_2.jpg.a0072262b20dc0d34735eca764afad8e.jpg

 

 
 

Thanks to everyone!

 

 

Edited by sirskitzo
Link to comment
Share on other sites

@Fibonacci @nvrsince haha yeah that is true. I am still thinking of a good way to determine whether the message is to me or not. If I find a good way, I will share the code with you guys! Currently, it has the ability to answer almost most of messages being asked and interacts with chat.

Edited by sirskitzo
Link to comment
Share on other sites

You can take into consideration time and also if you have already answered the persons question (-Is it just the two of you in an area, or multiple people and someone @ you. 

Spoiler

PersonOne: Yo sup

You: Yo

PersonOne: Yo sup

You: (nothing)

PersonTwo: Yooo

You: sup

You could probably find a large list of generic responses to generic questions. Phrases wouldn't be exact so you have to match case with a certain percentage of accuracy. 

There's so many dam chat bots, you could maybe implement that into your bot, who knows (instead of above). 

Link to comment
Share on other sites

2 hours ago, sirskitzo said:

If I am about to implement an auto chat responder to my script, how do I know if the chat was directed to me? I will start by adding something. Maybe

  • If they call the character name,
  • If my character and the messager positions are close
  • If they say level/lvl, what else?

What are good auto chat responder ideas and ways to deal with it? I would like to hear suggestions.

 

 

-Insert an array of nicknames or close matches to your name. If you wanna get real technical, add a variance of one or two characters for the cases where they make a typo.

-Just get the player data of the person who sent the chat using the API, and check that their distance to you is within a desired range using Map class

-Make sure you add a reasonable (and semi random) delay in responses so you aren't having instances where you respond too fast.

-Make sure you have a large array of similar responses so that you aren't just saying the exact same things over and over. Also make sure you add repeat question detectors. What happens if someone decides to test if you're a bot by trading you or getting you to say the same thing over and over.

Link to comment
Share on other sites

@Juggles Thanks but that was not my question.
@Deceiver Not about being anti-ban. Might be a waste of time, yes, but just a feature -> practicing coding.
@Jammer @I am not a @dreameo I like these methods they now are implemented and works fine thanks!

Any more ideas would be appreciated. I will keep my post updated with more information and a screen of chat later once there is an improvement. Also, I would like to ask if anyone has any suggestions on the way to handle incoming messages? What I mean is I now have a list of expected incoming messages and then when I get a message in-game I search if one of them equals to it, if not check if it consists. You know people can type something like "What ya doing","what r u doin?". Thanks again!

Link to comment
Share on other sites

6 minutes ago, sirskitzo said:

@Juggles Thanks but that was not my question.
@Deceiver Not about being anti-ban. Might be a waste of time, yes, but just a feature -> practicing coding.
@Jammer @I am not a @dreameo I like these methods they now are implemented and works fine thanks!

Any more ideas would be appreciated. I will keep my post updated with more information and a screen of chat later once there is an improvement. Also, I would like to ask if anyone has any suggestions on the way to handle incoming messages? What I mean is I now have a list of expected incoming messages and then when I get a message in-game I search if one of them equals to it, if not check if it consists. You know people can type something like "What ya doing","what r u doin?". Thanks again!

Bots aren't human, they can't  know if "what ya doing" and "what r u doing?" are the same thing. 

You have to program both of them so it knows 

Link to comment
Share on other sites

a friend off mine did make something like this on a game called Tibia.. i will post all stuff the whole text lal... this is not java based. But a simpel how it can be done xD

 

 

k = {"spanish?", "spanish ?", "span?", "spanol?", "spanol?", "spanol ?", "spanol ?"},
			r = {{"no", "nope"}, {"nope man", "nopss", "no man bb"}}
		},
		{
			k = {"hi", "hai", "hello", "sup", "yo", "yoo", "hiho", "HI", "HELLO", "SUP", "YO", "YOO", "HIHO", "HAI"},
			r = {{"hi", "hello", "hiho", "yo", "sup"}, {"i said hi", "already said hi", "sup, again"}, {"ok man, this is getting boring", "this is boring man", "damn stop saying hi"}}
		},
		{
			k = {"use bot?", "use bot ?", "use bot", "bot?", "bot", "botter", "bottter", "botterrr", "botting", "you are bot", "you're bot", "your bot"},
			r = {{"me?", "me ? lol", "no man", "you wrong", "you're wrong", "i dont bot"}, {"leave plz", "stop dis or ignored", "gtfo", "stop plz", "annoying :["}}
		},
		{
			k = {"auto respond", "auto responder", "auto respond ?", "auto respond?", "auto responder?", "auto responder ?", "auto-respond", "auto-responder", "auto-responder?", "auto-responder ?", "auto-respond?", "auto-respond ?", "auto talk", "auto-talk", "auto talk?", "auto talk ?", "auto-talk?"},
			r = {{"no, just type and do enter", "lol man", "lol wtf is this?", "lol'ed now", "oh tibia have that ?", "hahaha"}, {"whatever", "stop dis pls", "byee"}, {"i'm sirious now", "stop or ignored"}}
		},
		{
			k = {"no kill", "plz no kill", "dont kill", "i'm skilling", "im skilling", "im skill", "plz no kill", "i'm skill", "man no kill", "ks?", "ks", "ks lol", "dont ks", "don't ks"},
			r = {{"sry i need exp", "i need all exp", "all exp is mine", "leave plz i need exp"}, {"i will kill everything", "i kill what i want", "ks is fun"}}
		},
		{
			k = {"noob", "n00b", "nb", "noob -.-", "n00b -.-", "noobie", "newbie", "nb plz", "noob plz"},
			r = {{"noob u", "noob you", "nab", "sure noob", "-.-"}, {"whatever", "w.e", "ok man bb", "noob gtfo"}, {"aff", "boring", "i'm mad now"}}
		},
		{
			k = {"whats my name?", "what is my name ?", "what is my name?", "what's my name?", "what's my name ?"},
			r = {{"look on your character lol", "your name is noob", "u dont know how to read ?"}, {"lol man u know your name", "u know your name stop spam", "stop spam man"}, {"look on your screen and read", "such a noob"}, {"ok now i'll ignore you"}}
		},
		{
			k = {"going to delete you", "going to delete your char", "i'll delete your char", "i will delete your char", "i'll ban you", "i'll ban u", "going to ban you", "going to ban u"},
			r = {{"omaiga", "so you're a gm..", "no you're not", "ok man do what u want"}, {"come back tomorrow", "stop man bb", "stop spam"}, {"next msg like this = ignore"}}
		},
		{
			k = {"fuck you", "fuck u", "fuk you", "fuk u", "fak you", "fak u", "fak", "fuck", "damn you", ".i.", "..i..", ",,i,,", ",i,"},
			r = {{"not nice man", "stop", "i dont like that"}, {"sounds like a you dont like me", "stop or ignore", "stop or reported", "reported"}}
		},
		{
			k = {"leave", "leave plz", "leave man", "leave pls", "leavee"},
			r = {{"nop", "sry no", "nonono", "can't", "i'll stay", "sry bb"}, {"no man byee", "i will hunt now", "i am here now begone"}, {"damn can't your see ? i'm here now", "B.Y.E"}}
		},
		{
			k = {"lol", "rofl", "lmao", "ftw", "wtf", "haha", "hehe", "LMAO", "ROFL", "LOL", "loled", "lol'ed", "lul", "lool", "luls", "lulz", "lols"},
			r = {{"haha", "lul", "lool", "hehehe", "rofl", "roflmao", ":)", "^^", ":]", ":>"}, {"haha", "lul", "lool", "hehehe", "rofl", "roflmao", ":)", "^^", ":]", ":>"}, {"haha", "lul", "lool", "hehehe", "rofl", "roflmao", ":)", "^^", ":]", ":>"}, {"haha", "lul", "lool", "hehehe", "rofl", "roflmao", ":)", "^^", ":]", ":>"}, {"ok, i like to smile but it's enough let me alone now", "ok but now let me alone", ":) well i'm going, cya"}}
		},
		{
			k = {"how do you type?", "how do you type ?", "how you type ?", "how you type?", "how to type?", "how to type ?"},
			r = {{"type text and do enter", "u need something special", "u need to be special", "with fingers", "with hands"}, {"lol stuff you said", "man i need to hunt alone", "bb or ignored"}}
		},
		{
			k = {"whoa you're so fast", "wow you're so fast", "you type really fast", "you type fast", "so fast you type", "type fast", "you're so fast", "your fast", "so fast"},
			r = {{"yeah i train a lot", "ye imma hell of a racemachine", "yes i do"}, {"i said that i'm fast", "ye already said that, i'm really fast", "i'm so fast that i can hunt and talk to you :)"}, {"ok man..", "ye you know", "true.."}, {"i'm getting tired of this", "ok man now bb"}}
		},
	}

	table.insert(Config.SafeList, $name)
	table.lower(Config.SafeList)

	function table.findtext(self, v)
		local c = table.find(self, v)
		if not c then
			for i, k in pairs(self) do
				if v:find(k) or v:lower():find(k:lower()) then
					return i
				end
			end
		else
			return c
		end
		return nil
	end

	-- we want to simulate a human typing
	-- so when fasthotkeys are enabled they're
	-- typed so fast that the sender will
	-- know you're actually botting, this will
	-- simulate pressing time if fasthotkeys
	-- are enabled. (Took from Raphael's lib)
	local function __waitcast(msg)
		if $fasthotkeys then
			local t = 0
			local minWait, maxWait = get('Settings/TypeWaitTime'):match(REGEX_RANGE)
			minWait, maxWait = tonumber(minWait), tonumber(maxWait)

			for i = 0, #msg do
				t = t + math.random(minWait, maxWait)
			end

			return wait(t)
		end
	end

	local fileName = sprintf('[%s] - Auto Responder.txt', $name)

	if Config.LogText and not file.exists(fileName) then
		file.clear(fileName)
	end

init end

auto(1000, 1200)

foreach newmessage m do
	if table.find({MSG_DEFAULT, MSG_WHISPER, MSG_YELL, MSG_PVT}, m.type) and (not table.find(Config.SafeList, m.sender:lower())) and m.level >= Config.MinLevel and os.difftime(os.time(), Responder.Timer) >= 2 and (not Responder.Ignored[m.sender]) and #spellinfo(m.content).words == 0 then
		if Config.LogText then
			file.writeline(fileName, string.format("RECEIVED: [%s] VIA: %s FROM: %s CONTENT: %s", m.timestr, m.type == MSG_PVT and "Private" or "Local Chat", m.sender, m.content))
		end

		for State, Entry in pairs(Responder.SpeechWords) do
			if table.findtext(Entry.k, m.content) then
				if Responder.MessageInfo[m.sender] then
					if Responder.MessageInfo[m.sender][State] then
						if not Responder.SpeechWords[State].r[Responder.MessageInfo[m.sender][State] + 1] then
							Responder.Ignored[m.sender] = true

							local msg = ({"ignored -.-", "ignored"})[math.random(1, 2)]

							if not Config.IgnoreMonsters then
								while maround(1, false) > 0 do
									wait(100, 200)
								end
							end

							if m.type ~= MSG_PVT then
								__waitcast(msg)
								say("Local Chat", msg)
							else
								__waitcast(msg)
								say("Local Chat", string.format("@%s@ %s", m.sender, msg))
							end

							if Config.LogText then
								file.writeline(fileName, string.format("SENT: [%s] VIA: %s FROM: %s TO: %s CONTENT: %s", m.timestr, m.type == MSG_PVT and "Private" or "Local Chat", $name, m.sender, msg))
								file.writeline(fileName, string.format("IGNORED PLAYER: [%s] NAME: %s", m.timestr, m.sender))
							end

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, Juggles said:

Bots aren't human, they can't  know if "what ya doing" and "what r u doing?" are the same thing. 

You have to program both of them so it knows 

..No you don't. Many basic chat bots can easily know the difference and that's not done by hard coding each and every type of phrase.

From the first random chat bot I attempted:

https://imgur.com/a/9mqP3

Link to comment
Share on other sites

18 hours ago, sirskitzo said:

@taraz Haha thanks for this bro, will be very useful. However, I don't understand anything from this code but liked the chat array system.

k = {"hi", "hai", "hello", "sup", "yo", "yoo", "hiho", "HI", "HELLO", "SUP", "YO", "YOO", "HIHO", "HAI"},
r ={{"hi", "hello", "hiho", "yo", "sup"}, {"i said hi", "already said hi", "sup, again"}, {"ok man, this is getting boring", "this is boring man", "damn stop saying hi"}}

k means other players -- R means the bot /Your bot...

 

Si if someone say Hi the bot will respond Hi. if someone say Hai it will say Hello.

 

you just how to look down at r and look up k to see what it will say :P hope i explained it good ahha

Link to comment
Share on other sites

  • Night locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...