mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
I've just finished making my dialog interface but have no idea how to put the ctcp blocking codes that are in the unsorted area into the dialog buttons


;##############################################
;
; Dialog
;
;##############################################

dialog ctcpblocker {
title "CTCP Blocker"
size -1 -1 204 196
option dbu
tab "Page 1", 2001, 0 2 204 194
box "", 2101, 12 20 180 155, tab 2001
check "Client Info", 1, 40 40 70 8, tab 2001
check "Time", 2, 120 55 70 8, tab 2001
check "MP3", 3, 40 85 70 8, tab 2001
check "ERRMSG", 4, 40 55 70 8, tab 2001
check "Ping", 5, 40 115 70 8, tab 2001
check "Finger", 6, 40 70 70 8, tab 2001
check "MP3GET", 7, 40 100 70 8, tab 2001
check "RAR", 8, 40 130 70 8, tab 2001
check "Slots", 9, 40 145 70 8, tab 2001
check "Sound", 10, 120 40 70 8, tab 2001
check "WAV", 11, 120 85 70 8, tab 2001
check "User Info", 15, 120 70 70 8, tab 2001
button "Cancel", 2008, 120 178 26 14, cancel
button "OK", 2011, 60 178 26 14, ok
}

;##############################################
;
; Menu
;
;##############################################

menu status {
CTCP Blocker: { dialog -m ctcpblocker ctcpblocker }
}

;##############################################
;
; Unsorted
;
;##############################################

#ctcp_blocker.clientinfo on
ctcp *:CLIENTINFO: { halt }
#ctcp_blocker.clientinfo end

#ctcp_blocker.errmsg on
ctcp *:ERRMSG: { halt }
#ctcp_blocker.errmsg end

#ctcp_blocker.finger on
ctcp *:FINGER: { halt }
#ctcp_blocker.finger end

#ctcp_blocker.mp3 on
ctcp *:MP3: { halt }
#ctcp_blocker.mp3 end

#ctcp_blocker.mp3get on
ctcp *:MP3GET: { halt }
#ctcp_blocker.mp3get end

#ctcp_blocker.ping on
ctcp *:PING: { halt }
#ctcp_blocker.ping end

#ctcp_blocker.rar on
ctcp *:RAR: { halt }
#ctcp_blocker.rar end

#ctcp_blocker.slots on
ctcp *:SLOTS: { halt }
#ctcp_blocker.slots end

#ctcp_blocker.sound on
ctcp *:SOUND: { halt }
#ctcp_blocker.sound end

#ctcp_blocker.time on
ctcp *:TIME: { halt }
#ctcp_blocker.time end

#ctcp_blocker.userinfo on
ctcp *:USERINFO: { halt }
#ctcp_blocker.userinfo end

#ctcp_blocker.wav on
ctcp *:WAV: { halt }
#ctcp_blocker.wav end

on *:LOAD: {
.set %ctcp_blocker.clientinfo On
.set %ctcp_blocker.errmsg On
.set %ctcp_blocker.finger On
.set %ctcp_blocker.mp3 On
.set %ctcp_blocker.mp3get On
.set %ctcp_blocker.ping On
.set %ctcp_blocker.rar On
.set %ctcp_blocker.slots On
.set %ctcp_blocker.sound On
.set %ctcp_blocker.time On
.set %ctcp_blocker.userinfo On
.set %ctcp_blocker.wav On
echo -a 0,2 CTCP Blocker 12,8 « Loaded Successfully » 
}

on *:UNLOAD: {
.disable #ctcp_blocker.clientinfo
.disable #ctcp_blocker.errmsg
.disable #ctcp_blocker.finger
.disable #ctcp_blocker.mp3
.disable #ctcp_blocker.mp3get
.disable #ctcp_blocker.ping
.disable #ctcp_blocker.rar
.disable #ctcp_blocker.slots
.disable #ctcp_blocker.sound
.disable #ctcp_blocker.time
.disable #ctcp_blocker.userinfo
.disable #ctcp_blocker.wav
.unset %ctcp_blocker*
saveini
echo -a 0,2 CTCP Blocker 12,8 « Unloaded Successfully » 
}

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hey Kev, I don't fully understand what you meant. I am quite restless at the mo. Do you mean something like:

Code:
menu channel {
  $iif($dialog(ctcpblocker),$style(3)) CTCP Blocker: { 
    dialog -dm ctcpblocker ctcpblocker
  }
}

dialog ctcpblocker {
  title "CTCP Blocker"
  size -1 -1 204 196
  option dbu
  tab "Page 1", 2001, 0 2 204 194
  box "", 2101, 12 20 180 155, tab 2001
  check "Client Info", 1, 40 40 70 8, tab 2001
  check "Time", 2, 120 55 70 8, tab 2001
  check "MP3", 3, 40 85 70 8, tab 2001
  check "ERRMSG", 4, 40 55 70 8, tab 2001
  check "Ping", 5, 40 115 70 8, tab 2001
  check "Finger", 6, 40 70 70 8, tab 2001
  check "MP3GET", 7, 40 100 70 8, tab 2001
  check "RAR", 8, 40 130 70 8, tab 2001
  check "Slots", 9, 40 145 70 8, tab 2001
  check "Sound", 10, 120 40 70 8, tab 2001
  check "WAV", 11, 120 85 70 8, tab 2001
  check "User Info", 15, 120 70 70 8, tab 2001
  button "Cancel", 2008, 120 178 26 14, cancel
  button "OK", 2011, 60 178 26 14, ok
}

on 1:Dialog:ctcpblocker:sclick:*: {
  if ($did == 1) && ($did(ctcpblocker,1).state == 0) { 
    set %ctcp_blocker.clientinfo off 
  }
  if ($did == 1) && ($did(ctcpblocker,1).state == 1) { 
    set %ctcp_blocker.clientinfo on 
  }
  if ($did == 2) && ($did(ctcpblocker,2).state == 0) { 
    set %ctcp_blocker.time off 
  }
  if ($did == 2) && ($did(ctcpblocker,2).state == 1) { 
    set %ctcp_blocker.time on
  }
  if ($did == 3) && ($did(ctcpblocker,3).state == 0) { 
    set %ctcp_blocker.mp3 off
  }
  if ($did == 3) && ($did(ctcpblocker,3).state == 1) { 
    set %ctcp_blocker.mp3 on
  }
  if ($did == 4) && ($did(ctcpblocker,4).state == 0) { 
    set %ctcp_blocker.errmsg off
  }
  if ($did == 4) && ($did(ctcpblocker,4).state == 1) { 
    set %ctcp_blocker.errmsg on 
  }
  if ($did == 5) && ($did(ctcpblocker,5).state == 0) { 
    set %ctcp_blocker.ping off 
  }
  if ($did == 5) && ($did(ctcpblocker,5).state == 1) {
    set %ctcp_blocker.ping on 
  }
  if ($did == 6) && ($did(ctcpblocker,6).state == 0) { 
    set %ctcp_blocker.finger off 
  }
  if ($did == 6) && ($did(ctcpblocker,6).state == 1) { 
    set %ctcp_blocker.finger on
  }
  if ($did == 7) && ($did(ctcpblocker,7).state == 0) { 
    set %ctcp_blocker.mp3get off
  }
  if ($did == 7) && ($did(ctcpblocker,7).state == 1) { 
    set %ctcp_blocker.mp3get on
  }
  if ($did == 8) && ($did(ctcpblocker,8).state == 0) { 
    set %ctcp_blocker.rar off
  }
  if ($did == 8) && ($did(ctcpblocker,8).state == 1) { 
    set %ctcp_blocker.rar on 
  }
  if ($did == 9) && ($did(ctcpblocker,9).state == 0) { 
    set %ctcp_blocker.slots off 
  }
  if ($did == 9) && ($did(ctcpblocker,9).state == 1) { 
    set %ctcp_blocker.slots on 
  }
  if ($did == 10) && ($did(ctcpblocker,10).state == 0) { 
    set %ctcp_blocker.sound off 
  }
  if ($did == 10) && ($did(ctcpblocker,10).state == 1) { 
    set %ctcp_blocker.sound on
  }
  if ($did == 11) && ($did(ctcpblocker,11).state == 0) { 
    set %ctcp_blocker.wav off
  }
  if ($did == 11) && ($did(ctcpblocker,11).state == 1) { 
    set %ctcp_blocker.wav on
  }
  if ($did == 15) && ($did(ctcpblocker,15).state == 0) {
    set %ctcp_blocker.userinfo off 
  }
  if ($did == 15) && ($did(ctcpblocker,15).state == 1) { 
    set %ctcp_blocker.userinfo on 
  }
}

on 1:dialog:ctcpblocker:init:0: {
  if (%ctcp_blocker.clientinfo == on) { 
    did -c ctcpblocker 1 
  }
  if (%ctcp_blocker.time == on) {
    did -c ctcpblocker 2 
  }
  if (%ctcp_blocker.mp3 == on) { 
    did -c ctcpblocker 3 
  }
  if (%ctcp_blocker.errmsg == on) {
    did -c ctcpblocker 4 
  }
  if (%ctcp_blocker.ping == on) { 
    did -c ctcpblocker 5 
  }
  if (%ctcp_blocker.finger == on) {
    did -c ctcpblocker 6 
  }
  if (%ctcp_blocker.mp3get == on) { did -c ctcpblocker 7 }
  if (%ctcp_blocker.rar == on) { 
    did -c ctcpblocker 8
  }
  if (%ctcp_blocker.slots == on) { 
    did -c ctcpblocker 9 
  }
  if (%ctcp_blocker.sound == on) { 
    did -c ctcpblocker 10 
  }
  if (%ctcp_blocker.wav == on) {
    did -c ctcpblocker 11
  }
  if (%ctcp_blocker.userinfo == on) { 
  did -c ctcpblocker 15 }
}

on *:LOAD: {
  .set %ctcp_blocker.clientinfo On
  .set %ctcp_blocker.errmsg On
  .set %ctcp_blocker.finger On
  .set %ctcp_blocker.mp3 On
  .set %ctcp_blocker.mp3get On
  .set %ctcp_blocker.ping On
  .set %ctcp_blocker.rar On
  .set %ctcp_blocker.slots On
  .set %ctcp_blocker.sound On
  .set %ctcp_blocker.time On
  .set %ctcp_blocker.userinfo On
  .set %ctcp_blocker.wav On
  echo -a 0,2 CTCP Blocker 12,8 « Loaded Successfully » 
}

on *:Unload: {
  unset %ctcp_blocker.*
  echo -a 0,2 CTCP Blocker 12,8 « Unloaded Successfully » 
}

ctcp *:CLIENTINFO: { 
  if (%ctcp_blocker.clientinfo == on) { 
    halt 
  }
}

ctcp *:ERRMSG: {
  if (%ctcp_blocker.errmsg == on) { 
    halt 
  }
}

ctcp *:FINGER: { 
  if (%ctcp_blocker.finger == on) { 
    halt 
  }
}

ctcp *:MP3: { 
  if (%ctcp_blocker.mp3 == on) { 
    halt 
  }
}

ctcp *:MP3GET: {
  if (%ctcp_blocker.mp3get == on) {
    halt
  }
}

ctcp *:PING: { 
  if (%ctcp_blocker.ping == on) {
    halt
  }
}

ctcp *:RAR: {
  if (%ctcp_blocker.rar == on) {
    halt
  }
  else {
    do stuff 
  }
}

ctcp *:SLOTS: { 
  if (%ctcp_blocker.rar == on) {
    halt
  }
}

ctcp *:SOUND: { 
  if (%ctcp_blocker.sound == on) {
    halt 
  }
}

ctcp *:TIME: { 
  if (%ctcp_blocker.time == on) {
    halt 
  }
}

ctcp *:USERINFO: { 
  if (%ctcp_blocker.userinfo == on) { 
    halt 
  }
}

ctcp *:WAV: { 
  if (%ctcp_blocker.wav == on) { 
    halt
  }
}

Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
Thanks Slade it was prefect, i would imagine if i wanted to add more i would copy the same coding?

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Yep, key points to get the hang of it...
Code:
if ($did == 15) && ($did(ctcpblocker,15).state == 0) {    set %ctcp_blocker.userinfo off   }


$did = Dialog ID, so we check if the dialog ID is 15. The state property which determines whether or not the check box is checked or unchecked. Where 0 means unchecked, 1 means checked.

So the above code will set the variable %ctcp_blocker.userinfo off. If and only if the checkbox isn't checked.

Hope this helps!

Come back if you need further assistance.

Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
I just made another entry called xdcclist and it works, one thing im stuck on now, is what happens if i add page 2 would the coding still be the same as in the ID?

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
If you mean sharing the same ID, the dialog wont work. You'll get an error for duplication. Each control needs its own ID.

Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
No i mean if i had page 2 (tab) and add another ctcp mode, would the coding be the same, except for the ID

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Sorry yeah, the code would still be the same. smile
$did($dname,ID).state

Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
Good that makes my life so much easier, im very new to dialog, as you can tell, and took me ages to do the dialog interface

Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
There is one thing that needs adding that is an Unistall CTCP Blocker on

menu channel {
$iif($dialog(ctcpblocker),$style(3)) CTCP Blocker: {
dialog -dm ctcpblocker ctcpblocker
}
}

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
For someone who's just started out with dialogs, your first looks pretty damn good. There is a program called dstudio that is designed especially to create your dialogs for you, it has all the controls you need to do is Click, Drop, Drag. I'll put the zip folder on my site for you to download, I'll leave it on there today.

The only thing it doesn't support is events code, it just builds the interface for you. Dialogs are pretty easy to do once you know how and the help file explains everything you need to know.

/help /did
/help /dialog
/help /didtok


Here is Dialog Studio. Hope this helps.

Joined: Sep 2004
Posts: 237
Fjord artisan
Offline
Fjord artisan
Joined: Sep 2004
Posts: 237
No sure but do you mean something like this?

Code:
 menu channel {
CTCP Blocker
.$iif($dialog(ctcpblocker),$style(3)) CTCP Blocker: {
dialog -dm ctcpblocker ctcpblocker
}
.Uninstall CTCP Blocker:/unload... bla bla bla
} 

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
The $style(3) identifier wouldn't work in that. So we don't need to use it. It'd make no difference if we leave it in or take it out it'd still look the same. smile

Code:
menu channel {
  CTCP Blocker
  .Run: { 
    dialog -dm ctcpblocker ctcpblocker
  }
  .Unload: { 
    unload -rs ctcp.blocker.mrc
    unset %ctcp_blocker.* 
  }
}

Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
menu channel {
CTCP Blocker
.$iif($dialog(ctcpblocker),$style(3)) Setup: {
dialog -dm ctcpblocker ctcpblocker
}
.-
.Uninstall CTCP Blocker:/unload -rs ctcp.blocker.mrc
}

done it, i'm so pleased with this script, it's quite handy for protection, i'm so addicted to dialog now that i need to think of something else to make lol

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
LOL. There's loads of things you can do with dialogs, so have a good think. wink


Link Copied to Clipboard