mIRC Home    About    Download    Register    News    Help

Print Thread
vhost request #265585 03/06/19 12:30 PM
Joined: Jun 2019
Posts: 3
M
mario Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jun 2019
Posts: 3
hi, I was wondering if anyone could help me
I have a vhost request script but I just cant seem to get it to $calc between the last date issued and a wait of 7 days (604800 seconds) and a time remaining before a new one can be requested

this is what I have so far:

on *:notice:*:?: { if ($nick == nickserv) {
if (vhost isin $1) {
if ($duration($calc($ctime - $ctime($6 $7 $8 $9))) <= 604800) {
msg #hosthelp Please wait $duration($6 $7 $8 $9,- 604800) until your next request
}
if ($duration($calc($ctime - $ctime($6 $7 $8 $9))) >= 604800) {
msg #hosthelp Your new vhost has been activated
}
elseif (vhost !isin $1) {
msg #hosthelp Your new vhost has been activated
}
elseif (is not registered isin $2-$4) {
msg #hosthelp You need to register your nick first
}
}
}
}


the vhost info from nickserv looks like this:

-NickServ- vHost : my.vhost.here (assigned on Jun 02 22:59:06 2019 +0800 (21h 9m 33s ago)

thanks smile

Re: vhost request [Re: mario] #265588 03/06/19 10:09 PM
Joined: Jan 2004
Posts: 1,187
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,187
Assuming $6 is where the "Jun" of the date begins, you need more than 4 tokens to get the whole date, unless nickserv's timestamp is in the same timezone that you're in. Since they give you the 'ago' time, I'd use that instead. The 1st line takes the last 4 tokens of the notice.

var %a $gettok($1-,-4-,32)
var %a $remove(%a,$chr(40),$chr(41))
var %ago_time $duration(%a)
var %wait_until $calc(86400*7 - %ago_time)

Re: vhost request [Re: maroon] #265589 03/06/19 11:23 PM
Joined: Jun 2019
Posts: 3
M
mario Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jun 2019
Posts: 3
ahh thanks so much, i'll try it out later tonight
thank you smile

Re: vhost request [Re: maroon] #265594 05/06/19 03:30 AM
Joined: Jun 2019
Posts: 3
M
mario Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jun 2019
Posts: 3
thanks for the formula works well
one last thing. how would i convert %wait_until into days hours minutes seconds into a return

Re: vhost request [Re: mario] #265595 05/06/19 03:56 AM
Joined: Jan 2004
Posts: 1,187
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,187
In addition to translating the interval string into number of seconds, $duration can take an integer number of seconds and translate it into weeks/days/hrs/mins/secs

'return' is a way that a custom alias can behave like an $identifier. When the alias ends with 'return %variable", $myalias returns the value of the %variable to whatever called the alias.