Page 1 of 15

Kadiliman Plugin v 1.3 - ChatBot by Kali

Posted: 04 Apr 2008, 14:39
by Mucilon
Here we go again... luck me, I have saved this on file! :D

If kaliwanagan (now know as Kali) allows me, I'll post his plugin, which I made some improvements.
Kali, please change this description, if you want to or find something wrong.

What it does:
This plugin was made to answer any chat (public, pm, party, guild or system) based on what the bot "knows", which means, the bot "learn" to talk. Every sentence it receive will be recorded at a file, "learning" from other players and it use some kind of comparation logic to choose which sentence from this file it will use to answer the player. This way, you can teach the bot to talk writing this file or can leave it at any city "learning" from public chats, so as big as your file is better it will convince some player, but be aware, you probably won't convince a GM, just the most of players.
If you read this and still have doubts, search at old forum topic: http://bibian.ath.cx/openkore/viewtopic.php?t=9304

Version 1.0
First version made by Kaliwanagan was maint to answer any chat (public, pm, party, guild or system) based on the words of the chat received from other players.
- Choose the name of file to record all the sentences of each bot, so they can have a diferent personality! :?
- Enable or disable the answer to any kind of chat.
- Rate to answer, type speed configurable.
- Rate to include at the end of bot answers a smiley and input any smiley you want.
- Option to turn on / off the learn state.

Version 1.1
Improvements made by me:
- Included inLockOnly to answer to plublic chat, so you won't spam at cities.
- Disable the plugin to learn from system chat, so you won't speak exatly the sentences from the server messages to other players, but you will be able to answer to system chat, if you want to.

Version 1.2
Improvements made by me:
- Included noPlayers option, where you can not answer any player you write at here comma separeted and regexp supported, very good to bot party members.
- Included noWords option, where you can not answer any player you write at here comma separeted and regexp supported, very good to don't spam, when some player asks for buff at your side or to your priest party member.

Version 1.3
Improvements made by me:
- Included timesToBlockPM option, where you can block/ignore any player that pmed you more then this option times, so don't wory with those anoing players that keep sending pms to you.
- Included timeToResetCount option, time in seconds to reset the chat count, so every this option seconds the count of chats received from every players will be reseted.


How to Install:
1) Download the 2 files.
2) Copy the kadiliman.pl file to openkoreroot\plugins directory.
3) Create a directory named Chatbot at openkoreroot\src directory.
4) Copy the Kadiliman.pm file to this Chatbot directory.
5) At config.txt see below at how to use.


How to Use:
Use this exemple at config.txt.

Code: Select all

chatBot Kadiliman {
       inLockOnly 1		# (0|1) Just answer to public chat at lockmap, pm will be answered normally
       scriptfile lines.txt	# Name of the file where all sentences are storage, it will be create at openkore root directory
       replyRate 80		# (0..100) Rate to answer, 80 means: answer 80% of chats and don't answer 20%
       onPublicChat 1		# (0|1) Enable to answer any plublic chat
       onPrivateMessage 1	# (0|1) Enable to answer any private message
       onSystemChat 1		# (0|1) Enable to answer any system message
       onGuildChat 1		# (0|1) Enable to answer any guild chat
       onPartyChat 1		# (0|1) Enable to answer any party chat
       wpm 65		# Don't need to change - words per minute, simulate typing speed
       smileys ^_^,xD,^^,:),XD	# Smileys that may end your sentences on chat (separeted by commas)
       smileyRate 20		# Rate to add smiley to the sentences, means: add smileys to 20% of messages
       learn 1		# This plugin can "learn" every sentence read by the bot, this sentences are storage at the scriptfile
       noPlayers , ,		# Name of the players (supported by regexp) you don't want to answer any thing, like party members (separeted by commas)
       noWords  , , , 		# Words (supported by regexp) at the chats you don't want to answer, like "bot", "heal", "buffs" or something like this (separeted by commas)
       timesToBlockPM 10	# Number of times of pms received by each player to ignore him, work just to pm
       timeToResetCount 300	# Number of seconds to reset the count to ignore any player, with zero it won't reset
}
Tip: If you use more then 1 bot at a time, you must input diferent file names to each one. That is because, when the bot is running, it do not keep writing the file, it just write the file when the bot is closed. So only the sentences learn by the last closed bot will be recorded, if they use the same file name.

Files:

[The extension pl has been deactivated and can no longer be displayed.]

[The extension pm has been deactivated and can no longer be displayed.]

I hope you enjoy it! ;)

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 04 Apr 2008, 19:58
by -Fallen-
first time trying this out.asked this question before the forum was wiped again. first off, by creating a directory in my openkore folder, does that just meanc create a new folder and renaming it Chatbot? also, for the first line of txt that u included, do i add that into my config.txt? or..what do i do with it? help appreciated :D

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 05 Apr 2008, 18:06
by Mucilon
Yep!
At openkore folder you will find the src subfolder, inside of it you create a directory and rename it to Chatbot.
About the file, you must input the name of the file at scriptfile option, this file will be created automatically at openkore root folder.

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 06 Apr 2008, 00:59
by fco2783
Mucilon wrote:Yep!
At openkore folder you will find the src subfolder, inside of it you create a directory and rename it to Chatbot.
About the file, you must input the name of the file at scriptfile option, this file will be created automatically at openkore root folder.
could you post your some set up for this...

chatBot Kadiliman {
blah blah blah...
}

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 06 Apr 2008, 04:22
by Cadeath
I have use d Kadiliman Plugins before...

I have found a bug...
I just view my log and the bot says
@random("tae n dc","wa dc map", "aw", "wtf", "haha",
@random("tae n dc","wa dc map", "aw", "wtf", "haha", "lol", "dc heh","ampz","amp
@random("tae n dc","wa dc map", aw
Hmmm any idea?

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 07 Apr 2008, 07:46
by Mucilon
fco2783
You can find an exemple at How to use on the first post, you can take the comments off, if you want to.
This is the code I use at config.txt:

Code: Select all

chatBot Kadiliman {
	inLockOnly 1
	scriptfile lines_APP.txt
	replyRate 80
	onPublicChat 1
	onPrivateMessage 1
	onSystemChat 0
	onGuildChat 0
	onPartyChat 0
	wpm 65
	smileys :D, :), XD, ^^, xD, \o/, o/
	smileyRate 20
	learn 1
	noPlayers BotParty
	noWords /buf/i, /agi/i, /cura/i, /a(s|ss)u/i, /bot/i, /ks/i
	timesToBlockPM 10
	timeToResetCount 300
}
Cadeath
I don't get it...
What happen?
1) Did your bot said these sentences randomically? Like: tae n dc and other time wa dc map and so on...
In this case, it may be repeating this sentences because the file has just this sentences. I mean, the plugin will choose 1 sentence among those inside the file, if there are just 5 sentences, it will repeat his messages a lot... you must input another ones or leave it some time at any city with the ai off, so it won't answer, but will record the file.

2) Did your bot literaly said: @random("tae n dc","wa dc map", "aw", "wtf", "haha",?
In this case, these sentences are inside the file, open it and edit, taking it off! If this sentences are not inside the file, then this must be a bug, that I have never seen on this plugin. If so, turn on the degug to 1 and post the console log.

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 07 Apr 2008, 08:42
by -Fallen-
still having errors.i have placed the the exact lines into config.txt as well as "saved paged" the kadiliman.pl and kadiliman.pm file.i placed the kadiliman.pl in the plugins folder along with my macro folder, as well as my macro.pl file. i also created a new folder in src, renamed it Chatbot, and placed the kadiliman.pm inside.yet, when i start the thing, i get an error

<missing operator before content?>
Bareword found where operator expected at c:/documents and settings....desktop/openkore.....plugins/kadiliman.pl line 10, near ""resource-type" content'
<missing operator before content?>
etc etc..

can anyone tell me what might have gone wrong? =/

Image

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 07 Apr 2008, 09:06
by Mucilon
Weird, it seems to be installed ok...
Unfortunately I can't see images from imagesshack (firewall), can you post the error log from the file erros.txt at openkore root?

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 07 Apr 2008, 09:50
by -Fallen-
thanks for the reply dude.um.strangely enough, there does not seem to be an error log. however, in the console itself, there was this msg:

The error message is:
Plugin contains syntax errors:
Unrecognized character \xE2 at c:/documents and settings/acer/desktop/openkore-2.0.5.1/plugins/kadiliman.pl line 14.

Press ENTER to exit this program.

also, heres a link to image shack if u cant see hte image :D
http://img385.imageshack.us/img385/830/40410498si7.png

Re: Kadiliman Plugin v 1.3 - ChatBot

Posted: 07 Apr 2008, 10:12
by Mucilon
First, I can't access the imagesshack domain, so the link doesn't solve the problem, I'm writing from work and the firewall blocks this domain.
About the error message, it is moving, at your other post it triggered at line 10 and now it is at line 14... did you change the file kadiliman.pl or just copied a diferent line of the error text...
Did you try copy the code and paste at the file again?
If your openkore has stopped with this error, then the error log was generated at errors.txt.
Please copy and paste the error log, without it I can't do any thing!

EDIT: Don't know how but I found an error, change this:
replace this: use Log qw(message warning error);
to this: use Log qw(message warning error debug);
at kadiliman.pl.