mIRC Homepage
Posted By: BassReFLeX quote lib - 25/02/04 06:38 PM
Hi there
How can I create a script that I will define some nicknames and quotes for example. on join $nick say <text>
on join $nick say <text1>
on join $nick say <text2> and etc

but for the same nickname, many quotes like creating a quotes library and then every nicknames that joins, the script will say one of the quotes in library :tongue:

hope it can be done thnx a lot !
Posted By: tidy_trax Re: quote lib - 25/02/04 06:55 PM
i made a bot that connects via sockets, joins every channel you specify, has following commands: !quote <nick> - to view a quote, !quote add <mynick> <quote> - to add a quote, !quote del <mynick> - to delete a quote, it reads the quote for that nickname when that nickname joins, but it only allows one quote per nickname.. do you want it anyway?
Posted By: BassReFLeX Re: quote lib - 25/02/04 09:40 PM
well I thank you. I don't need only one specified quote for a nick, I need a nick to have many quotes, different, everytime nick joins. However , give me the bot, I'll try it for a while and see what can be done.
Posted By: tidy_trax Re: quote lib - 25/02/04 10:05 PM
Code:
alias quote {
  if (!$isid) { 
    writeini quotes.ini quotes $1- 
    if ($dialog(qlist)) { 
      if ($didwm(qlist,1,* $+ $1 $+ *)) { did -d qlist 1 $ifmatch }
      did -a qlist 1 $1 $chr(9) $2- 
    }
  }
  elseif ($isid) { return $readini(quotes.ini,quotes,$1-) }
}
alias qlist {
  if (!$dialog(qlist)) { dialog -m qlist qlist }
  var %i 1
  did -r qlist 1
  while ($ini(quotes.ini,quotes,%i)) { 
    did -a qlist 1 $ifmatch $chr(9) $readini(quotes.ini,quotes,$ifmatch)
    inc %i
  }
}
alias qbot { 
  if (!$1) { 
    sockopen qbot $server 6667 
    if ($sock(qbot)) { return }
  }
  elseif ($1 == join) { sockwrite -n qbot join $chan }
}
dialog qlist {
  title "quote list[/qlist]"
  size -1 -1 160 99
  option dbu
  list 1, 0 1 160 99, size
}
on *:dialog:qlist:*:*:{
  if ($devent == init) {
    mdx SetMircVersion $version
    mdx MarkDialog $dname
    mdx SetControlMDX $dname 1 ListView report rowselect single infotip &gt; $views
    did -i $dname 1 1 headerdims 100 216
    did -i $dname 1 1 headertext nick $chr(9) quote
    qlist
  }
}
on *:sockopen:qbot:{
  if ($sockerr) { return }
  sockwrite -n $sockname nick quotebot
  sockwrite -n $sockname user quotebot . . quotebot
}
on *:sockread:qbot:{
  if ($sockerr) { return }
  var %quote
  sockread %quote
  tokenize 32 %quote
  if ($1 == ping) { sockwrite -n $sockname pong $right($2,-1) }
  elseif ($2 == privmsg) {
    if ($right($4,-1) == !quote) { 
      if ($5-6 == add $right($gettok($1,1,33),-1)) { quote $right($gettok($1,1,33),-1) $7- }
      elseif ($5-6 == del $right($gettok($1,1,33),-1)) { 
        if ($quote($right($gettok($1,1,33),-1))) { 
          if ($dialog(qlist)) &amp;&amp; ($didwm(qlist,1,* $+ $right($gettok($1,1,33),-1) $+ *)) { did -d qlist 1 $didwm(qlist,1,* $+ $right($gettok($1,1,33),-1) $+ *) }
          remini " $+ $scriptdirquotes.ini $+ " quotes $right($gettok($1,1,33),-1) 
        } 
      }
      elseif ($5 != add) &amp;&amp; ($5 != del) {
        if ($quote($5)) { sockwrite -n $sockname privmsg $3 : $5 $+ 's quote: $ifmatch }
      }
    }
    elseif ($right($4,-1) == !commands) {
      sockwrite -n $sockname privmsg $3 : !quote add &lt;yournick&gt; &lt;quote&gt; - to add a quote.
      sockwrite -n $sockname privmsg $3 : !quote del &lt;yournick&gt; - to delete your quote.
      sockwrite -n $sockname privmsg $3 : !quote &lt;nick&gt; - to view a quote.
    }
  }
  elseif ($2 == join) {
    if ($quote($right($gettok($1,1,33),-1))) { sockwrite -n $sockname privmsg $right($3,-1) : $right($gettok($1,1,33),-1) $+ 's quote: $ifmatch }
  }
}

/qlist will only work if you have mdx.dll and views.mdx
type:
/qbot - to connect it to the active server.
/qbot join - to make it join the active channel after if it's connected.
Posted By: BassReFLeX Re: quote lib - 26/02/04 02:26 PM
Thnx. It works fine, but I still need what I asked above frown
Posted By: tidy_trax Re: quote lib - 26/02/04 02:39 PM
well considering it only uses the "quote" alias to add/read quotes, it should be farely easy to edit.

Code:
alias quote { 
  if (!$isid) {    
    write quotes.dat $1-    
    if ($dialog(qlist)) { did -a qlist 1 $1 $chr(9) $2- }  
  } 
  elseif ($isid) { return $read(quotes.dat,w,$+(*,$1,*)) }
}

although you might have to remove the "!quote del <nick>" command because it won't know which quote to read;\
© mIRC Discussion Forums