mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Ingredients:
1.5kg Chicken breasts or chicken joints, skinned and washed
1 heaped tablespoon of finely grated fresh ginger
3 crushed cloves of garlic
150g thick natural set yogurt
3 dried red chillies
2 finely chopped onions
cooking oil
1 tbsp ground coriander
a pinch of ground black pepper
1 tsp turmeric
1 tsp garam masala
water
75g creamed coconut
salt, to taste
2 heaped tbsps ground almonds
finely chopped coriander leaves, to garnish
Squeeze of lemon juice

Instructions:
1. Cut the chicken breasts into bite sized chunks or, if using joints, separate leg from thigh.
2. Mix the chicken with the ginger, garlic and yogurt. Cover and marinade for 3-4 hours or in the fridge overnight.
3. Liquidise the chopped onion and red chillies, adding water if needed, to make a smooth paste.
4. Heat some oil in a pan.
5. Add the ground coriander, ground black pepper, turmeric and garam masala and stir fry for about 1-minute over a low heat.
6. Turn up the heat, add the onion and chilli paste and stir fry for 10-minutes.
7. Add the chicken and the marinade and continue to stir fry for another 10-minutes.
8. Add the creamed coconut and enough water to cover the chicken and bring to the boil, stirring until the coconut is dissolved.
9. Reduce heat to low, cover the pan and simmer until the chicken is tender (30-40 minutes).
10. Remove from heat, stir in the ground almonds, lemon juice and salt to taste. Mix well.

Serving ideas: Garnish with coriander leaves and serve with Onion Bhaji and Pilau Rice or Rotis.

Suitable for freezing.

Next time: google for yourself :p

Last edited by noMen; 16/09/07 06:25 PM.
Joined: Sep 2006
Posts: 14
N
negeren Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2006
Posts: 14
I just don't get the coding that is involved, I mean I have been researching this for about 8 months now. I have seen many bots and have even searched thru the AI brains of some pearl scripts. and am still no closer to getting this. the pearl bots tho are great I just need to figure out how the coding in the pearl bots transfer to the mIrc coding and then I would have a much better understanding of how I need to write this.

Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Obviously you want to know how I did it (take a cup of coffee and read):

I've put all the phrases and words that should be recognized in an .ini file (main), the answers the bot should give in another .ini file (answer) and special words and phrases for second level dialogues in a third .ini file (special).

The main file contains three sections in which I store words and phrases for direct conversation (somebody calls the bot and talks to it), interference (nobody calls the bot, but the bot sometimes reacts to something that is said, f.i. somebody says "i'm going to sleep" then the bot could say "have a good night") and random replies (when there is no direct conversation and nobody said something that could be recognized then the bot sometimes smiles, yawns or says "brb, I have to kick the cat outside"). I will explain later how I organized the words and phrases in these sections and how I organized the answers and special dialogues.

The script contains two main parts: an event handler and a dialogue handler. The task of the event handler is to prevent that the bot reacts to everybody and everything, to simulate human behaviour (or better: average chatter behaviour) and to recognize phrases and words. If something could be recognized it passes the matched string to the dialogue handler and tells the dialogue handler what kind of conversation is going on (direct, interference or random). I will explain later how the event handler uses timers to simulate chatter behaviour.

The dialogue handler generates answers, performs functions to incorporate into the answers and tells the event handler what to do next. Every answer in the answer file contains some special characters, with which I can influence the event and dialogue handler. Most of these codes only have effect to the dialogue handler, e.g.:
- give the answer immediately (for helpdesk channels) or delayed
- don't make syntax errors in this answer (e.g. for helpdesk channels, btw the bot can have several kinds of conversations in several rooms concurrently)
- issue this answer as a message or an action
- fill in the nickname, time, date, result of a calculation, etc
- execute a command together with this answer (/kick, /dcc send, start a game, tell a joke, etc.)
- find out the chatter's sex (formal replies for helpdesks - sir, madam - or informal replies - honey, stud -)
- go into a second level dialogue
... and more.

There are 4 codes in answers that can be passed to the event handler:
- keep on listening to this chatter, conversation is not finished
- ignore this chatter, conversation with him is over
- be quiet for a number of minutes
- find out yourself what should happen next

The event handler uses a number of timers to simulate chatter behaviour and can listen to only one, two or another maximum number of chatters. These parameters are stored in a separate .ini file. The most important timers it uses are:
- listen to one chatter only during a certain number of seconds (direct conversation when somebody called the bot's name or the dialogue handler told to do so)
- don't listen to anybody until the last (delayed) answer has been put in the channel (the bot does one thing at a time: òr listening òr answering)
- when somebody joins the channel, listen for some time to everybody, no matter if there is a direct conversation going on (newcomers can take over a conversation)
There are more timers, but I have to dive into details to explain them.

I use some parameters to define the reaction level for the event handler. When somebody calls the bot's name, the event handler will stick to that chatter, but if not it will randomly try to find out whether it can interfere or should trigger a random answer. Otherwise it will randomly try to combine two sentences from its log based on the first three words of a chatter's sentence (I explained this in one of my earlier replies). This gives quite varied behaviour.

Now I come back to the organization of phrases, words and answers. These are stored in three .ini files: main, answers and special. I can have several groups of these files, a group for normal channels, several groups for several heldesk channels, groups for word-games, groups for operator channels (the bot can present a menu that contains commands to execute in another channel were the bot is joined as an operator), etc.

The main .ini file contains three sections, one which contains phrases and words to be recognized during direct conversations, one which contains words to be recognized when the bot is going to interfere and one which is used when the bot has to generate a random answer. Every section contains a number of items in which the phrases and words to be recognized are stored.

For direct conversations I use three kinds of items: one kind with regex matchstrings which enables the bot to recognize a variety of sentences with the same meaning, one kind that contains words or phrases that have to be recognized completely and one kind that can be recognized partially. The event handler searches these in a strict order: first direct regex, then direct full recognition, then direct partial recognition, then interfere and at last random. An example:

main .ini file (note that an item is restricted to contain about 900 characters):
[DIRECT]
INDEXR1=matchstring1 matchstring2 matchstring3 ....
INDEXR2=matchstringn matchstringn+1
INDEXRn=etcetera
INDEXCn=fullword fullphrase etc
INDEXPn=partialword partialphrase etc.

[INTERFERE]
INDEXPn=partialword partialphrase etc.

[RANDOM]
RANDOM=randomanswer1 randomanswer2

Each matchstring, fullword/phrase and partialword/phrase refers to one or more answers, which are picked randomly by the dialogue handler, for instance:

[DIRECT]
INDEXR1=matchstring1 matchstring2 matchstring3 ....
matchstring1=1 2 3 4
matchstring2=5 6
matchstring3=7 8 9 1 3
INDEXR2=matchstringn matchstringn+1
matchstringn=10 5 9 12
matchstringn+1=11 12 7 9
etc.

Answers are stored in a separate answer .ini file (except for random answers which are in the main .ini file) like this:

[ANSWERS]
1=answer1-1 answer1-2 answer1-3...
2=answer2-1 answer2-2...
etc.

This gives very varied answers. First the dialogue handler picks a random answernumber from the main .ini file, then it picks a random answer from the answerfile belonging to that number.

I can also refer to answers in other groups, by using:

INDEXR2=matchstringn matchstringn+1
matchstringn=10+CHATROOM1 5+HELPDESK1 9+HELPDESK2 12+WORDGAME1

For second level dialogues I use a special .ini file which has about the same structure as the main .ini file. But in the special .ini file only words and phrases are stored that belong to a certain type of conversation. For instance, the dialogue handler picks an answer that contains a special code plus name for a second level dialogue, like in:

[ANSWERS]
123=answer123-1 answer123-2*KICK

I use this when somebody talks about a footballclub which is not the bot's favorite club. Answer123-1 could contain something like: "don't talk about that club". Answer123-2*KICK could contain: "you want to win an award? if not, stop talking :)". Then it would dive into the special KICK dialogue to find out whether the chatter keeps on nagging the bot. If so the chatter gets a chance to be kicked. Btw, there is a special timer which tells the event handler how long to stay in a second level dialogue, otherwise the bot would could get lost and never come out of it.

There is more to tell, but that would be too detailed.

As you can understand, this is not a self learning botscript, almost everything is predefined. I watched a lot of conversations between human chatters to find out what kind of matchstrings, words and phrases I should add to the bot. Most conversations are like: hello, how are you, how old are you (what is your age), what have you eaten (the bot will answer according to the actual time: in the morning he had a breakfast, in the afternoon lunch and in the evening some kind of hot dish), can I have a picture of you (I want a picture of you, please send me a picture), what is your favorite thing, where do you live (where do you come from), what are you doing now. My bot is capable of answering these kind of questions and ask meaningful questions too. But for a self learning bot you will need a kind of event and dialogue handler as described above plus an analyser that is capable of analyzing natural language. And such an analyser is very difficult to script. Also it would cost you a lot of time to learn the bot talking.

English is not my native language, I hope I made myself clear. Good luck!

Last edited by noMen; 18/09/07 10:15 AM.
Joined: Sep 2006
Posts: 14
N
negeren Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2006
Posts: 14
ok can anyone tell me how to referance the last output I.e.
Code:
/msg $chan wait how much

I sent to a static value so I can use it as a piviot to a new responce
Code:
on *:text:$100:#: {
  if (%pretext == how much) {
    set %tk $rand(1,2)
    if (%tk == 1) { /msg $chan that is alot. }
    if (%tk == 2) { /msg $chan that is expensive. }
  else { /msg $chan how much }
  }
}

like using the last value as a topic in descussion.

Last edited by negeren; 20/09/07 11:17 PM.
Joined: Sep 2006
Posts: 14
N
negeren Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2006
Posts: 14
I have tried the $recall and /recall to set it in the %pretext but not working

Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Ehmm .. I'm not sure that I understand what you mean, but I think you need something like this:

Code:
on *:text:$100:#: {
  if (%pretext == how much) {
    set %tk $rand(1,2)
    if (%tk == 1) { set %pretext that is a lot. }
    if (%tk == 2) { set %pretext that is expensive. }
    msg $chan %pretext
  }
}


But this is not the best way to have your bot talking, you will end up with dozens of on text events. And what to do if somebody says: $200? Or $1000?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: negeren
ok can anyone tell me how to referance the last output


Your best option would be to use a hash table. Automatically store the last 2 lines of text from every person. When you get a new line from that person, it moves the last text to the second to last and then writes the new text. Hm... that's confusing... here's a visual example:
Quote:

Hash Table: SpokenText
Item=Data
Riamus.1=This is the last thing I wrote.
Riamus.2=This is what I wrote before what was written in Riamus.1.

Now, if I wrote "This is my new text.", it would look like this:
Quote:

Hash Table: SpokenText
Item=Data
Riamus.1=This is my new text.
Riamus.2=This is the last thing I wrote.


See how it moves the stuff around? That lets you look back at the last 2 things said in order to keep track of what's going on.

From there, you can have your bot set a variable whenever it asks a question. Something like %asked.Riamus = wait_how_much . I'd probably set the variable to automatically unset after a couple of minutes since the person isn't likely to respond after that and you don't want them to type something 2 hours later and you respond to them. Then when I type something new, you check for %asked.Riamus (obviously Riamus would be $nick) and see if it's set. If so, it will check what the variable is set to in order to know what question was asked. Then, you can call an alias that has the same name as the variable's data and it will check what was said by the nick and if it fits a given criteria (has to include a number in this case), it will respond appropriately based on the question.

The hash table is there so that you can easily look back and use part of what they said previously. Something like...
Quote:

Riamus: I made a lot of money today.
Bot: How much?
Riamus: $500
Bot: You made $500? That's a lot.

The blue is taken from the previous text, the red is taken from the latest text. It lets your bot sound more realistic. Of course, it's also more complicated making it valid, but if you want it to be realistic, that's your best option.

Don't forget to unset your %asked.nick variable after the bot replies.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2006
Posts: 14
N
negeren Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2006
Posts: 14
oooo hash tables ok I will try that. see I'm trying to convert some aiml files to msl and was trying to find a working substitute for the <that> command. this commad states that if a user says 100 then the bot responds how much. when the user says 100 the bot now responds wow that is expensive. or if the bod ask so what kind of job do you do. the user responds I'm a vet. the bot then asks questions about that job. but the hash tables should work I think.
ty

Page 2 of 2 1 2

Link Copied to Clipboard