mIRC Home    About    Download    Register    News    Help

Print Thread
Dialog question #204733 29/09/08 08:07 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

I need some help trying to write a piece of code that would allow me to create an exception.

Say for example I would like to add access to all of the nicks in my channel by default.
here is my code:

Code:
;syntax: addall <chan> <type>
alias addall {
  var %^ = $nick($1,0)
  while (%^) {
    if ($nick($1,%^) != $me) { access $1 add $2 $v1 }
    dec %^
  }
}


But let's say I want to add an exception; I would like add access to all of the following individuals except: nickname1,nickname2,nickname3 (The format should be nickname seperate by commas to handle single or multiple nicks to except)

I am not quite sure how to relate this back to the alias and to the dialog

Code:
dialog addall {
  title "Add All"
  size -1 -1 109 82
  option dbu
  combo 2, 13 15 79 10, drop
  box "", 1, 1 -1 106 67
  text "What type of entry would you like to add?", 3, 3 5 107 8
  button "OK", 4, 34 69 35 11, default flat ok cancel
  check "Except:", 5, 13 26 30 10
  edit "", 6, 12 37 90 10
  text "Add nick(s) seperated by commas", 7, 13 48 89 8
  text "eg. nick1,nick2,nick3 ect.", 8, 13 56 89 8
}



Thanks in advance,

Cheers,

Jay

Last edited by Buggs2008; 29/09/08 08:09 PM.
Re: Dialog question [Re: Buggs2008] #204734 29/09/08 08:31 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
check /help token identifiers

specifically $istok should help you in the right direction.

btk


billythekid
Re: Dialog question [Re: Buggs2008] #204742 30/09/08 03:26 AM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hi Billy,

Thanks so much for the reply.

I have an idea of how to use it, but i am not quite sure how to tie it into the alias. Any ideas?

Thanks a bunch.

Cheers

Jay

Re: Dialog question [Re: Buggs2008] #204743 30/09/08 04:05 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
alias addall {
  var %^ = $nick($1,0)
  while (%^) {
    if !$istok($did(addall,6),$nick($1,%^),44) && ($nick($1,%^) != $me) { access $1 add $2 $v1 }
    dec %^
  }
}

Re: Dialog question [Re: Buggs2008] #204744 30/09/08 04:10 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Here's an injection of the alias into the dialog with added INIT to the dialog so it loads your combo box at least with + and o for now so that it can be intepreted into your script. However, you will need to do the check's of the CHECKMARK by yourself its not hard, just use /help $did

the most common checkbox routine is $did($dname,id).state which reveals 0 if not checked or 1 if it is... a simple if routine will perfectly work to your advantage if used correctly.

You will also notice that I used $active in the script since your dialog box does not have channel entry.

All the rest can be edited you will now know how to edit this script via this included example for your future and completed use.

I also make a simple istok check to make sure that any nick included in that editbox seperated by commas is not used.

Thanks, Lpfix!

Code:
dialog addall {
  title "Add All"
  size -1 -1 109 82
  option dbu
  combo 2, 13 15 79 10, drop
  box "", 1, 1 -1 106 67
  text "What type of entry would you like to add?", 3, 3 5 107 8
  button "OK", 4, 34 69 35 11, default flat ok cancel
  check "Except:", 5, 13 26 30 10
  edit "", 6, 12 37 90 10
  text "Add nick(s) seperated by commas", 7, 13 48 89 8
  text "eg. nick1,nick2,nick3 ect.", 8, 13 56 89 8
}
on *:dialog:addall:INIT:0:{ didtok $dname 2 44 +,o }
on *:dialog:addall:sclick:4:{ addall $active $did($dname,2) }
alias -l addall {
  var %^ = $nick($1,0)
  while (%^) {
    if ($nick($1,%^) != $me) || ($istok($did(addall,6),44) == $false) { access $1 add $2 $v1 }
    dec %^
  }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Dialog question [Re: Buggs2008] #204760 30/09/08 04:09 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Thanks so much to everyone for all of your help.

Cheers,

Jay

Re: Dialog question [Re: Buggs2008] #204769 30/09/08 10:58 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hi LpFix =)

I wasn't quite sure where to implement your suggestion, however Russel's example in this case seemed to be more easier and for my level of scripting it saved me some brain cells lol

Thanks so much again.

Cheers and have a nice evening.

Jay

Re: Dialog question [Re: Buggs2008] #204908 05/10/08 07:14 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
THere was nothing to implement it was ready for you to use in the dialog and just fix what you needed around it wink


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }