mIRC Home    About    Download    Register    News    Help

Print Thread
Need help with an on/of Script #246031 18/05/14 07:44 PM
Joined: Apr 2014
Posts: 19
R
RapidHaste Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Apr 2014
Posts: 19
So I found a script for starting an online timer but I'm trying to add another script that will allow me to turn the timer on or off but I am having some trouble with it. Any help with be greatly appreciated.





Here's the script that I have for the online timer:

on *:TEXT:!online:#uminokaiju: {
if ($nick == rapidhaste) || ($nick == uminokaiju) || ($nick == glummerz) || ($nick == gorran_) {
var %n = $nick(#,0)
var %i = 1
var %nick = $nick(#,%i)
if (%i < %n) { msg # You're now earning Ninja Stars!
:doagain
$iif(%nick != $null,goto add,goto end)
:add
$+(.timerpoints.,#,.,%nick) 0 60 add.pts $+(#,.,%nick)
%i = %i + 1
%nick = $nick(#,%i)
goto doagain
:end
return
}
}
}



And here's the on/off script that I'm trying to add to the online script:

on $*:text:/^!online (on|off)/:#uminokaiju:{
if ($nick != rapidhaste) && ($nick != glummerz) { return }
if $2 == off {
set -e %online.off 1
msg # The timer been turned off while the stream is offline.
}
else {
unset %online.off
msg # The online timer has been started!
}
}

Re: Need help with an on/of Script [Re: RapidHaste] #246041 19/05/14 02:20 AM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You can add code into your add.pts alias to check if %online.off == 1
Code:
alias add.pts {
  ; dont add points if %online.off == 1
  if %online.off == 1 { return }
  ...
}

or you can mass turn off timer
Code:
on $*:text:/^!online (on|off)/:#uminokaiju:{
  if ($nick != rapidhaste) && ($nick != glummerz) { return }
  if $2 == off {
    set -e %online.off 1 
    $+(.timerpoints.,#,.,*) off
  ...
}

and to prevent gorran_ triggering !online after you turn !online off, you need to add code to check if %online.off == 1 in this event
Code:
on *:TEXT:!online:#uminokaiju: {
  if ($nick == rapidhaste) || ($nick == uminokaiju) || ($nick == glummerz) || ($nick == gorran_) {
    if %online.off == 1 { return }
  ...
}