mIRC Homepage

vhost request

Posted By: mario

vhost request - 03/06/19 12:30 PM

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
Posted By: maroon

Re: vhost request - 03/06/19 10:09 PM

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)
Posted By: mario

Re: vhost request - 03/06/19 11:23 PM

ahh thanks so much, i'll try it out later tonight
thank you smile
Posted By: mario

Re: vhost request - 05/06/19 03:30 AM

thanks for the formula works well
one last thing. how would i convert %wait_until into days hours minutes seconds into a return
Posted By: maroon

Re: vhost request - 05/06/19 03:56 AM

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.
© 2019 mIRC Discussion Forums