mIRC Homepage
Posted By: NoPleX auto part script - 30/05/04 04:21 PM
Hi i have trying for along time now but i cant see my error in this script:


on me:*:JOIN:#help: .timer 60 CheckIdle

alias CheckIdle {
var %chan = #help
if ($me !isop %chan) {
var %a = $chan(%chan,0,r)
while (%a) {
if ($me(%chan,%a,r).idle > 540) { /part #help }
dec %a
}
}



I wat the script to part me form channel after 9 minutes idle! And the script is set to recount when i say something and i also think its set not to part me if im voiced or op!

Please help! confused
Posted By: xxxYODAxxx Re: auto part script - 30/05/04 04:56 PM
on me:*:JOIN <- not correct syntax see /help on join
$chan(%chan,0,r) <- see /help $chan
The above is what I noticed at a glance.

try this: (untested)

on *:JOIN:#help:{
if ($me isop $chan) { return }
else { timeridle 1 540 part #help }
}
on *:input:#help:{
if ($me isop $chan) { return }
else { checkidle }
}
alias CheckIdle {
timeridle off
timeridle 1 540 part #help
}
I know its not the best example, or best way to go about it, but it should work and give you a little to work with. smile

-cheers
Posted By: Collective Re: auto part script - 30/05/04 05:10 PM
Quote:
on me:*:JOIN <- not correct syntax see /help on join

The syntax is fine. Try it yourself, it means when YOU join a channel. The me: is the opposite of the ! event prefix (which means only trigger for others, not yourself).
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 05:16 PM
Quote:
on me:*:JOIN <- not correct syntax see /help on join
Actually that works fine. (see Collective's explanation)

NoPlex:
Code:
on me:*:JOIN:#help: .timer 60 CheckIdle

alias CheckIdle {
 var %chan = #help
  if ($me !isop %chan) &amp;&amp; ($idle &gt;= 540) { part %chan }
}
This code checks every 60 seconds your idle time ($idle) and, if its equal or higher than 540 secs, it parts you from %chan.

Hope it helps:)
Posted By: xxxYODAxxx Re: auto part script - 30/05/04 05:28 PM
hmm.. did not know that.. sorry and thanks smile

but as far as $idle that is "network idle time" correct? thus it wont be resetting on text to "#help" rather everytime you send to anywhere.
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 05:32 PM
Yes, $idle is a network idle time indeed.

If NoPlex wants just the idle on that channel, then your way (xxxYODAxxx's way) works fine smile

Zyzzy.
Posted By: NoPleX Re: auto part script - 30/05/04 07:25 PM
ok thanks.

And the:

var %chan = #help

stands for what?

And why:

%chan

Instead of $chan?



BTW you script is wrong! You forgot a 0 after .timer

on me:*:JOIN:#help: .timer 0 60 CheckIdlealias CheckIdle { var %chan = #help if ($me !isop %chan) && ($idle >= 540) { part %chan }}
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 07:32 PM
var %chan = #help - this was on the first post of this thread, so i kept it.

the command /var creates a %variable that will only be used while that script is running.. then it will be erased. It is used to store information in a more organized way, which is usually easier to handle.

In your script, specifically, that command is not necessary, since it only uses that variable.. so, if you want to, you can change all the %chan for #help (or whatever channel you want it to be) and remove that line.
Just remember to change them ALL, or else it will not work.

var is the command /var
%chan is the name of the variable (it has to have that & in front of it).
#help is the value of that variable.

Note that you need to add an equal sign (=) between the name of the var and the value.

Hope this helps smile
Zyzzy.

Edit: in answer to your second question, you can use $chan as well.. there's no problem smile

Edit2: Indeed, the zero is missing. My bad blush
Posted By: NoPleX Re: auto part script - 30/05/04 07:35 PM
ok here you made something wrong in you script:
You forgot a 0 after .timer and its CheckIdle after 60 not CheckIdlealias wink


on me:*:JOIN:#help: .timer 60 CheckIdlealias
CheckIdle {
var %chan = #help
if ($me !isop %chan) && ($idle >= 540) { part %chan }
}



but thanks for your help laugh
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 07:37 PM
Yup.. just apologized in the post above smile

I was using as reference the 1st code, which didnt have the zero, and the alias name was changed.
Posted By: NoPleX Re: auto part script - 30/05/04 07:39 PM
okay laugh it was quite a simple script i just didnt know what var ment smile
Posted By: Iori Re: auto part script - 30/05/04 07:41 PM
This will use your idle time on that channell instead of the network-wide $idle ($idle is reset after typing anything into any window at all).

on me:*:JOIN:#help:.timer $+ # 0 60 CheckIdle
alias CheckIdle {

  • if ($me !isop #help) && ($nick(#help,$me).idle >= 540) { part #help }
}
on me:*:part:#help:.timer $+ # off
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 07:43 PM
Also try /help /var - full explanation with switches.

Good luck,
Zyzzy.
Posted By: NoPleX Re: auto part script - 30/05/04 07:45 PM
thx! BTW it works fine. But will it also part me if im op or voiced?

I tested and i didnt have op or voice and it works there. But when i part the channel it starts writeing this in the status window:

* /part: insufficient parameters (line 5, script8.ini)

whats wrong?
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 07:49 PM
Code:
on me:*:JOIN:#help: .timerCheck 0 60 CheckIdlealias
alias CheckIdlealias {
  if ($me !isop $chan) &amp;&amp; ($idle &gt;= 540) { part $chan }
}

on me:*:PART:#help: .timerCheck off
I forgot to stop the timer once you leave the channel.

Paste this code and it should work fine smile Note that i have named the timers, so this way i can choose which timer to stop.

Tell me if it works.
Posted By: Iori Re: auto part script - 30/05/04 07:54 PM
So did I ^^ up there, and you're still using $idle wink
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 07:57 PM
I posted above that if they wanted the idle only in that specify channel, then they should use xxxYODAxxx's script.

But they are using the one with $idle, so im fixing that one.
Posted By: NoPleX Re: auto part script - 30/05/04 07:59 PM
oh hehe ok :tongue: i could have found that out my self but im to tired to think iv been up all night crazy


Should the:

var $chan = #help


Be in it???
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 08:02 PM
You should also see if xxxYODAxxx's script is the one you actually want. The one that uses's $idle refers as idle of thw whle network, not just on that channel.

For the idle only that the chan, use YODA's.

Greetings,
Zyzzyx.
Posted By: NoPleX Re: auto part script - 30/05/04 08:05 PM
yes but i only need it on that one channel because you are not allowed to idle on #help after 10 minutes you will get kicked so if i forgot to part from in my script will do it by it self smile
Posted By: Iori Re: auto part script - 30/05/04 08:22 PM
Quote:
yes but i only need it on that one channel p

on me:*:JOIN:#help:.timer $+ # 0 60 if ($me !isop #help) && ($nick(#help,$me).idle >= 540) { part #help }
on me:*:part:#help:.timer $+ # off
Posted By: xxxYODAxxx Re: auto part script - 30/05/04 08:46 PM
The script I posted will ONLY work on #help. It will NOT work off $idle. Instead off a timer set to 9 minutes. IF you type in #help and ONLY in #help the timer is reset. It also doesn't activate if YOU are op in that channel. The only thing it wont take into account is IF you are opped once the timer is started.

EDIT:

on *:JOIN:#help:{
timeridle 1 540 parthelp
}
on *:input:#help:{
checkidle
}
alias CheckIdle {
timeridle off
timeridle 1 540 parthelp
}
alias parthelp {
var %a = #help
if ($me isop %a) { checkidle }
else { part #help }
}

note: (untested) that will also check to see if your opped before or after the fact.

thx,, yeah should be that wink
Posted By: Zyzzyx26 Re: auto part script - 30/05/04 09:34 PM
Just wondering..

timeridle 1 540 part #help

should be..

timeridle 1 540 parthelp right?
© mIRC Discussion Forums