mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2004
Posts: 45
N
Navid Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Feb 2004
Posts: 45
Hello smile.
Here is my little code!.
Code:
on 1:TEXT:*Train*:#chan:{ 
  If ($ritems($nick,Items,BuildPoints) <= 0) { notice $nick 4You Dont Have Any Build Points  | halt }
  if ($2 == Hp) || ($2 == Ki) {
    set %to.train T $+ $2
    if ($stats($nick,Stats,%to.train) == $null) { halt } 
    set %time $round($calc((10 * 60) / $stats($nick,Stats,Intelligence) + 120),0)
    /timer $+ $nick $+ training $+ $2 -o 1 %time set %train $stats($nick,Stats,%to.train)
    /timer $+ $nick $+ training $+ $2 -o 1 %time inc %train 1
    /timer $+ $nick $+ training $+ $2 -o 1 %time wini $nick Stats %To.Train %Train
    var %Bp = $ritems($nick,Items,BuildPoints)
    dec %Bp 1
    witems $nick Items BuildPoints %Bp
    notice $nick 12Congratulations!10 Your $2 Training Will be done in3 %Time Secs
    /.timer $+ $nick $+ Training -o 1 %time notice $nick 4Congratulations!10 You are done training Your $2
  }
  if ($2 == $2)  {
    if ($stats($nick,Stats,$2) == $null) { halt }
    set %to.train $2
    set %time $round($calc((10 * 60) / $stats($nick,Stats,Intelligence) + 120),0)
    /timer $+ $nick $+ training $+ $2 -o 1 %time set %train $stats($nick,Stats, $+ %to.train $+ )
    /timer $+ $nick $+ training $+ $2 -o 1 %time inc %train 1
    /timer $+ $nick $+ training $+ $2 -o 1 %time wini $nick Stats %to.train %train
    var %Bp = $ritems($nick,Items,BuildPoints)
    dec %bp 1
    witems $nick Items BuildPoints %Bp
    notice $nick 12Congratulations!10 Your $2 Training Will be done in3 %Time Secs
    /.timer $+ $nick $+ Training -o 1 %time notice $nick 4Congratulations!10 You are done training Your $2
  }
  else { notice $nick 4ERROR!12 $2 10cannot be trained | halt }
}
  

Quote:
* Timer digitaltrainingspeed activated
-
* Timer digitaltrainingspeed activated
-
* Timer digitaltrainingspeed activated

The timer shows that its working but it doesn't Inc %train at all

Joined: Mar 2005
Posts: 74
D
Babel fish
Offline
Babel fish
D
Joined: Mar 2005
Posts: 74
without knowing what %timer is,

i'd suggest changing:

/timer $+ $nick $+ training $+ $2 -o 1

into: /timer $+ $nick $+ training $+ $2 -o 0

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Your using the same timerNAME for 3 timers so the 2nd one replaces the 1st and the 3rd one replaces the 2nd.
Also even if they were named sepearetly they go off to close together this means you cant be sure they go off in the order you create them.
Also Im not sure (havent checked) what well be evaluated at the timer creation and at the timer execution in the timers you set.

I sugest this (without checking what the rest of the code is doing)

Code:
on 1:TEXT:*Train*:#chan:{ 
  If ($ritems($nick,Items,BuildPoints) <= 0) { notice $nick 4You Dont Have Any Build Points  | halt }
  if ($2 == Hp) || ($2 == Ki) {
    set %to.train T $+ $2
    if ($stats($nick,Stats,%to.train) == $null) { halt } 
    set %time $round($calc((10 * 60) / $stats($nick,Stats,Intelligence) + 120),0)
    [color:blue]timer $+ $nick $+ training $+ $2 -o 1 %time wini $nick Stats %To.Train $!calc( $!stats( $nick ,Stats, %to.train ) + 1)[/color]
    var %Bp = $ritems($nick,Items,BuildPoints)
    dec %Bp 1
    witems $nick Items BuildPoints %Bp
    notice $nick 12Congratulations!10 Your $2 Training Will be done in3 %Time Secs
    /.timer $+ $nick $+ Training -o 1 %time notice $nick 4Congratulations!10 You are done training Your $2
  }
  if ($2 == $2)  {
    if ($stats($nick,Stats,$2) == $null) { halt }
    set %to.train $2
    set %time $round($calc((10 * 60) / $stats($nick,Stats,Intelligence) + 120),0)
    [color:blue]timer $+ $nick $+ training $+ $2 -o 1 %time wini $nick Stats %To.Train $!calc( $!stats( $nick ,Stats, %to.train ) + 1)[/color]
    var %Bp = $ritems($nick,Items,BuildPoints)
    dec %bp 1
    witems $nick Items BuildPoints %Bp
    notice $nick 12Congratulations!10 Your $2 Training Will be done in3 %Time Secs
    /.timer $+ $nick $+ Training -o 1 %time notice $nick 4Congratulations!10 You are done training Your $2
  }
  else { notice $nick 4ERROR!12 $2 10cannot be trained | halt }
}


Link Copied to Clipboard