mIRC Home    About    Download    Register    News    Help

Print Thread
#212533 25/05/09 08:30 PM
Joined: Jul 2004
Posts: 59
L
Babel fish
OP Offline
Babel fish
L
Joined: Jul 2004
Posts: 59
I am having a problem getting this to work correctly. using the timer, without the timer it works perfectly but I need to slow it down on user join to allow them time to identify to nickserv. about 5sec.

When I add the timer I get * /timer: timer 1 not active
When I test the timer function outside of my code it works fine.

Code:
/timer1 1 5 echo test


returns

* Timer 1 activated
-
test
-
* Timer 1 halted

Here is my Code.

Code:
on *:JOIN:#:{
  /timer1 1 5 {
    var %mask =  $address($nick,5)
    var %mask_1 = $remove($mask(%mask,2),*!*)
    var %mask_2 = $mask(%mask,0)
    var %mask_final $replace(%mask_2,%mask_1,@*)
    ; Check if the nick has used this address before
    var %sql = SELECT ff_id FROM voice WHERE channel = ? AND nick = ? AND address = ?
    var %res = $mysql_query(%track.db, %sql, $chan, $nick, %mask_final)
    ; Check the result
    if ($mysql_num_rows(%res) > 0) {
      ; Found an existing row, just update the time
      ;var %id = $mysql_fetch_single(%res)
      ;%sql = UPDATE track SET time = NOW() WHERE id = %id
      ;mysql_exec %track.db %sql
      mode $chan +v $nick
    }
    else {
      ; No existing row, insert a new one
      ;var %sql = INSERT INTO track (network, nick, address, time) VALUES (?, ?, ?, NOW())
      ;noop $mysql_exec(%track.db, %sql, $network, $nick, $address)
      return
    }
    ; Free the result
    mysql_free %res
  }
}
 

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I belive you need to store the information you need in variables, then call a alias that trigger it after given time..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
A simple look at /help /timer show that you're using a wrong syntax, you can't use bracket like in a if statement, simply put your code in an alias and pass parameter to this alias :

Code:
on !*:JOIN:#:.timer 1 5 check_nick $nick $chan $fulladdress $network $address

alias check_nick {
var %mask = $+(*!,$gettok($gettok($3,1,64),2,33),@*)
; Check if the nick has used this address before
var %sql = SELECT ff_id FROM voice WHERE channel = ? AND nick = ? AND address = ?
var %res = $mysql_query(%track.db, %sql, $2, $1, %mask)
; Check the result
if ($mysql_num_rows(%res) > 0) {
; Found an existing row, just update the time
;var %id = $mysql_fetch_single(%res)
;%sql = UPDATE track SET time = NOW() WHERE id = %id
;mysql_exec %track.db %sql
mode $chan +v $nick
}
else {
      ; No existing row, insert a new one
      ;var %sql = INSERT INTO track (network, nick, address, time) VALUES (?, ?, ?, NOW())
      ;noop $mysql_exec(%track.db, %sql, $4, $1, $5)
      return
    }
    ; Free the result
    mysql_free %res
  }
}
I've changed a little your code, try it.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard