mIRC Home    About    Download    Register    News    Help

Print Thread
#107108 06/01/05 10:15 PM
Joined: Nov 2004
Posts: 332
R
Fjord artisan
OP Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
ok 2 questions
first how do i get mirc to compare comething someone says again a txt, and if it gets a match to perform a action

and

how do i get it to chose that action randomly from another txt


The Kodokan will move you, one way or another.
#107109 06/01/05 10:28 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
if ($strip($1-) iswm $read(file.txt)) { 
   describe $chan $read(file.txt,$rand($lines(file.txt),1)) 
}


Maybe?

#107110 06/01/05 10:33 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:text:*:#:{
  if ($read(file.txt,nw,$+(*,$1-*))[color:red])[/color] { describe $chan $read(file2.txt,n) }
}


Didn't notice the ), thanks Slade

Last edited by tidy_trax; 06/01/05 10:45 PM.

New username: hixxy
#107111 06/01/05 10:43 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on *:text:*:#:{  
  if ($read(file.txt,nw,$+(*,$1-*))[color:red])[/color] { describe $chan $read(file2.txt,n) }
}

#107112 07/01/05 03:56 AM
Joined: Nov 2004
Posts: 332
R
Fjord artisan
OP Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
ok
i use a timer set to 1hour saying k to my chan to kjeep me connected
what i would like to do is make a lengthy txt and have it give a random line from it every hour or whatever length
i tried
on *:start:{
timer 0 3600 msg #sensei $read(babble.txt)
}
the end result was me saying a random line the first time
but ever time after that the timer went off it was that same original line


The Kodokan will move you, one way or another.
#107113 07/01/05 04:41 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That's because mIRC first evaluates any identifiers or variables in a command, before executing it. Timer is no different.

In //.timer 0 3600 msg #sensei $read(babble.txt),

the $read is evaluated to a random line from babble.txt, and so that line will be msged every hour.

What you want is for the $read to be evaluated each time, with each call of the timer. Therefore, we musn't let mIRC evaluate our timer parameters when first starting it.

We do that by either doing $!identifier, or $($identifier,0) etc.

Examples: //.timer 0 3600 msg #sensei $!read(babble.txt,n)

Another way to go around this is by specifying an alias instead of the direct command

Example:

//.timermsgquote 0 3600 msgquote #sensei

alias msgquote {
if $me ison $1 { msg $1 $read(babble.txt,n) }
else .timermsgquote off
}

Btw, note how I added the n switch to the $read identifier, which will make the read-in text not evaluated, for example if identifiers, commands or variables are in the line that is read from the file.

Also, you ought to put that timer in the on join event with channel #sensei specified, instead of in the on start event. Because that way, you are sure that your message will arive.

Example:

on me:*:JOIN:#sensei: $+(.timermsgquote,#) 0 3600 msgquote #
on me:*:PART:#sensei: $+(.timermsgquote,#) off
[color:red]

alias msgquote msg $1 $read(babble.txt,n)
[/color]
There is also the case of incorporating multiserver commands, but I don't want to make this too complicated. This should certainly do for now.

Greets

Last edited by FiberOPtics; 07/01/05 04:54 AM.

Gone.
#107114 07/01/05 05:08 AM
Joined: Nov 2004
Posts: 332
R
Fjord artisan
OP Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
thanks for the clarification what was going wrong
and for your help


The Kodokan will move you, one way or another.
#107115 07/01/05 05:16 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Np, glad I could be of help. Bye.


Gone.

Link Copied to Clipboard