mIRC Home    About    Download    Register    News    Help

Print Thread
#138904 08/01/06 04:01 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
Well i thought this was all working correctly, and i don't know why it isn't now, so any help would be great.

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


!quote <nick> works just fine
!quote <number> doesn't
it returns the correct date it was entered, just not the actual quote itself.

#138905 08/01/06 06:52 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
When you use a number in your !command it puts a number into the second argument of $ini(file,section/N,item/M). So instead of searching for a section with the name "number" you are searching for the Nth section.

Try adjusting your script so that it adds a dummy alpha character before all section/item names like, nABC123, n123, nABC. That will prevent a number from messing everything up.

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


-genius_at_work

Last edited by genius_at_work; 08/01/06 06:59 PM.
#138906 08/01/06 08:14 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
I see, looking at that i kind of understand now, but it doesn't work and i don't even get an error message which is odd.


Link Copied to Clipboard