mIRC Homepage
Posted By: Marco Need help with a timed message script - 24/01/03 05:30 PM
Im trying to make this timed message system only display the timed message on the channel selected by the user but I m not having luck with it as it displayis in all channels Im logged here is the code I have so far:
Code:
;alias to call dialog
alias tmsg { dialog -m tmsg tmsg }

dialog tmsg {
  title "Auto Message"
  size -1 -1 225 280
  option pixels
  icon C:\Arkscript\system\skull9.ico, 0
  button "Ok", 1, 159 200 60 20, ok
  button "Cancel", 2, 159 235 60 20,cancel
  box "", 15, 3 2 220 65
  text "Timed Message:", 3, 10 15 90 20
  edit "", 4, 10 35 200 20, autohs
  button "Start Timer", 5, 20 100 75 20
  button "Stop Timer", 6, 130 100 75 20
  text "Ad Delay:", 7, 10 130 65 20
  edit "", 8, 10 150 45 20
  text "seconds", 9, 60 152 55 20
  box "", 10, -40 80 600 400
  edit "", 11, 8 213 122 21, autohs
  text "Channel to Display", 12, 12 188 117 16, center
}

on *:dialog:tmsg:edit:*: {
   if ($did == 4) { set %time.msg $did(4) }
  if ($did == 8) { set %time.delay $did(8) }
  if ($did == 11) { set %time.channel $did(11) }

}
on *:dialog:tmsg:init:0: {
  did -o tmsg 4 1 %time.msg $did(4).multi
  did -o tmsg 8 1 %time.delay $did(8)
  did -o tmsg 11 1 %time.channel $did(11)

}
on *:dialog:tmsg:sclick:*: {
  if ($did == 5) { time.msg.on | set %timed_msg on } 
  if ($did == 6) { time.msg.off | set %timed_msg off }
}
alias time.msg.on { 
  if (%time.delay == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set your ad delay first! | halt }
  if (%time.msg == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set the message first! | halt }
  if (%time.channel == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set the channel first! | halt }
  .timermsg 0 %time.delay /amsg $TimeAd | /amsg $TimeAd | echo -a  %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ Timed Message has been started. 
}
alias TimeAd { return %c2 $+ $chr(91) $+ %c1 $+ Timed Message $+ %c2 $+ $chr(93) %time.msg   }
alias time.msg.off { .timermsg off | echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ Timed Message has been halted.  }
alias saytime { 
  if (%time.delay == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set your ad delay first! | halt }
  if (%time.msg == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set the message first! | halt }
  if (%time.channel == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set the channel first! | halt }
  msg %time.channel %c2 $+ $chr(91) $+ %c1 $+ Timed Message $+ %c2 $+ $chr(93) %time.msg    
}


thanks in advance!
Posted By: Jerk Re: Need help with a timed message script - 24/01/03 08:03 PM
You have a saytime alias but I don't see where it is being called....
Code:
.timermsg 0 %time.delay /amsg $TimeAd | /amsg $TimeAd | echo -a  %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ Timed Message has been started.

Your timer executes "/amsg $TimeAd" twice (?) but never calls /saytime. Remove one and change the other to /saytime. If you want to send the message to the channel when the timer starts then put a msg line before the /timer.
Code:
alias time.msg.on { 
  if (%time.delay == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set your ad delay first! | halt }
  if (%time.msg == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set the message first! | halt }
  if (%time.channel == $null) { echo -a %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ You must set the channel first! | halt }
  msg %time.channel $TimeAd
  .timermsg 0 %time.delay /saytime 
  echo -a  %c2 $+ ( $+ %c1 $+ Ü $+ %c2 $+ ) %c1 $+ Timed Message has been started. 
}




Posted By: Marco Re: Need help with a timed message script - 25/01/03 01:25 AM
thanks a lot for the help
© mIRC Discussion Forums