mIRC Homepage
Posted By: ShinZon litlle help neded - 21/07/04 02:21 AM
hi, i am new at scripts so i came here for some wisdom

i have a dialog and a labelbox on it, and i want it to display
my idle time on that label and to be updated every 1 second,
and since i dont wanna call raw 317 every 1 second (flood)
i found this online in 1 script $duration($idle)
so i stored it in %idler and made this:

on 1:CONNECT: { /idler }

idler {
:idup
var %tempidle = 1
while (%tempidle != 0) {
/set %idler $duration($idle)
inc %tempidle
timer 3 3 goto idup
}
}

thing is that my mirc freezes when i connect and trigger aliases dunno why... i thought it is cos of timer so i made it
to update every 3 seconds, but it freezes again

why ?
Posted By: Kelder Re: litlle help neded - 21/07/04 08:59 AM
First: a timer is not a sleep() function like in other languages. It does not wait there and then continues where it left off. A timer is a commands that tells mIRC to run a command sometime later, but the current script just continues. This means that the timer should run 3 seconds later without even knowing what script activated it, so for the goto _place, the :_place cannot be found. Also, you set the timer to run 3 times each 3 seconds. That would mean each timer creates 3 more timers each creating 3 more timers ... -> that's a lot of timers smile

But, it is not the reason your script hangs...
You have a while loop with a condition that is never $false. %tempidle starts at 1 and you increase it every iteration, so it will never become 0. Since mIRC only uses one thread, and it's now running an endless loop, your mIRC 'hangs'.

As for your script type /help /inc first and then do this:

on 1:CONNECT: { set %idle = 0 | inc -c %idle }

This will set %idle to 0 and then increase it by one every second.
You'll probably also need some other events to reset your idle time, it's the same two commands.
Posted By: ShinZon Re: litlle help neded - 21/07/04 05:37 PM
i made it to loop endless coz if i make goto command, after first time script sets idletime it wont come back to start,like this

idler {
:idup
/set %idler $duration($idle)
timeridle 3 2 goto idup
}

it only passes one time and finishes...
and i need constant update of that variable smirk
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 05:43 PM
alias idler {
timeridle 0 3 set %idle $!duration($idle)
}
Posted By: ShinZon Re: litlle help neded - 21/07/04 08:03 PM
now all i got is this

345
345

upon echo and in label box, and it wont change at all :P

1. what is that (345)?
2. why wont it update ?
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 08:09 PM
alias idler {
timeridle 0 3 set %idle $!duration($idle)
}

did you leave the ! in there?
it's supposed to be there.

Edit: It works fine here ...

* Set %idle to 3secs
-
* Set %idle to 6secs
-
* Set %idle to 9secs
-
* Set %idle to 12secs
-
* Set %idle to 15secs
-
* Set %idle to 18secs
-
* Set %idle to 21secs
-
* Set %idle to 24secs
Posted By: ShinZon Re: litlle help neded - 21/07/04 08:27 PM
ah, i bluw it up lol, it works ok, but it wont update every 2 seconds on labelbox, thatz why i made that While LOOP above that freezed my mirc smirk

so if anyone can help me in this i would be thanfull
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 08:34 PM
That one is 3 sec interval .. if you want 2 sec interval .. change the 3 to a 2.
Posted By: ShinZon Re: litlle help neded - 21/07/04 08:35 PM
hmmm but why then it wont update on dialog i have this:

text %idle, 1.....

and it always shows only 1 number and since labelbox is set to be(read) %idle, then it should update but it wont at all smirk
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 08:38 PM
what's the dialog name and id ?
Posted By: ShinZon Re: litlle help neded - 21/07/04 08:42 PM
this is only test dialog that i use

dialog idletime {
title "idle time"
size -1 -1 232 114
option pixels notheme
text %idle, 1, 11 31 100 17
text "Idle Time:", 2, 12 12 54 17
}
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 08:44 PM
alias idler {
timeridle 0 3 if ($dialog(idletime)) did -o idletime 1 1 $!duration($idle)
}
Posted By: ShinZon Re: litlle help neded - 21/07/04 08:50 PM
nothing happens
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 08:50 PM
your dialog has to be open
Posted By: ShinZon Re: litlle help neded - 21/07/04 08:51 PM
it is openet for like 1 minute and i have same number displayed all the time
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 08:54 PM
* Tony wanders off feeling dizzy ...
Posted By: ShinZon Re: litlle help neded - 21/07/04 09:15 PM
hmm, on clean mirc it works

seems my script blocks some things, i'll try to fix this :P

thank you very much for your time and effort (sorry for dizzyness) smile
Posted By: ShinZon Re: litlle help neded - 21/07/04 09:29 PM
lol i made it to work only 1 baaad thing, i have dialog with 4 TAB's and instead in labelbox it shows idletime in 1st tab's name shocked

a bit odd, why and how to fix it ?
Posted By: TonyTheTiger Re: litlle help neded - 21/07/04 09:51 PM
dialog idletime {
title "idle time"
size -1 -1 232 114
option pixels notheme
text %idle, 1, 11 31 100 17, tab 4
text "Idle Time:", 2, 12 12 54 17
}
Posted By: ShinZon Re: litlle help neded - 22/07/04 12:56 AM
works perfect now !

i thank you very much !
Posted By: TonyTheTiger Re: litlle help neded - 22/07/04 03:15 AM
you're welcome smile
© mIRC Discussion Forums