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
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.
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
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
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.
er... doesn't work for me it keeps saying * Invalid format: $strip (line 2, bottesting.mrc)
Oh, i see.. then take the $strip out
Just take that out altogether, there's no point on /tokenize'ing $1- by 32: on *:text:*:#:{ write file.txt $* }
Oh, that's interesting
Didnt know about that, thanks!
wahoo working now
thanks a ton. Ok no how can it take some words randomly out of the file to make a sentence
//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)
first whats the actal code there? theres so many things plus how could i make it do that when their nick is mentioned
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.
i get all of it exept where do i put how many words iwant in a sentence?
You put it where i typed amount of words you want in the sentence
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?
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.
thanks tons
So that will say 5 random words whe nmy name is mentioned?
wow people here are so nice
on *:text:*:#:{ write words.txt $* }
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
}
}
not working :P when i say b0rk2 ( the guys name ) he doesn't do anyhting
You do not need this line: on *:text:*:#:{ write words.txt $* }, that line also breaks the script, you only need alias randword { and everything below it.
wahoo its all working now
is there a way to make him ignore certain things? ? ?
If you mean to ignore certain words in the file, then this should work:
alias randword {
tokenize 32 $read($1,n,$r(1,$lines($1)))
var %result = $eval($ $+ $r(1,$0),2)
if $0 > 1 {
while $istok(word1 word2 word3 word4 word5 word6 etc,%result,32) { %result = $eval($ $+ $r(1,$0),2) }
}
return %result
}