mIRC Home    About    Download    Register    News    Help

Print Thread
#135231 09/11/05 02:04 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
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.

#135232 09/11/05 02:18 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
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]


$maybe
#135233 09/11/05 02:58 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
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 }
    }
  }
}  

#135234 09/11/05 03:05 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
#135235 09/11/05 03:16 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
Yeah my bad, thanks guys, i had to swap the $N identifiers about to after i changed it, working good now though smile


Link Copied to Clipboard