mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#91247 21/07/04 02:21 AM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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 ?

#91248 21/07/04 08:59 AM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
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.

#91249 21/07/04 05:37 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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

#91250 21/07/04 05:43 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
alias idler {
timeridle 0 3 set %idle $!duration($idle)
}

Last edited by TonyTheTiger; 21/07/04 05:47 PM.
#91251 21/07/04 08:03 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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 ?

#91252 21/07/04 08:09 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
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

Last edited by TonyTheTiger; 21/07/04 08:11 PM.
#91253 21/07/04 08:27 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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

Last edited by ShinZon; 21/07/04 08:34 PM.
#91254 21/07/04 08:34 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
That one is 3 sec interval .. if you want 2 sec interval .. change the 3 to a 2.

Last edited by TonyTheTiger; 21/07/04 08:37 PM.
#91255 21/07/04 08:35 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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

Last edited by ShinZon; 21/07/04 08:36 PM.
#91256 21/07/04 08:38 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
what's the dialog name and id ?

#91257 21/07/04 08:42 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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
}

#91258 21/07/04 08:44 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
alias idler {
timeridle 0 3 if ($dialog(idletime)) did -o idletime 1 1 $!duration($idle)
}

#91259 21/07/04 08:50 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
nothing happens

#91260 21/07/04 08:50 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
your dialog has to be open

#91261 21/07/04 08:51 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
it is openet for like 1 minute and i have same number displayed all the time

#91262 21/07/04 08:54 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
* Tony wanders off feeling dizzy ...

#91263 21/07/04 09:15 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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

#91264 21/07/04 09:29 PM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
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 ?

#91265 21/07/04 09:51 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
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
}

#91266 22/07/04 12:56 AM
Joined: Jul 2004
Posts: 169
S
ShinZon Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jul 2004
Posts: 169
works perfect now !

i thank you very much !

Page 1 of 2 1 2

Link Copied to Clipboard