mIRC Homepage
Posted By: SimonB elseif and $rand var not working - 20/01/06 11:54 PM
It's broke, I'm hoping you tell why. Thank you.


Code:
 on *:action:slaps*:#: {
var %ugs = $rand(1,3)
  if ($2 == $me) && (%ugs == 1){
    /describe $chan slaps $nick with 1111111s
  }
  
    elseif ($2 == $me) && (%ugs == 2){
      /describe $chan slaps $nick with 22222222s
  }
    elseif ($2 == $me) && (%ugs == 3){
      /describe $chan slaps $nick with 333333333s
  }
  else return
} 
Posted By: MikeChat Re: elseif and $rand var not working - 21/01/06 12:32 AM
on *:action:slaps*:#: {
var %ugs = $rand(1,3)
if ($2 == $me) {
if (%ugs == 1) { describe $chan slaps $nick with 1111111s }
if (%ugs == 2) { describe $chan slaps $nick with 22222222s }
if (%ugs == 3) { describe $chan slaps $nick with 333333333s }
}
}
Posted By: schaefer31 Re: elseif and $rand var not working - 21/01/06 12:43 AM
From your original code, you need a space between the ) and { . It would also help to include parenthesis around both conditions.
Posted By: SimonB Re: elseif and $rand var not working - 21/01/06 01:23 AM
Thank you for help Mike Chat, your modifications worked beautifully. If it's not much trouble I still do not understand why my original code broke, could someone explain to me.
Posted By: schaefer31 Re: elseif and $rand var not working - 21/01/06 01:47 AM
It's already been explained. See my previous post.
Posted By: hixxy Re: elseif and $rand var not working - 22/01/06 09:34 PM
Code:
on *:action:slaps*:#:{
  if ($2 != $me) return
  var %ugs = $rand(1,3)
  describe $chan slaps $nick with $str(%ugs,$calc(6 + %ugs)) $+ s
}
© mIRC Discussion Forums