|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
Im working on a script that makes the bot read what txt people have wrote then when his bname is mentioned he responds with a line made up out of random text i cant figure out how to make him read the words then put then on seperate lines :P any help is much apetiated
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
on *:TEXT:$($+(*,$me,*)):#: msg $chan $read(Filename.txt) This *should* read a random line from Filename.txt when the bot's nick is mentioned. Untested. I hope this is what you're looking for Zyzzy.
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
er.... not exactly what im looking for but still usful. I need a command line that reads text people say and puts each word from what they say on diffrent lines so if i said 'hi pooface' it would put in the file : hi pooface so then later i can make him read random words togther to make a sentence
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
well.. im not sure how to do that, but ill try on *:TEXT:*:#: {
tokenize 32 $strip($1-)
write Filename.txt $*
} This is untested.. i dont know if $* will work in the /write command, but give it a try This would put each word in a line in Filename.txt
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
doesn't seem to work
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
Mind that that is just the code to put the words in the file (i tested it here, and it works).
To say that random line im not quite sure how to get several random lines from the file.
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
er... doesn't work for me it keeps saying * Invalid format: $strip (line 2, bottesting.mrc)
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
Oh, i see.. then take the $strip out
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Just take that out altogether, there's no point on /tokenize'ing $1- by 32: on *:text:*:#:{ write file.txt $* }
New username: hixxy
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
Oh, that's interesting Didnt know about that, thanks!
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
wahoo working now thanks a ton. Ok no how can it take some words randomly out of the file to make a sentence
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
//echo -a $randword( versions.txt) $randword( versions.txt) $randword( versions.txt) $randword( versions.txt) $randword( versions.txt) is: now bugs. sorting. /mkdir 72.Fixed
alias randword {
tokenize 32 $read($1,n,$r(1,$lines($1)))
return $eval($ $+ $r(1,$0),2)
}
$randword(file)
New username: hixxy
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
first whats the actal code there? theres so many things plus how could i make it do that when their nick is mentioned
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
The code is this:
alias randword { tokenize 32 $read($1,n,$r(1,$lines($1))) return $eval($ $+ $r(1,$0),2) }
Put it in remote (alt+r), you could make it say a sentence when your nick is mentioned by:
on *:text:$(* $+ $me $+ *):#:{ var %i = 1, %result while %i <= amount of words you want in the sentence { %result = %result $randword(file.txt) inc %i } msg $chan %result }
The text in red should be changed.
New username: hixxy
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
i get all of it exept where do i put how many words iwant in a sentence?
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
You put it where i typed amount of words you want in the sentence
New username: hixxy
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
ok so the first ting in alias the second in remotes. how can i amke it do it when people can the name of the bot? EDIT :
on *:TEXT:*:#: {
tokenize 32 $1-
write words.txt $*
}
on *:text:$(* $+ $me $+ *):#:{
var %i = 1, %result
while %i 5 {
%result = %result $randword(words.txt)
inc %i
}
msg $chan %result
}
this be right?
Last edited by Xidus; 13/06/04 06:10 PM.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Put all of this in remote, nothing goes in aliases.
alias randword { tokenize 32 $read($1,n,$r(1,$lines($1))) return $eval($ $+ $r(1,$0),2) } on *:TEXT:*:#: { write words.txt $* if $me isin $1- { var %i = 1, %result while %i <= 5 { %result = %result $randword(words.txt) inc %i } msg $chan %result } }
Don't change it.
New username: hixxy
|
|
|
|
Joined: Jun 2004
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Jun 2004
Posts: 33 |
thanks tons So that will say 5 random words whe nmy name is mentioned?
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Yep
New username: hixxy
|
|
|
|
|
|