mIRC Homepage
Posted By: Mary_juana on text - 09/11/05 02:04 PM
this is part of what i have..


Code:
 on *:text:*:#: {
  if ($1 = $setting(quotes,prefix) $+ quote) {
    if ($1 = $setting(quotes,prefix) $+ addquote) && ($setting(quotes,chatterquotes) = 1) { 


now when i do !quote nick it works
but why won't !addquote nick work?

thanks for any help.
Posted By: Mpdreamz Re: on text - 09/11/05 02:18 PM
its a case of bracket mismatching :tongue:
[code]
on *:text:*:#: {
if ($1 = $setting(quotes,prefix) $+ quote) {
;here everything goes when $1 is !quote so the if statement below can never return $true since its placed
;somewhere that only gets triggered if $1 is !quote and therefor $1 can never be !addquote at the same time
if ($1 = $setting(quotes,prefix) $+ addquote) && ($setting(quotes,chatterquotes) = 1) {
[code]
FIX:
[code]
on *:text:*:#: {
if ($1 = $setting(quotes,prefix) $+ quote) {
commands
}
if ($1 = $setting(quotes,prefix) $+ addquote) && ($setting(quotes,chatterquotes) = 1) {
commands
}
}
[code]
Posted By: Mary_juana Re: on text - 09/11/05 02:58 PM
I thought it was something like that, but the second part is still not getting triggered, here's the full thing.

Code:
on *:text:*:#: {
  if ($1 = $setting(quotes,prefix) $+ quote) && ($setting(quotes,sendquotes) = 1)  {
    var %u = $2, %t = $ini(system/data/quotes.ini,%u,0)
    if (%t != 0) {
      var %n = $r(1,%t) | msg $chan Quote by: %u on $asctime($ini($quote_file,%u,%n),ddd doo mmm/yy @ h:nnt)) ( $+ $dur($calc($ctime - $ini($quote_file,%u,%n))) ago) $+ ; $readini($quote_file,%u,$ini($quote_file,%u,%n))
    }
    if ($1 = $setting(quotes,prefix) $+ addquote) && ($setting(quotes,chatterquotes) = 1) { 
      if ($4) { writeini system/data/quotes.ini $3 $ctime $4- | notice $nick Added $4 on $asctime(ddd doo mmm/yy @ h:nnt) for  $+ $nick | _quote_refresh }
    }
  }
}  
Posted By: Riamus2 Re: on text - 09/11/05 03:05 PM
You still didn't move the IF statement like was shown... (the quote and addquote IF statements need to be at the same "tab" level... not having one inside the other):

Code:
on *:text:*:#: {
  if ($1 = $setting(quotes,prefix) $+ quote) && ($setting(quotes,sendquotes) = 1)  {
    var %u = $2, %t = $ini(system/data/quotes.ini,%u,0)
    if (%t != 0) {
      var %n = $r(1,%t) | msg $chan Quote by: %u on $asctime($ini($quote_file,%u,%n),ddd doo mmm/yy @ h:nnt)) ( $+ $dur($calc($ctime - $ini($quote_file,%u,%n))) ago) $+ ; $readini($quote_file,%u,$ini($quote_file,%u,%n))
    }
  }
  elseif ($1 = $setting(quotes,prefix) $+ addquote) && ($setting(quotes,chatterquotes) = 1) { 
    if ($4) { writeini system/data/quotes.ini $3 $ctime $4- | notice $nick Added $4 on $asctime(ddd doo mmm/yy @ h:nnt) for  $+ $nick | _quote_refresh }
  }
}  


Note that I also changed it to elseif as that will speed up the code slightly.
Posted By: Mary_juana Re: on text - 09/11/05 03:16 PM
Yeah my bad, thanks guys, i had to swap the $N identifiers about to after i changed it, working good now though smile
© mIRC Discussion Forums