mIRC Home    About    Download    Register    News    Help

Print Thread
#240736 24/02/13 03:09 AM
Joined: Feb 2013
Posts: 1
F
Firzen Offline OP
Mostly harmless
OP Offline
Mostly harmless
F
Joined: Feb 2013
Posts: 1
Hi all,

Im fairly new to the whole IRC scripting but i'm getting better by the day as i sort of enjoy it.
Now i've stumbled upon a problem and i need help if anyone is kind enough.

I've created a bot which works great but im stuck with one command which im not able to find out.

For example i want to say this command
!kill (nick)

And the response is in 2 lines for example

Me: !kill blabla
Bot: Firzen killed blabla
Bot: Firzen could not contain blabla's backfire

But i want it to be a random response of the bot, ive read trough the forum about $random and putting this in .txt file but that is only 1 line response that the bot will give.

I want the bot to give random responses such as this one or the one mentioned above or more similar responses like this.

Me: !kill blabla
Bot: Firzen shot blabla but he survived.
Bot: Blabla shot back but missed Firzen completly.

This is where im stuck, i only can get one response back from the bot and not random respones, im sure there is such a thing as ive seen it on other channels but it doesnt work for me

Sorry for the long read.
Thanks in advance


Firzen #240738 24/02/13 03:32 AM
Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
One way is to add a seperator (something which will never be part of any responses such as $chr(1) - "") to the lines in the text file.

Example.
//write some.txt Response1 $+ $chr(1) $+ Response2
//tokenize 1 $read(some.txt) | msg # $*

Of course the 2 responses will always be the same pairs this way.

Deega #240755 24/02/13 11:27 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Should probably use the 'n' flag in $read:

Code:
//write test.txt $!time | echo -a No n: $read(test.txt) N: $read(test.txt,n) | remove test.txt


Output: "No n: 23:26:40 N: $time"

Wouldn't want it to evaluate pesky identifiers if the file is written based on what other people say.


Link Copied to Clipboard