mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2012
Posts: 4
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Feb 2012
Posts: 4
is there an easier way to do this, because i don't feel like repeating the $# thing so it can search the sentence till it finds the word in the botdata.ini file.
Code:
on 1:TEXT:!define *:#:{
  .writeini botdata.ini Define-Explain $2 $3-
  .msg $chan The Definition Of ( $2 ) Has Been Set.
}

on 1:TEXT:*:#:{
  if ($readini(botdata.ini,Define-Explain,$1) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$1) != $null) {
    /timer1 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$1)
  }

  if ($readini(botdata.ini,Define-Explain,$2) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$2) != $null) {
    /timer2 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$2)
  }

  if ($readini(botdata.ini,Define-Explain,$3) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$3) != $null) {
    /timer3 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$3)
  }


  if ($readini(botdata.ini,Define-Explain,$4) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$4) != $null) {
    /timer4 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$4)
  }


  if ($readini(botdata.ini,Define-Explain,$5) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$5) != $null) {
    /timer5 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$5)
  }


  if ($readini(botdata.ini,Define-Explain,$6) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$6) != $null) {
    /timer6 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$6)
  }

  if ($readini(botdata.ini,Define-Explain,$7) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$7) != $null) {
    /timer7 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$7)
  }

  if ($readini(botdata.ini,Define-Explain,$8) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$8) != $null) {
    /timer8 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$8)
  }

  if ($readini(botdata.ini,Define-Explain,$9) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$9) != $null) {
    /timer9 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$9)
  }

  if ($readini(botdata.ini,Define-Explain,$10) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$10) != $null) {
    /timer10 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$10)
  }
  if ($readini(botdata.ini,Define-Explain,$11) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$11) != $null) {
    /timer11 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$11)
  }
  if ($readini(botdata.ini,Define-Explain,$12) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$12) != $null) {
    /timer12 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$12)
  }
  if ($readini(botdata.ini,Define-Explain,$13) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$13) != $null) {
    /timer13 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$13)
  }
  if ($readini(botdata.ini,Define-Explain,$14) == $null) {

  }

  elseif ($readini(botdata.ini,Define-Explain,$14) != $null) {
    /timer14 1 1  .msg $chan  $readini(botdata.ini,Define-Explain,$14)
  }
}

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I highly discourage checking every word typed in a channel... why not just use !define WORD to check a word and !define WORD DEFINITION to define it? The first code is what you asked for, the second is what I suggest you use instead. In each case I have included the "safe" alias, this is used to sanitize user input into a /timer.

Code:
on 1:text:!define * *:#:{
  writeini botdata.ini Define-Explain $2 $3-
  msg # The Definition Of $qt($2) Has Been Set.
}

on 1:text:*:#:{
  explain $*
}

alias explain {
  if ($readini(botdata.ini,n,Define-Explain,$1)) .timer 1 1 msg # $safe($v1)
}

alias safe return $!decode( $encode($1,m) ,m)


Code:
on 1:text:!define *:#:{
  if ($3) {
    writeini botdata.ini Define-Explain $2 $3-
    msg # The Definition Of $qt($2) Has Been Set.
  }
  elseif ($readini(botdata.ini,n,Define-Explain,$2)) {
    .timer 1 1 msg # $safe($v1)
  }
}

alias safe return $!decode( $encode($1,m) ,m)

Joined: Feb 2012
Posts: 4
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Feb 2012
Posts: 4
im using a define-explain script so i can work on a bot that speaks back to the person if the bot finds the word in the sentence.
if you can help me make that sentence scanning thing it would mean a lot to me.
thank you!


Link Copied to Clipboard