mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Ok here is the script partially..

alias newchanbox {
%new.chan = $chan
dialog -m newchanbox newchanbox
}

dialog newchanbox {
size -1 -1 190 200
title "Channel Options v0.10.2.b pre release Beta"
option -dbu

button "Change" , 3, 152 34 30 11
button "Remove" , 4, 152 46 30 11
button "Ban" , 13, 152 58 30 11
button "Kick" , 15, 152 70 30 11
button "KB" , 16, 152 82 30 11
button "Whois" , 17, 152 94 30 11
button "Cancel" , 5, 152 106 30 11, cancel
button "Ok" , 6, 152 118 30 11, Ok

edit $chan(%new.chan).topic , 1, 8 11 175 10, autohs
edit "" , 9, 36 96 10 8, autohs
edit $chr(35) , 12, 37 116 22 8, autohs

list 2, 8 37 130 43, vsbar hsbar
list 14, 81 94 58 105, sort vsbar

check "Limit:" , 7, 8 95 24 10, left
check "No Clr:" , 10, 8 105 24 10, left
check "Link:" , 11, 8 115 24 10, left

box $network $+ / $+ %new.chan Topic:> , 1000, 3 2 184 24
box %new.chan Ban List , 1001, 3 28 140 55
box "" , 1002, 147 28 40 104
box "" , 1006, 148 29 38 102
box Mode Options , 1003, 3 86 70 99
box %new.chan NickList , 1005, 77 86 66 106

}

;*******************Ok Button Options**************
on *:DIALOG:newchanbox:sclick:6: {
if ($did($dname,1).edited) { topic %new.chan $did($dname,1).text }
if ($did($dname,7).state == 1) { mode %new.chan +l $did($dname,9).text }
if ($did($dname,7).state == 0) {
if (l isin $chan(%new.chan).topic) { mode %new.chan -l }
}
if ($did($dname,10).state == 1) { mode %new.chan +C }
if ($did($dname,10).state == 0) {
if (C isin $chan(%new.chan).topic) { mode %new.chan -C }
}
if ($did($dname,12).edited) { mode %new.chan +L $did($dname,12).text }
if ($did($dname,12).edited == $false) {
if ($did($dname,11).state == 0) {
if (L isin $chan(%new.chan).topic) { mode %new.chan -L }
}
}
}
;//////////////////////////////////////////////////

now what happens is if i click ok or press enter my dialog closes which is normal but NO matter what i did if +l and L is set in the channel i made it check it in the script but if i click ok it will try to perform the commands no matter what i tryed $did($dname,id).edited ive tried $did($dname,id).state == 1 or 0 still dont stop command from being perform

how i know this well i put debug on and caught 2 bugs
-> irc.chaotically.com MODE #Chaotic +l
-> irc.chaotically.com MODE #Chaotic -C

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
one thing to remember is that servers usually do not treat c and C as the same thing.

Code:
on *:DIALOG:newchanbox:sclick:6: {
  if ($did(newchanbox,1).edited) { topic %new.chan $did(newchanbox,1).text }
  if ($did(newchanbox,7).state == 1) { mode %new.chan +l $did(newchanbox,9).text }
  if ($did(newchanbox,7).state == 0) || if (l isin $chan(%new.chan).topic) { mode %new.chan -l }
  if ($did(newchanbox,10).state == 1) { mode %new.chan +c }
  if ($did(newchanbox,10).state == 0) || (C isin $chan(%new.chan).topic) { mode %new.chan -c }
  if ($did(newchanbox,12).edited) { mode %new.chan +L $did(newchanbox,12).text }
  if ($did(newchanbox,12).edited == $false) {
    if ($did(newchanbox,11).state == 0) || if (L isin $chan(%new.chan).topic) { mode %new.chan -L }
  }
}


give those changes a shot

DALnet fex has this: CHANMODES=beI,k,jl,cimMnOprRst

O
Om3n
Om3n
O
It will attempt to set these modes even if they are already set, this is because at no point in the dialog event (triggered by clicking ok) do you check if these modes are already set on the channel.

By checking the state of the checkbox you can determine if you want that mode to be set on or off, but you are not checking if it is neccersary to perform the command.

Trying to set a mode on/off that is already on/off (respectively) will cause no problems or visual errors, however you will see be able to see the attempts in a debug window because they are still sent.

If you wish to improve the code to not send the commands when unneeded, you can use $chan(#).mode to check if a mode is already on. Im sure you are familiar with $chan(#).mode already, since you would have to be using it during the dialog init to built the dialog correctly.

Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
i did use it in init

on 1:dialog:newchanbox:init:*:{
ncb_loadibl
if ($me isop %new.chan) { Echo -a 4,1A15,1ccessing 4,1C15,1hannel 4,1M15,1odes 4,1F15,1or 4,1[15,1 $+ %new.chan $+ 4,1] }
else {
Echo -a 4,1A15,1ccessing 4,1C15,1hannel 4,1M15,1odes 4,1F15,1or 4,1[15,1 $+ %new.chan $+ 4,1]
did -b $dname 1,2,7,9,10,11,12,14
}
if (l isincs $chan(%new.chan).mode) { did -c $dname 7 }
if (C isin $chan(%new.chan).mode) { did -c $dname 10 }
if (L isincs $chan(%new.chan).mode) { did -c $dname 11 }
}

but when the dialog inits if L or l or C is set in topic then it checks those buttons, but it always performs the command anyhoo

O
Om3n
Om3n
O
Please read my post correctly, i know that you check them on init, but you are NOT checking them on close. You need to check them on close in order to prevent your script from sending commands it does not need to. The following is untested but i think its right.

Code:
on *:DIALOG:newchanbox:sclick:6: { 
  if ($did($dname,1).edited) { topic %new.chan $did($dname,1).text } 
  if ($did($dname,7).state == 1) {
    if ($did($dname,9).edited) || (l !isincs $chan(%new.chan).mode) {
      mode %new.chan +l $did($dname,9).text
    }
  }
  elseif ($did($dname,7).state == 0) && (l isincs $chan(%new.chan).mode) { mode %new.chan -l }
  if ($did($dname,10).state == 1) && (C !isincs $chan(%new.chan).mode) { mode %new.chan +C }
  elseif ($did($dname,10).state == 0) && (C isincs $chan(%new.chan).mode) { mode %new.chan -C } 
  if ($did($dname,11).state == 1) {
    if ($did($dname,12).edited) || (L !isincs $chan(%new.chan).mode) {
      mode %new.chan +L $did($dname,12).text
    }
  }
  elseif ($did($dname,11).state == 0) && (L isincs $chan(%new.chan).mode) { mode %new.chan -L } 
}

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
The irc network I'm on does display duplicate modes, both for channel and user modes. If you op someone 20 times, you see 20 lines with * nick sets mode: +o nick2.

ps: I'm not saying it's a good thing.

O
Om3n
Om3n
O
Indeed some do, although none im on behave this way, which is why i suggested the mode checking on 'ok' instead of just sending the commands like the original code was doing.


Link Copied to Clipboard