mIRC Home    About    Download    Register    News    Help

Print Thread
#38007 23/07/03 09:27 AM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Playing around with timers and dialogs, i came up with this

Code:
menu channel {
  Timer Starter Stopper:dialog -m tstop tstop
}

dialog tstop {
  title ""
  size -1 -1 104 162
  option dbu
  check "Timer 1", 1, 10 15 40 10
  check "Timer 2", 2, 10 40 40 10
  check "Timer 3", 3, 10 65 40 10
  check "Timer 4", 4, 10 90 40 10
  check "Timer 5", 5, 10 115 40 10
  check "Timer 6", 6, 50 15 40 10
  check "Timer 7", 7, 50 40 41 10
  check "Timer 8", 8, 50 65 40 10
  check "Timer 9", 9, 50 90 40 10
  check "Timer 0", 10, 50 115 40 10
  edit "", 11, 10 25 40 10, read
  edit "", 12, 10 50 40 10, read
  edit "", 13, 10 75 40 10, read
  edit "", 14, 10 100 40 10, read
  edit "", 15, 10 125 40 10, read
  edit "", 16, 50 25 40 10, read
  edit "", 17, 50 50 40 10, read
  edit "", 18, 50 75 40 10, read
  edit "", 19, 50 100 40 10, read
  edit "", 20, 50 125 40 10, read 
  box "mIRC Event Timer Starter/Stopper", 21, 5 5 93 135
  box "", 22, 48 139 50 20
  icon 23, 6 143 16 16,  C:\Program Files\mIRC\ShadowDemon\scripts\mircscripts.icl, 0
  icon 24, 24 143 16 16,  C:\Program Files\mIRC\ShadowDemon\scripts\mircscripts.icl, 6
  button "Close", 25, 50 144 46 13, ok cancel  
}

on 1:dialog:tstop:sclick:1: {
  if ($did(1).state) .timer11 0 10 msg #sod test
  else .timer11 off
}


Now because the timer on/off is surpressed i dont know if the timer is on or off
thats what the edit boxes are for.

What i want to know is how would i add a message to the edit box that displays
"Enabled" or "Disabled"

I came up with

Code:
on 1:dialog:tstop:init:1: {
  if ($did(1).$dname Enabled
  else Disabled
}

on 1:dialog:tstop:sclick:1: {
  if ($did(1).state) .timer11 0 10 msg #sod test
  else .timer11 off
}


But that dont work, i`v tried looking at the help file (again esp in the $did section)
and i still dont understand it, can anybody point me to another online resource that might help
understand $did better.

What i`m trying to do is display wether a timer is running or not in an edit box, corrasponding with it`s timer

Thanks
ShadowDemon
mIRC V6.03


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38008 23/07/03 09:34 AM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46
$iif($did(1).state == 0,$did -a $dname 11 off,$did -a $dname 11 off)

maybe, probably won't work but im not the best myself so eh.

#38009 23/07/03 09:43 AM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Umm thanks vexx0r

But i dont know where to put that, so i dont know if it works or not

This is what i have now

[code
menu channel {
Timer Starter Stopper:dialog -m tstop tstop
}

dialog tstop {
title ""
size -1 -1 104 162
option dbu
check "Timer 1", 1, 10 15 40 10
check "Timer 2", 2, 10 40 40 10
check "Timer 3", 3, 10 65 40 10
check "Timer 4", 4, 10 90 40 10
check "Timer 5", 5, 10 115 40 10
check "Timer 6", 6, 50 15 40 10
check "Timer 7", 7, 50 40 41 10
check "Timer 8", 8, 50 65 40 10
check "Timer 9", 9, 50 90 40 10
check "Timer 0", 10, 50 115 40 10
edit "", 11, 10 25 40 10, read
edit "", 12, 10 50 40 10, read
edit "", 13, 10 75 40 10, read
edit "", 14, 10 100 40 10, read
edit "", 15, 10 125 40 10, read
edit "", 16, 50 25 40 10, read
edit "", 17, 50 50 40 10, read
edit "", 18, 50 75 40 10, read
edit "", 19, 50 100 40 10, read
edit "", 20, 50 125 40 10, read
box "mIRC Event Timer Starter/Stopper", 21, 5 5 93 135
box "", 22, 48 139 50 20
icon 23, 6 143 16 16, C:\Program Files\mIRC\ShadowDemon\scripts\mircscripts.icl, 0
icon 24, 24 143 16 16, C:\Program Files\mIRC\ShadowDemon\scripts\mircscripts.icl, 6
button "Close", 25, 50 144 46 13, ok cancel
}
on 1:dialog:tstop:init:1: {
$iif($did(1).state == 0,$did -a $dname 11 off,$did -a $dname 11 off)
}


on 1:dialog:tstop:sclick:1: {
if ($did(1).state) .timer11 0 10 msg #sod test
else .timer11 off
}
[/code]

It`s probably wrong or something

Thanks for helping
ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38010 23/07/03 10:47 AM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46
Well, here is what you wanted, (I think...)

Code:
  
menu channel {
  Timer Starter Stopper:dialog -m tstop tstop
}

dialog tstop {
  title ""
  size -1 -1 104 162
  option dbu
  check "Timer 1", 1, 10 15 40 10
  check "Timer 2", 2, 10 40 40 10
  check "Timer 3", 3, 10 65 40 10
  check "Timer 4", 4, 10 90 40 10
  check "Timer 5", 5, 10 115 40 10
  check "Timer 6", 6, 50 15 40 10
  check "Timer 7", 7, 50 40 41 10
  check "Timer 8", 8, 50 65 40 10
  check "Timer 9", 9, 50 90 40 10
  check "Timer 0", 10, 50 115 40 10
  edit "", 11, 10 25 40 10, read
  edit "", 12, 10 50 40 10, read
  edit "", 13, 10 75 40 10, read
  edit "", 14, 10 100 40 10, read
  edit "", 15, 10 125 40 10, read
  edit "", 16, 50 25 40 10, read
  edit "", 17, 50 50 40 10, read
  edit "", 18, 50 75 40 10, read
  edit "", 19, 50 100 40 10, read
  edit "", 20, 50 125 40 10, read 
  box "mIRC Event Timer Starter/Stopper", 21, 5 5 93 135
  box "", 22, 48 139 50 20
  icon 23, 6 143 16 16,  C:\Program Files\mIRC\ShadowDemon\scripts\mircscripts.icl, 0  icon 24, 24 143 16 16,  C:\Program Files\mIRC\ShadowDemon\scripts\mircscripts.icl, 6 
  button "Close", 25, 50 144 46 13, ok cancel 
}

on 1:dialog:tstop:sclick:1: {
  $iif($did(1).state == 0,set %status Off,set %status On) | did -r $dname 11 
  did -a $dname 11 %status  
  $iif(%status == On,.timer1 0 10 msg #sod test,.timer1 off)  
}

on 1:dialog:tstop:sclick:2: {
  $iif($did(2).state == 0,set %status Off,set %status On) | did -r $dname 12 
  did -a $dname 12 %status  
  $iif(%status == On,.timer2 0 10 msg #sod test,.timer2 off)
}

on 1:dialog:tstop:sclick:3: {
  $iif($did(3).state == 0,set %status Off,set %status On) | did -r $dname 13 
  did -a $dname 13 %status  
  $iif(%status == On,.timer3 0 10 msg #sod test,.timer3 off)
}
on 1:dialog:tstop:sclick:4: {
  $iif($did(4).state == 0,set %status Off,set %status On) | did -r $dname 14 
  did -a $dname 14 %status  
  $iif(%status == On,.timer4 0 10 msg #sod test,.timer4 off)
}
on 1:dialog:tstop:sclick:5: {
  $iif($did(5).state == 0,set %status Off,set %status On) | did -r $dname 15 
  did -a $dname 15 %status  
  $iif(%status == On,.timer5 0 10 msg #sod test,.timer5 off)
}
on 1:dialog:tstop:sclick:6: {
  $iif($did(6).state == 0,set %status Off,set %status On) | did -r $dname 16 
  did -a $dname 16 %status  
  $iif(%status == On,.timer6 0 10 msg #sod test,.timer6 off)
}
on 1:dialog:tstop:sclick:7: {
  $iif($did(7).state == 0,set %status Off,set %status On) | did -r $dname 17 
  did -a $dname 17 %status  
  $iif(%status == On,.timer7 0 10 msg #sod test,.timer7 off)
}
on 1:dialog:tstop:sclick:8: {
  $iif($did(8).state == 0,set %status Off,set %status On) | did -r $dname 18 
  did -a $dname 18 %status  
  $iif(%status == On,.timer8 0 10 msg #sod test,.timer8 off)
}
on 1:dialog:tstop:sclick:9: {
  $iif($did(9).state == 0,set %status Off,set %status On) | did -r $dname 19 
  did -a $dname 19 %status  
  $iif(%status == On,.timer9 0 10 msg #sod test,.timer19 off)
}
on 1:dialog:tstop:sclick:10: {
  $iif($did(10).state == 0,set %status Off,set %status On) | did -r $dname 20 
  did -a $dname 20 %status  
  $iif(%status == On,.timer10 0 10 msg #sod test,.timer10 off)
}



I took the liberty of changing the timers names and, you will have to make the dialog init grab the timers in order to have text in the edit boxes when you open the dialog, i am not sure if this is what you wanted but it gives you an idea, and before you complain, i am as new at this as you so smile

#38011 23/07/03 11:55 AM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Thanks vexx0r

It works, yeah i know the timers names were probably wrong or whatever, but i have other timers running at startup, so i chose higher up numbers so they wouldnt conflict.

One more thing, how do i get the script to show "Off" upon initial script running, before i click the tick box ?

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38012 23/07/03 12:02 PM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46
What is the point of making something if you are not actually making it, and tehre are a couple of ways, you could do a /timers and grab it, or if you are only going to set these tiemrs with this dialog then you can set the value on close and on init have the edit box filled witht he proper values, but this will create a problem on disconnect, unless you also add in there on disconnect set all editboxes in this dialog off, i am not very good at explaining this stuff, but i guess that comes with time. try it, if you need help i will see what i can help you with...

#38013 23/07/03 12:11 PM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46
Unless you just want it to show "off" when you open the dialog and set it on and off that way, either way, it would be fairly easy.

#38014 23/07/03 12:16 PM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Haha, good point grin .....

Umm i`ll leave it as it is, it works so no point trying to make it go any further, i suppose when i first run the dialog from the script, all the timers, except the timers 1 & 2 i have running at connection startup will be turned off by default, so no need to display this, but atleast i can click the tick boxes and know if they are running or not.

Thanks for all your help.

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38015 23/07/03 12:17 PM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
yeah that what i kind of meant, to show off when i opened the dialog

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38016 23/07/03 12:19 PM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46
heh, lame crazy

anyway it would be better if you acually did /help dialog and just try and finish it, you will feel better about yourself when your done....

#38017 23/07/03 12:28 PM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Heh, yeah i know sounds lame crazy ...

I`ve tried /help dialog and /help did and looked in the help file, the most difficult i`v found is using that damned $did command.

I`m not very good at scripting and i`m unsure of all of mirc commands some of them dont even work (that i know of)

i`m not a programmer so this is really a first for me using the "timers" and "$iif" whatevers, it took me 8 months to figure out how to add an alias.

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38018 23/07/03 12:41 PM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46

;$did
;did switches dialogname $did(id)
;$iif
;$iif(condition operator condition,this,if not that then this)
;so basically $iif is just another way to preform an if else
;statement

#38019 23/07/03 12:55 PM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Umm ok i think i kind of get what you mean.

Im` not that good with if else statements maybe thats why it was difficult for me to get my head round this one.

I think next time i`ll leave complex scripting alone.

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38020 23/07/03 10:42 PM
Joined: Jul 2003
Posts: 46
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Jul 2003
Posts: 46
complex, this was not complex.

#38021 24/07/03 08:48 AM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Twas for me blush

You must remembert some people learn stuff at a faster rate than others, yeah i may of been reg`ed with this board a long time (Others longer)
But it takes me a lot longer to learn scripting than others, and if i get stuck with $did then yeah i would say that was complex for me, but then going into stuff like $iif and others, well yeah ... you get my point ?

And yet a few months back somebody posted a question about using an icon to click on instead of a button, if i remember correctly, i helped with that, cos i made a script of my own that does that (i worked that out all by myself) it uses "SCLICK" and the id number of the icon, may sound pretty easy, but not to the person i helped, which is why they asked that question.

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience
#38022 24/07/03 09:06 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Just a late addition, all your on DIALOG events with id's 1~10 can be replaced with the following if you'd like:

Code:
on 1:dialog:tstop:sclick:*: {
  if ($did > 0) && ($did < 11) {
    $iif($did($did).state == 0,set %status Off,set %status On) | did -r $dname $calc($did + 10)
    did -a $dname $calc($did + 10) %status 
    $iif(%status == On,.timer [ $+ [ $did ] ] 0 10 msg #sod test,.timer [ $+ [ $did ] ] off) 
  }
}


-KingTomato
#38023 24/07/03 10:30 PM
Joined: Dec 2002
Posts: 295
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 295
Thanks KingTomato, i was planning on having different messages depending on which timer i tick, for example i would use Timer11 to tell everyone in my channel that i`m testing a script and that everyone should come back in if i kick them and Timer12 might be to annoince that my website is updated, was thinking of making it as a personal advert type script while i get used to check boxes, might even do away with the timers (i just thought i`d try to learn them)

Just looking back at the codeing, i can see that this could be used as a spam type/flooding script, ooooops blush grin
Not my intention, altho i only chat in one channel, and if i do goto another channel, i would make sure that all scripts of mine (mine have made or others i have added) have been turned off so i dont get kicked for spamming.

My intention was to turn on a function, be it a timer or something else, and use an edit box to display whether it`s on or off.

ShadowDemon


Never argue with an idiot...they'll drag you down to their level and beat you up with experience

Link Copied to Clipboard