mIRC Home    About    Download    Register    News    Help

Print Thread
#114476 14/03/05 10:52 PM
Joined: Mar 2005
Posts: 18
A
adazh Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2005
Posts: 18
Ok, i've tried this quite a few times and not had much luck getting to work.

When someone types a trigger in my channel like !rules, I would like it to DCC CHAT the person and read a text file of the rules in the DCC chat rather then DCC Send the text file and they have to look at it manually.

Example
<nick1> !rules
* me requests a DCC Chat with nick1 and nick1 accepts
* me reads rules.txt in the dcc chat to nick1
* me closes the DCC chat with nick1 upon completion of reading the text file

Can someone explain an easy way to do this?

At the moment I just use splay in a query, but there are many lines in the text file so it's not very ideal to use this method.

Last edited by adazh; 14/03/05 10:54 PM.
#114477 14/03/05 11:03 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
this should work:
Code:
on *:text:!rules:[color:red]#channel[/color]: {
set % [ $+ [ $+($nick,RULES) ] ] 1
dcc chat $nick
}
on *:open:=: {
if (% [ $+ [ $+($nick,RULES) ] ]) {
unset % [ $+ [ $+($nick,RULES ] ]
play =$nick [color:red]rules.txt[/color] 0
}
}

#114478 15/03/05 06:46 AM
Joined: Mar 2005
Posts: 18
A
adazh Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2005
Posts: 18
It does connect when triggered, but it does not play the specified file.

It says there's an error (* Invalid format: $+) in this line:

Quote:
unset % [ $+ [ $+($nick,RULES ] ]


Also, I have another command trigger, !commands (triggers it to read commands.txt). How do I get it to work with more than one command? Anyone else knows how to do this?

Last edited by adazh; 15/03/05 06:58 AM.
#114479 15/03/05 07:35 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The original code didnt send due the the error stopping the code running, and the error was just a typo by the looks a missing close bracket )

Code:
on *:text:!rules:#channel:{
  set -u60 % [ $+ [ $+($nick,.DCCFILE) ] ] rules.txt
  dcc chat $nick
}
on *:text:!commands:#channel:{
  set -u60 % [ $+ [ $+($nick,.DCCFILE) ] ] commands.txt
  dcc chat $nick
}
on *:text:!balls:#channel:{
  set -u60 % [ $+ [ $+($nick,.DCCFILE) ] ] rubberball.txt
  dcc chat $nick
}
;
;etc etc etc
;
on *:open:=:{
  if (% [ $+ [ $+($nick,.DCCFILE) ] ] ) {
    play = $+ $nick $v1 0
    unset % [ $+ [ $+($nick,.DCCFILE) ] ]
  }
}


* code is untested, but looks pretty right. yell if it dont work.

#114480 15/03/05 10:09 AM
Joined: Mar 2005
Posts: 18
A
adazh Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2005
Posts: 18
* /play: unable to open 'C:\mirc\0'

Quote:
play = $+ $nick $v1 0

#114481 15/03/05 11:22 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
you really should mention that your not using the latest mirc when you ask for something smile $v1 was added v6.16

try this...
Code:
on *:text:!rules:#channel:{    dcc.file.send $nick rules.txt }
on *:text:!commands:#channel:{ dcc.file.send $nick commands.txt }
on *:text:!balls:#channel:{    dcc.file.send $nick rubberball.txt }
;
;etc etc etc
;
alias -l dcc.file.send {
  set -u60 % [ $+ [ $+($1,.DCCFILE) ] ] $2-
  dcc chat $1
  .timer. $+ $1 $+ .dcc.close 1 60 while ( $!window( = $+ $1 ) ) $chr(123) window -c = $+ $1 $chr(125)
}
on *:open:=:{
  echo -st CP0 nick : $1-
  if (% [ $+ [ $+($nick,.DCCFILE) ] ] ) {
    play = $+ $nick $ifmatch 0
    unset % [ $+ [ $+($nick,.DCCFILE) ] ]
  }
}

Now each TEXT event calls an alias to do all the work, becuase the alias also starts a 60 sec timer to close the dcc chat windows to that nick.
Now the OPEN event uses the older $ifmatch instead of $v1.

#114482 15/03/05 01:59 PM
Joined: Mar 2005
Posts: 18
A
adazh Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Mar 2005
Posts: 18
Thanks a lot, it works great.

#114483 24/03/05 04:08 PM
Joined: Mar 2005
Posts: 9
M
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2005
Posts: 9
Hello!
I've just made a bot! And put that script in it.. but it does'nt work..

It says in the bots irc window: "* Unable to resolve local host"

#114484 24/03/05 04:47 PM
Joined: Mar 2005
Posts: 9
M
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2005
Posts: 9
on *:text:!rules:#channel: {
set % [ $+ [ $+($nick,RULES) ] ] 1
dcc chat $nick
}
on *:open:=: {
if (% [ $+ [ $+($nick,RULES) ] ]) {
unset % [ $+ [ $+($nick,RULES ] ]
play =$nick rules.txt 0
}
}

This script gonna send a txt file.. in this case rules.txt to the person that types !rules on my channel..

But it does'nt work.. Why??


The person that types !rules gets this lines:
----------------------------------------------------
DCC Chat session
-
Client: TESTBOT (81.181.86.253)
Time: Thu Mar 24 17:44:51 2005
-
Acknowledging chat request...
DCC Chat connection established
-
----------------------------------------------------


The "bots": message:
----------------------------------------------------
Chat with TEST
Waiting for acknowledgement...
DCC Chat connection established
-


Link Copied to Clipboard