mIRC Home    About    Download    Register    News    Help

Print Thread
#260694 06/06/17 01:07 PM
B
Baleco
Baleco
B
Hi everyone.

Can anyone please help me? i have searched and searched, but i just can't find what i'm looking for.

We want to make a script, that blocks command's before a time.

Because of my poor english, i will explain:

!spanking nick is posible after 10pm, till 3am.

so far thank you!

#260697 06/06/17 04:54 PM
Joined: Jul 2006
Posts: 4,022
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,022
You can't find what you are looking for because this is the most basic logic out there.
There's 24 hours per day, write down each hours of the day and write down if that hour should be allowed:

0 = yes
...
3 = no (after 3 am, no)
...
21 =
22 = yes (after 10 pm, yes)

Once you have that, you'll realize that you need check if the number representing the hours is either of those number with the yes mark

Last edited by Wims; 06/06/17 04:54 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
#260698 06/06/17 05:09 PM
Joined: Jan 2004
Posts: 2,081
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jan 2004
Posts: 2,081
Time of day can be scripted like $asctime($ctime,HH:nn), which goes from 00:00 thru 23:59. I'll leave out the colon when it's easier to treat it like a number range. If time crosses midnight, must either treat as 2 time periods, or use the opposite time period as disallowed:

var %time $asctime($ctime,HHnnss)

then
if (%time isnum 2200-2359) goto allowed
if (%time isnum 0-300) goto allowed

or
if (%time !isnum 301-2159) goto allowed

another method is to set a variable to $true or $false depending on whether something is allowed right now. Then create a timer that activates at the next time boundary

set %spank.allowed $true
timerSpankOFF -o 3:01 1 0 TurnSpankOffAlias

or
set %spank.allowed $false
timerSpankOn -o 22:00 1 0 TurnSpankOnAlias

Beware that timers run on time that doesn't see the seconds, so if it's 22:00 now and you want to set a timer to activate at 22:00 tomorrow, setting a timer for 22:00 activates now.

Calculating the number of seconds until 22:00 and setting a timer to activate after that number of seconds into the future will not be accurate because of mirc being busy during the day:


Code:
//var %stoptime $calc(10+$ctime) | echo -a timer started $asctime(HH:nn:ss) | timer -o 1 15 echo -a timer should activate 15 seconds after $asctime(HH:nn:ss) but activated $!asctime(HH:nn:ss) | :loop | var %x $rand(1,999) | if ($ctime < %stoptime) goto loop | echo -a finished making randoms $asctime(HH:nn:ss)


#260707 07/06/17 06:03 PM
B
Baleco
Baleco
B
thanks for your help so far..

excuse me, i'm new in scripting. So far the easy things like how to let mirc respond to a command, are going well.

I tried this:

on *:TEXT:*!burp*:#BalecoTest:{
var %time $asctime($ctime,HHnn)
if (%time !isnum 1859-2359) goto allowed
if (%time !isnum 0-300) goto allowed
msg $chan Gooi je dat zomaar weg $nick ?

}
the time now is 20.01 pm, so it should work, but it doesn't respond. In Mirc, it says:

* /goto: 'allowed' not found (line 4, script5.ini)

What can i do? Again thanks for so far!

maroon #260708 07/06/17 07:00 PM
B
Baleco
Baleco
B
thank you so much. We kept trying and it finaly works because of your help!!


Link Copied to Clipboard