mIRC Home    About    Download    Register    News    Help

Print Thread
#44137 25/08/03 10:24 PM
Joined: Feb 2003
Posts: 143
N
naki Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: Feb 2003
Posts: 143
I am making a new script for my bot and the trigger word is is.

I want to be able to set it up so if I do

something is cool, it will write to a file

[is]
something=cool

or

John Davis is the best imagingary friend I have.

[is]
john davis=the best imaginary friend %nick has


We don't just write the scripts, we put them to the test! (ScriptBusters)
#44138 25/08/03 10:30 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
ON *:TEXT:* is *:#the_channel:{
.writeini theinifile.ini is $1 $3-
}

#44139 25/08/03 11:59 PM
Joined: Feb 2003
Posts: 143
N
naki Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: Feb 2003
Posts: 143
oh heh, forgot to mention, it is for a socket bot.


We don't just write the scripts, we put them to the test! (ScriptBusters)
#44140 26/08/03 04:41 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Code:
[color:green]; sockread event[/color]
on *:SOCKREAD:[color:blue]sockname[/color]: {  
  [color:green]; read from sock and tokenize for easy access[/color]
  sockread %tmp
  tokenize 32 %tmp
  [color:green]; check for all conditions:[/color]
  [color:green]; * must be a channel msg (= regular text)[/color]
  [color:green]; * the word is must be an actual word and not part of one[/color]
  if ($2 == PRIVMSG) && ($3 ischan) && (* is * iswm $4-) {
    [color:green]; find out which token number the word is is[/color]
    var %x = $findtok($4-,is,1,32)
    var %y = $calc(%x + 1)
    var %z = $calc(%x - 1)
    [color:green]; write to inifile[/color]
    [color:green]; use of $+() to reconstruct $4-x[/color]
    [color:green]; use of $eval() to evaluate it[/color]
    [color:green]; note the use of $right(...,-1) because the message is always prefixed with a colon[/color]
    writeini [color:blue]filename.ini[/color] is $right($eval($+($,4-,%z),2),-1) $eval($+($,%y,-),2)
  }
}


As always - change the parts in blue


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#44141 26/08/03 07:28 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I don't think that will work. the ischan will fail. "ischan if v1 is a channel which you are on." Since it is a socket bot, that means /join #channel was never done, instead he had to /sockwrite JOIN #channel which would not be recognized by ischan.

#44142 26/08/03 08:05 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Point taken. Then simply replace if ($3 ischan) with if ($left($3,1) == $chr(35)).


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#44143 26/08/03 08:37 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well that still won't really work. It's possible the bot is on an &channel, a +channel, a !channel etc. To really work correctly, he'd have to parse 005 and look for a CHANTYPES=


Link Copied to Clipboard