mIRC Homepage
Posted By: sudn3sc3d Random amount of time script... - 03/09/05 01:56 PM
Hey,

I have been working on this mIRC bot since the past few days. I wanted to add a script to it but I got stuck at one part. I was wondering if you guys could help me out.

I need something that makes the bot visit a website with a delay of random minutes between the time the command is sent to the channel and the time the next day starts. For example-

[6:01PM] <sudn3sc3d> !visit www.mysite.com -random
[6:01PM] <bot|00001> Calculating total number of minutes left in the day. Local time: 6:01PM. Minutes left= 359
[6:02PM] <bot|00001> Choosing random number of minutes between 1 and 359..... Visiting www.mysite.com after 158 minutes...

I already have the part the time calculating part

$round($calc(($ctime($date 11:59pm) - $ctime($date $time)) / 60),0)
(thx to RoCk at irc.rizon.org #mirc)

Please help me out and tell me what should I do next to link all this together
Posted By: buster2007 Re: Random amount of time script... - 03/09/05 03:53 PM
try
$rand(1,$round($calc(($ctime($date 11:59pm) - $ctime($date $time)) / 60),0) )
it generates a random number between 1 and $round.....
Posted By: RusselB Re: Random amount of time script... - 03/09/05 04:27 PM
Please note that most commands in mIRC that use a timing need the timing to be measured in seconds
Posted By: Kelder Re: Random amount of time script... - 03/09/05 08:43 PM
Define 'making a bot visit a website'

Do you want to just open the site in your browser -> /run www.yoursite.com
Do you want to download the contents of a page and display that to a channel or local mIRC window? -> do a search, there are enough examples on this site and other mIRC scripting sites about using sockets to download a web page.
Do you want your bot to laugh at the daily comic? -> .timer 1 $calc(%randomminutes * 60) describe $chan surfs to %site and likes it!
Do you want something else? -> then say so...
© mIRC Discussion Forums