mIRC Homepage
Posted By: Stium A timer setting. - 25/05/04 07:31 PM
Still new to all the scripting but I'm catching on really fast but I need a quick script on timers

Alright I want to every 30 mintes post a joke in my channel but it goes deeper than that.

I want the joke to pull a name of one of my clan mates and put it in front of the joke.

This could go a lot deeper to read the .roster setting all the names there and post them in front of the jokes randomly.

I dunno, getting over my head with all these scripts.
Posted By: Stium Re: A timer setting. - 25/05/04 07:46 PM
Can I do it this way?

on *:TEXT:*:#:{
.timer 10 1800 msg # $read($names,jokes.txt)
}
Posted By: Stium Re: A timer setting. - 25/05/04 07:51 PM
Reposting to my self

msg # $read(names.txt) $read(jokes.txt)

Will work but I've got to get the timer settings down
Posted By: Zyzzyx26 Re: A timer setting. - 25/05/04 07:54 PM
if you want a non-stop timer, use /timerName 0 1800 msg # $read(names.txt) $read(jokes.txt)

That will make the timer act every 30 mins forever (until you end it or the client closes)

Hope it does it smile

BTW, you can Edit you own posts wink

Zyzzy.
Posted By: Stium Re: A timer setting. - 25/05/04 07:54 PM
yes, I was only planing on starting it for 10 times.
Posted By: Zyzzyx26 Re: A timer setting. - 25/05/04 07:56 PM
Oic then.. wink
Posted By: Stium Re: A timer setting. - 25/05/04 08:01 PM
on *:TEXT:*:#:{
.timer 0 1800 msg %clanchan $read(names.txt) $read(jokes.txt)
}

full script?

Look good?
Posted By: FiberOPtics Re: A timer setting. - 25/05/04 09:07 PM
Hi,

you're almost there. But some things have to be changed first.


First and most important:

Do you realise that the current way you have ur script setup, means that ANYTIME anyone says something in any channel that you are in, a new timer will be set. Im sure this is not your intention.

Here's a solution that might suit you better:
Code:

on me:*:JOIN:%clanchan: .timer 0 1800 msg %clanchan $!read(names.txt) $!read(jokes.txt) 

Note 1:
As you can see the ON TEXT event is changed to the ON JOIN event, specifically when you join your channel %clanchan, then the timer starts, and will msg to %clanchan every 1800 seconds a joke with a nick of your clan members in front of it.

Note 2:
Remember, that if you are using a command from the command line with // in front of it, like //.timer .. then the contents of the line will first be evaluated, then executed. This is the same when a command is run from a script. In other words,

on me:*:JOIN:%clanchan: .timer 0 1800 msg %clanchan $read(names.txt) $read(jokes.txt)

will send out the exact same text message every 1800 seconds. That is cuz mIRC first evaluates $read(names.txt) and $read(jokes.txt) and then sets the timer.

In other words, you need for the two $read identifiers to be re-evaluated each time the timer triggers.

Solution:

msg %clanchan $!read(names.txt) $!read(jokes.txt) or msg %clanchan $($read(names.txt) $read(jokes.txt),0)

Both solutions will make sure that the $read identifiers get sent to the timer without having been evaluated yet.

Greetz


Posted By: Stium Re: A timer setting. - 25/05/04 10:44 PM
Great post.

I didn't end up useing it because I did it how a pre posted it and it worked.

I did how ever add what you said to my remote to start when I join the channel I want.

I will try the $! and see.
Posted By: FiberOPtics Re: A timer setting. - 26/05/04 04:40 PM
Hi,

to see what I'm referring to, do the following:

//timer 10 1 echo -a $read(names.txt) $read(jokes.txt)

which should show u the same message each time (remember, double // is the same as running from remote, which is the case here in your script)

//timer 10 1 echo -a $!read(names.txt) $!read(jokes.txt)

that should show u a random message each time.

Hope this made things clearer,


Greetz

© mIRC Discussion Forums