mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Script problem #86718 13/06/04 04:46 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
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

Re: Script problem #86719 13/06/04 04:51 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Code:
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 smile

Zyzzy.


"All we are saying is give peace a chance" -- John Lennon
Re: Script problem #86720 13/06/04 04:54 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
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 smile

Re: Script problem #86721 13/06/04 05:02 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
well.. im not sure how to do that, but ill try smile

Code:
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 smile This would put each word in a line in Filename.txt



"All we are saying is give peace a chance" -- John Lennon
Re: Script problem #86722 13/06/04 05:14 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Jun 2004
Posts: 33
doesn't seem to work frown

Re: Script problem #86723 13/06/04 05:18 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
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
Re: Script problem #86724 13/06/04 05:19 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Jun 2004
Posts: 33
er... doesn't work for me it keeps saying * Invalid format: $strip (line 2, bottesting.mrc)

Re: Script problem #86725 13/06/04 05:25 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, i see.. then take the $strip out wink

Code:
tokenize 32 $1-


"All we are saying is give peace a chance" -- John Lennon
Re: Script problem #86726 13/06/04 05:29 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
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
Re: Script problem #86727 13/06/04 05:31 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, that's interesting smile Didnt know about that, thanks!


"All we are saying is give peace a chance" -- John Lennon
Re: Script problem #86728 13/06/04 05:31 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Jun 2004
Posts: 33
wahoo working now laugh thanks a ton. Ok no how can it take some words randomly out of the file to make a sentence laugh

Re: Script problem #86729 13/06/04 05:37 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
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

Code:
alias randword {
  tokenize 32 $read($1,n,$r(1,$lines($1)))
  return $eval($ $+ $r(1,$0),2)
}


$randword(file)


New username: hixxy
Re: Script problem #86730 13/06/04 05:40 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
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

Re: Script problem #86731 13/06/04 05:46 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
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
Re: Script problem #86732 13/06/04 06:00 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Jun 2004
Posts: 33
i get all of it exept where do i put how many words iwant in a sentence?

Re: Script problem #86733 13/06/04 06:07 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
You put it where i typed amount of words you want in the sentence


New username: hixxy
Re: Script problem #86734 13/06/04 06:08 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
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 :
Code:
  
 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.
Re: Script problem #86735 13/06/04 06:29 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
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
Re: Script problem #86736 13/06/04 06:33 PM
Joined: Jun 2004
Posts: 33
X
Xidus Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Jun 2004
Posts: 33
thanks tons laugh So that will say 5 random words whe nmy name is mentioned?

Re: Script problem #86737 13/06/04 06:40 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Yep smile


New username: hixxy
Page 1 of 2 1 2