mIRC Home    About    Download    Register    News    Help

Print Thread
ON text and IF and away stuff.. #50287 19/09/03 03:54 PM
Joined: Sep 2003
Posts: 26
L
LexMortis Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Sep 2003
Posts: 26
hello guys..

I've stumbled upon a problem.
I'm trying to write a script that will reply (kinda like a very simple chatbot) to private messages when im away.
I've tried zillion ways.. but the st00pid thing wont reply to the messages...

( I know you cant trigger it yourself, thats not the problem :P )

Re: ON text and IF and away stuff.. #50288 19/09/03 04:00 PM
Joined: Jun 2003
Posts: 242
R
r0ck0 Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
Code:
on *:OPEN:?:*: {
  if ($away) msg $nick Sorry $nick I've been away for $+(,$duration($awaytime),) with the reason $+(,$awaymsg),)
}


Edit: Collective true .. thx smile

Last edited by r0ck0; 19/09/03 04:09 PM.
Re: ON text and IF and away stuff.. #50289 19/09/03 04:03 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Better to use on OPEN.

Re: ON text and IF and away stuff.. #50290 19/09/03 04:13 PM
Joined: Sep 2003
Posts: 26
L
LexMortis Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Sep 2003
Posts: 26
But open only gets triggered once.. I want that the awayscript will say more than 1 line.

I just want a really simple chatbot to reply when im away.
---
on *:TEXT:$me:?:{
if ($away) { /msg $nick Hello }
}
on *:TEXT:*?:?:{
if ($away) { /msg $nick say what? }
}
on *:TEXT:*!?:?:{
if ($away) { /msg $nick please dont shout }
}
etc...
---
something like that... but that doesnt work frown

Re: ON text and IF and away stuff.. #50291 19/09/03 04:29 PM
Joined: May 2003
Posts: 161
A
Ashkrynt Offline
Vogon poet
Offline
Vogon poet
A
Joined: May 2003
Posts: 161
Why would you want to give people the impression that you're there when you're away?

Re: ON text and IF and away stuff.. #50292 19/09/03 04:30 PM
Joined: Sep 2003
Posts: 26
L
LexMortis Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Sep 2003
Posts: 26
btw, I've also tried this:

on *:TEXT:* $+ ?:?:{

the $+ didnt help frown

Re: ON text and IF and away stuff.. #50293 19/09/03 04:37 PM
Joined: Sep 2003
Posts: 6
N
n3wb13 Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
N
Joined: Sep 2003
Posts: 6
of course it didn't work!

*? represents any string longer than one character so, when they say your name, mIRC would not know, if *? or $me should trigger

Re: ON text and IF and away stuff.. *DELETED* #50294 19/09/03 04:41 PM
Joined: Sep 2003
Posts: 6
N
n3wb13 Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
N
Joined: Sep 2003
Posts: 6
Post deleted by n3wb13

Re: ON text and IF and away stuff.. #50295 19/09/03 04:41 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
That's not accurate, mIRC always triggers the first matching event in each file.

Also note that on TEXT is bound to get you flooded off by a lamer or two.

Code:
on *:TEXT:$($me):?:{ 
  if ( $away ) { msg $nick Hello }
}
on $*:TEXT:/!\?$/:?:{ 
  if ( $away ) { msg $nick please dont shout }
}
on $*:TEXT:/\?$/:?:{ 
  if ( $away ) { msg $nick say what? }
}

^Using regex because I couldn't figure out how to match ? without it confused

Re: ON text and IF and away stuff.. #50296 19/09/03 05:04 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
on *:TEXT:*:?:{
if ($away) && ($+(*,$chr(63)) iswm $1-) { ...... }
}
or
on *:TEXT:$($+(*,$chr(63)),1):?:{ ...... }


new username: tidy_trax
Re: ON text and IF and away stuff.. #50297 19/09/03 05:23 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Both of those always trigger for me, no matter what I get sent in a PM.

[18:23:55] <a7tcv62r> a
[18:23:55] ..... is an unknown command
[18:24:05] <a7tcv62r> a
[18:24:05] .... is an unknown command

Re: ON text and IF and away stuff.. #50298 19/09/03 05:38 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i noticed frown, seems regex is the only way;\


new username: tidy_trax
Re: ON text and IF and away stuff.. #50299 19/09/03 07:34 PM
Joined: Sep 2003
Posts: 26
L
LexMortis Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Sep 2003
Posts: 26
Read this: http://www.gamespy.com/fargo/august03/autorpg/index.shtml

I want to make that bot as the awaychatbot grin

Re: ON text and IF and away stuff.. #50300 19/09/03 08:02 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
what about this?

Code:
 
on *:TEXT:*:?:{
  if ($away) {
    if ($1 == $me) { msg $nick Hello }
    elseif (*! iswm $1-) { msg $nick please dont shout }
    elseif (? isin $($ $+ $0,2)) { msg $nick say what? } 
  }
}
 


that's what i figured out....

Last edited by J0ke; 19/09/03 08:20 PM.

Go ahead, jump. 100,000 lemmings can't be wrong.
Re: ON text and IF and away stuff.. #50301 19/09/03 08:05 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
*? iswm for everything more than one character long.

Re: ON text and IF and away stuff.. #50302 19/09/03 08:11 PM
Joined: Jan 2003
Posts: 150
J
J0ke Offline
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
wouuups grin


Go ahead, jump. 100,000 lemmings can't be wrong.
Re: ON text and IF and away stuff.. #50303 20/09/03 07:23 PM
Joined: Sep 2003
Posts: 17
A
Agent_Mike Offline
Pikka bird
Offline
Pikka bird
A
Joined: Sep 2003
Posts: 17
what pheonix suggested with the $chr is true, just taht you should replace the .... with the actual commands, so this won't happen.

Quote:
[18:23:55] <a7tcv62r> a
[18:23:55] ..... is an unknown command
[18:24:05] <a7tcv62r> a
[18:24:05] .... is an unknown command


another idea to how this can be done:
Code:
 on *:TEXT:*:?: { 
if ($chr(63) isin $1-) { msg $nick say what?! }
elseif ($chr(33) isin $1-) { msg $nick don't yell at me! }
else { msg $nick hello }
}


this will trigger on any message sent, and then check if ? is in the text, if not it'll check if the ! is in the text, and if none of them are, it'll just say hello.

have fun with this smile

Re: ON text and IF and away stuff.. #50304 20/09/03 07:41 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
no, what i said was wrong because it shouldnt matter that '.....' is an unknown command, because it shouldnt of been executed in the 1st place crazy :tongue:


new username: tidy_trax
Re: ON text and IF and away stuff.. #50305 20/09/03 08:01 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
<Insert pheonix's post here>

Also, I've just noticed that I missed the obvious $right solution..

Code:
on *:TEXT:*:?:{
  if ($away) {
    if ($1 == $me) { msg $nick Hello }
    elseif (*! iswm $1-) { msg $nick please dont shout }
    elseif ( $right($1-,1) == ? ) { msg $nick say what? }
  }
}