mIRC Home    About    Download    Register    News    Help

Print Thread
!rules or any triggers with '!' #39616 04/08/03 12:35 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
I am a newbie in irc. I would like to know how to set up a bot or script that uses the following triggers like '!rules' or '!commands'. Once the command is activated, a list of rules or commands would be listed out in sequence of 1. XX 2. XX

Thank you.

Re: !rules or any triggers with '!' #39617 04/08/03 12:41 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
on *:TEXT:!rules:#:msg # 1. Foo 2. bar

Re: !rules or any triggers with '!' #39618 04/08/03 12:46 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
Ummm...Can I have a simple example please? ^_^
I am still kinda confused...

Re: !rules or any triggers with '!' #39619 04/08/03 12:47 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
That was an example, put it in your remotes (ALT+R) and have someone say !rules, it will message the channel with "1. Foo 2. bar"

Re: !rules or any triggers with '!' #39620 04/08/03 12:49 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
Thank you.
I get a bit of the concept already ^_^

And by the way, how to I set the script to run on one specific channel only? I dun wan to start listing out !rules in other people's channel ^_^;

Last edited by zu_yong; 04/08/03 01:12 PM.
Re: !rules or any triggers with '!' #39621 04/08/03 01:33 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
on *:TEXT:!rules:#channelname:msg # 1. Foo 2. bar

Just replace the green with the name of your channel.

Re: !rules or any triggers with '!' #39622 04/08/03 02:11 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
Thank you again, Collective ^_^
You have been a big help to me ^_^

Re: !rules or any triggers with '!' #39623 04/08/03 04:16 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
Oh...another question has arise...
How do I make the !rules trigger available only for the viewing of the person who typed the !rules trigger?

Re: !rules or any triggers with '!' #39624 04/08/03 04:18 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Send it as either a notice or a private message:

on *:TEXT:!rules:#channelname:notice $nick 1. Foo 2. bar
or
on *:TEXT:!rules:#channelname:msg $nick 1. Foo 2. bar

Re: !rules or any triggers with '!' #39625 04/08/03 04:32 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
Ok...The previous settings are now ok...Thanks ^_^

Is there a way to align the output in this format : (vertical)
1. No spam
2. No cursing

rather than (horizontal)

1. No spam 2. No cursing ?

Because vertical indent looks much readable and neat ^_^

Re: !rules or any triggers with '!' #39626 04/08/03 04:36 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
make a text file and put each rule on a seperate line,call it rules, then use this.

Code:
alias rules {
var %i 1
while (%i <= $lines(rules.txt)) {
msg %nick %i $+ : $read(rules.txt,%i)
inc %i
}
}
on *:TEXT:!rules:#:{
set %nick $nick
/rules
}


Last edited by pheonix; 04/08/03 04:39 PM.

new username: tidy_trax
Re: !rules or any triggers with '!' #39627 04/08/03 04:37 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
on *:TEXT:!rules:#channelname:msg $nick 1. Foo | msg $nick 2. bar

or much more readable:
Code:
on *:TEXT:!rules:[color:green]#channelname[/color]:{
  msg $nick 1. Foo
  msg $nick 2. bar
}

Re: !rules or any triggers with '!' #39628 04/08/03 04:38 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
That sends it to the channel rather than the user. Stop posting things people don't want!

Edit: You managed to fix one problem..

Edit2: Why not use /play instead of a while loop?

Edit3: You managed to fix both, you made something useful, congrats!

Re: !rules or any triggers with '!' #39629 04/08/03 04:40 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
heh
never had any use for /play so never bothered using it :tongue:

Last edited by pheonix; 04/08/03 04:46 PM.

new username: tidy_trax
Re: !rules or any triggers with '!' #39630 04/08/03 04:41 PM
Joined: Aug 2003
Posts: 10
Z
zu_yong Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 10
Gee...Thanks again guys (especially Collective)
This is the best irc help forum I have been to. I get replies to my questions in less than 2 minutes. Keep up the good work!

Re: !rules or any triggers with '!' #39631 04/08/03 05:52 PM
Joined: Dec 2002
Posts: 117
R
Rich Offline
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
Some small improvements on your code:
Code:
alias rules {
  var %i = 1[color:red], %lines = $lines(rules.txt)[/color][color:green], %nick = $$1[/color]
  while (%i <= [color:red]%lines[/color]) {
    msg [color:green]%nick[/color] %i $+ : $read(rules.txt,[color:blue]tn[/color],%i) 
    inc %i
  }
}
on *:TEXT:!rules:#:rules [color:green]$nick[/color]

By using %lines mIRC won't have to determine the number of lines in rules.txt every time it checks the condition in the while loop
By passing $nick as $1 You won't have to use a global variable, which most people will agree is best to avoid. Also, now you can do /rules <nick> anywhere and it will msg that nick your rules. (Using double $'s will halt the alias if you don't specify a nickname)
Using the tn switches with $read is usually recommendable, or you have to make sure the first line of the file is not a number (t) and everything that can be evaluated should be evaluated (all words starting with % or $ are meant as variables and identifiers) (n)


$input(Me like stars, You too?)
Re: !rules or any triggers with '!' #39632 05/07/04 11:35 PM
Joined: Jul 2004
Posts: 3
U
Urgntfury Offline
Self-satisified door
Offline
Self-satisified door
U
Joined: Jul 2004
Posts: 3
this is probably a really stupid question but here goes anyway. If I take the above code. where does it go? or better yet where do I put it. How do you start it. Or does it just work. Do you have to restart program.

thanks

Re: !rules or any triggers with '!' #39633 06/07/04 09:41 AM
Joined: Dec 2002
Posts: 117
R
Rich Offline
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
You put the code in your remotes:
In mIRC, press [ALT][R], this opens up the remote tab of the script editor.
Now copy the code there and press the "OK" button, after that it works right away.
Make sure the rules.txt is in your mIRC directory or you will be getting errors though.


$input(Me like stars, You too?)