mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
$chan(#).mode) #62836 04/12/03 07:50 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
how can i edit style in popups with that?
Code:
menu channel {
  $iif([color:red]som_mode[/color] isin  $cha(#).mode),$style(1)) -n
}

and if +n isnt in $cha$chan(#).mode), then i want to show +n
somone that have figured this one out? :tongue: "took +n/-n as an example" smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62837 05/12/03 05:10 AM
Joined: Nov 2003
Posts: 227
H
Hitchhiker Offline
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
Is this what you want?

menu channel {
$iif(n isin $chan(#).mode,mode -n,mode +n):/mode # $iif(n isin $chan(#).mode,-n,+n)
}

Re: $chan(#).mode) #62838 05/12/03 05:16 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Code:
/parsemodes {
  /set -u0 %param 2
  /set -u0 %m 1
  while (%m <= $len($gettok($1, 1, 32))) {
    /set -u0 %chr $mid($gettok($1, 1, 32), %m, 1)
    if (%chr == +) || (%chr == -) { /set -u0 %mod %chr }
    else {
      if ((%chr isincs $remove($gettok($chanmodes,1-3,44),$chr(44))) || (%chr isincs qaohv)) {
        /set -u0 %modes $addtok(%modes, $+(%mod,%chr,:,$gettok($1, %param, 32)), 32)
        /inc -u0 %param
      }
      else { /set -u0 %modes $addtok(%modes, $+(%mod,%chr), 32) }
    }
    /inc -u0 %m
  }
  return %modes
} 



Use that alais, then sue something like:

menu channel {
$iif($istok($parsemodes($chan(#).mode, +mode, 32), True, False): /blah
}
}


-KingTomato
Re: $chan(#).mode) #62839 05/12/03 11:53 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Nope, didnt work as i wanted it to.. i want the menu to get a look of $style(2) if +n = true.. if +n = false, then it should be the "normal" menu


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62840 05/12/03 04:33 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Now i got this to work:
Code:
Modes
.$iif(+n isin $chan(#).mode,$style(1)) Modes change:/

but can i make popup/remote notice that if +n isin $chan(#).mode (do this) elseif +n !isin $chan(#).mode (do that)
i hope you understand what i mean.. cos now i see the same menu if +n is set to a channel.. i want it to do like /mode # +n (if +n arent in chanmode) and /mode # -n (if +n isin chanmode), i guess i could call a alias, but i think it's an easyer wat to solve it? :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62841 05/12/03 05:30 PM
Joined: Nov 2003
Posts: 227
H
Hitchhiker Offline
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
I must have missed what you wanted to do,
i thought you just wanted a popup mode toggle if there is no n in the modes then have the popup say +n and if there is n in the modes then have the popup set mode -n.
in that case you would just have to check:
if (n isincs $gettok($chan(#).mode,1,32))
i should have said that in my example above. but i missed out the $gettok from it.
if you searched the string for +n there are many times when it would be false, say the modes were +inst.
//if (+n isincs +inst) { echo -a this will never happen }



Re: $chan(#).mode) #62842 05/12/03 05:57 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I solved that problem with an alias.. thnx for your help with that. but i can ask another question, if $chan(#).mode is null, how can i make it use another style of the menu? like if it's null, then i want it to be a regular popup, but when modes is set in a channel.. (active one), then i want to use "$style(1)", but now when i try, then i dont see the menu at all, and i dunno how to make popup see if i want that litle thingie infront of the text, ($style(1) adds a litle thingie beside the text in the popup).. and if i dont tell mirc that i only want that when a mode in a channel is set, then it's there all the time..

as you see the meny is "shecked" if the channel mode is set. if it's not set, then the litle thingie dissapear beside the mode.. but the problem is the one on top, there you see:
Currently » #like_this +nt :tongue:

Found another problem.. frown $chan(#).mode also take the chan key as a mode, so if a "m" isin the key, then it see the channel as moderated.. any way around this? confused


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62843 05/12/03 06:56 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
There is a way, use the alias i gave you..

;parse modes
alias pm {
/set -u0 %param 2
/set -u0 %m 1
while (%m <= $len($gettok($1, 1, 32))) {
/set -u0 %chr $mid($gettok($1, 1, 32), %m, 1)
if (%chr == +) || (%chr == -) { /set -u0 %mod %chr }
else {
if ((%chr isincs $remove($gettok($chanmodes,1-3,44),$chr(44))) || (%chr isincs qaohv)) {
/set -u0 %modes $addtok(%modes, $+(%mod,%chr,:,$gettok($1, %param, 32)), 32)
/inc -u0 %param
}
else { /set -u0 %modes $addtok(%modes, $+(%mod,%chr), 32) }
}
/inc -u0 %m
}
return %modes
}

menu channel {
Channel Modes
.$iif($wildtok($pm($chan(#).mode), +k*, 1, 32) != $null, $style(1)) Channel Key (+k $chan(#).key $+ ): /mode # -k $chan(#).key
.$iif($istok($pm($chan(#).mode), +m, 32), $style(1)) Moderated (+m): /mode # +m
.$iif($istok($pm($chan(#).mode), +n, 32), $style(1)) No External Messages (+n): /mode # +n
}


type //mode # -m+nk abcmdef

And see what I mean >:P


-KingTomato
Re: $chan(#).mode) #62844 05/12/03 07:15 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I stick with my alias.. wink but do somone know how to remove key from $chan(#).mode ? in the popup i dont need to show the key at all.. so it should be striped out.. and $chan(#).mode return mode +m if a key set in the channel includes a m.. like topic my master Is Here .. then it see the channel as moderated cos of that m.. :tongue:
Code:
menu channel {
  ..$style(1) &amp;Currently » $chan $chan(#).mode :/
  ..-
  ..$iif(s isin $chan(#).mode,$style(1)) &amp;Secret » +s «:_cmode s
}
«:_cmode
  if ($1 == s) { goto s }
}

this is how i call the mode, then it match the channel mode and set +s if its not set that already, if its +s then it removes it.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62845 05/12/03 07:24 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
/help $gettok


-KingTomato
Re: $chan(#).mode) #62846 05/12/03 07:47 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Still dont get it.. i cant remove key, and i must use $chan(#).mode) to get the mode from the channel.. i could use %var .. everything working ok, just that it see the key as modes, so if a S is in the key, then it see the channel as +s .. and if a M is in the key it see the channel as +m .. same with all other modes.. and in the example i got here it works to remove +k .. but nothing else, and i want to make somthing by my self, so the only thing i need help with, thats how to stop $chan(#).mode) from snatch the key as a mode, and mirc shouldent cont the key as mode, only the +k (not the letters behind it).. confused

PS: Never used $gettok in anything befor.. so i guess it would take me som time to figure out how to use it right.. the problem i have is to make mirc know that it's the key it should remove.. not the mode +k .. and also make it see if the channel is +m .. now i only get allot of errors so i guess i doing it wrong

Last edited by sparta; 05/12/03 07:58 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62847 05/12/03 09:47 PM
Joined: Nov 2003
Posts: 227
H
Hitchhiker Offline
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
You need the key to unset the key, can use $chan(#).key
mIRCs mode parsing is great, thats why I cant see any need for any other custom parser, if you want to know the channel limit in a script you just use $chan(#).limit simple.
so if you want to remove the key: mode # -k $chan(#).key
But is this the type of thing you want?
Code:
 
menu channel {
  Modes
  .$iif(n isincs $gettok($chan(#).mode,1,32),$style(1)) No Ext Message:/mode # $iif(n isincs $gettok($chan(#).mode,1,32),-n,+n)
  .$iif(t isincs $gettok($chan(#).mode,1,32),$style(1)) Only ops set topic:/mode # $iif(t isincs $gettok($chan(#).mode,1,32),-t,+t)
  .$iif(s isincs $gettok($chan(#).mode,1,32),$style(1)) Secret:/mode # $iif(s isincs $gettok($chan(#).mode,1,32),-s,+s)
  .$iif(p isincs $gettok($chan(#).mode,1,32),$style(1)) Private:/mode # $iif(p isincs $gettok($chan(#).mode,1,32),-p,+p)
  .$iif(m isincs $gettok($chan(#).mode,1,32),$style(1)) Moderate:/mode # $iif(m isincs $gettok($chan(#).mode,1,32),-m,+m)
  .$iif(k isincs $gettok($chan(#).mode,1,32),$style(1)) Key $chan(#).key :/mode # $iif(k isincs $gettok($chan(#).mode,1,32),-k $chan(#).key,+k $$?="Input Key")
  .$iif(m isincs $gettok($chan(#).mode,1,32),$style(1)) Moderate:/mode # $iif(m isincs $gettok($chan(#).mode,1,32),-m,+m)
  .$iif(l isincs $gettok($chan(#).mode,1,32),$style(1)) Limit $chan(#).limit :/mode # $iif(l isincs $gettok($chan(#).mode,1,32),-l,+l $$?="Input Limit")
}

 


but i think i will stick with /channel

Re: $chan(#).mode) #62848 05/12/03 09:55 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I solved it.. thnx smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62849 06/12/03 01:57 AM
Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline
Vogon poet
Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
Nice little script you got for channel modes, do you happen to know how to do the one for ban, the one you did the popups seemed more better that what i had it at

Channel Modes
.Ban/Unban (b)
..On: { mode # +b $$?="Enter Mask To Ban (ie *!*@host.domain)" }
..Off: { mode # -b }

Re: $chan(#).mode) #62850 06/12/03 02:17 AM
Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline
Vogon poet
Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
How do you do the same principle for this

Control Menu
.Auto Op ( %auto.op )
..On: { .aop on | set %auto.op On | echo -a 14Auto Op is now9 On }
..Off: { .aop off | set %auto.op Off | echo -a 14Auto Op is now9 Off }
.Auto Voice ( %auto.voice )
..On: { .avoice on | set %auto.voice On | echo -a 14Auto Voice is now9 On }
..Off: { .avoice off | set %auto.voice Off | echo -a 14Auto Voice is now9 Off }
.Ignore ( %ignore )
..On: { .ignore on | set %ignore On | echo -a 14Ignore is now9 On }
..Off: { .ignore off | set %ignore Off | echo -a 14Ignore is now9 Off }
.Notify ( %notify )
..On: { .notify on | set %notify On | echo -a 14Notify is now9 On }
..Off: { .notify off | set %notify Off | echo -a 14Notify is now9 Off }
.Protect ( %protect )
..On: { .protect on | set %protect On | echo -a 14Protect is now9 On }
..Off: { .protect off | set %protect Off | echo -a 14Protect is now9 Off }

I'm struggling too make it, i figured i would need $aop for the autovoice but not sure how to finish the line like the channel modes is done.

If you or anyone could help me please.

Re: $chan(#).mode) #62851 06/12/03 02:29 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
.$iif(%auto.op == on,$style(1)) :{ do stuff }

change the 1 to diffrent numbers and take the one you want.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62852 06/12/03 02:54 AM
Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline
Vogon poet
Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
Is there another way to do that which is similar to modes so i don't have to require the actual sub menu meaning changing this

Control Menu
.Auto Op ( %auto.op )
..On: { .aop on | set %auto.op On | echo -a 14Auto Op is now9 On }
..Off: { .aop off | set %auto.op Off | echo -a 14Auto Op is now9 Off }

to this

Control Menu
.$iif(%auto.op == on,$style(1)) :{ do stuff }
.$iif(%auto.voice == on,$style(1)) :{ do stuff }

I managed to look up $aop in the /help file so i'm assuming i can copy near the same prefix as the one in modes??

I quite liked how the tick boxes stayed on whatever it was selected in mirc or even the channel i was in.

Re: $chan(#).mode) #62853 06/12/03 03:13 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Im not sghure i know what you mean now? the
Code:
..$iif(%auto.op == on,$style(1)) On: { .aop on | set %auto.op On | echo -a 14Auto Op is now9 On }
..$iif(%auto.op == off,$style(1)) Off: { .aop off | set %auto.op Off | echo -a 14Auto Op is now9 Off }

would be looking as the image abow.. the only diffrence is that i have it on modes, you will have it on events in your script..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: $chan(#).mode) #62854 06/12/03 03:27 AM
Joined: Dec 2002
Posts: 174
K
Kev_Uk Offline
Vogon poet
Offline
Vogon poet
K
Joined: Dec 2002
Posts: 174
Basically i wanted to break things down instead of having the % in the variables as the control menu seems to have it's own built in one called $true and $false.

So i would use the $aop for auto op and $avoice for autovoice.

So i wouldn't have to have a repeat of something that would look like this if i went through the popup

Auto Op ( On )
[ / ] On
Off

I hope you get what i mean now, was trying to get something like this

Control Menu
Auto Op [ / ]
Auto Voice [ x ]
Ignore [ / ]

So everything is broken down in 1 line, of course the / is a tick symbol, as i can't make one on here.

Re: $chan(#).mode) #62855 06/12/03 04:53 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Quote:
Nice little script you got for channel modes, do you happen to know how to do the one for ban, the one you did the popups seemed more better that what i had it at


Code:
menu channel {
  Channel Modes
  .Bans:
  ..Add Ban: /mode $active +b $$?="Enter Mask"
  ..$submenu($bans($1))
}
alias bans {
  if ($1 isin beginend) return -
  if ($ibl($chan, 0) == 0) {
    if (%menu.ban) { /unset %menu.ban | return $null }
    else { /inc %menu.ban | return No Bans Set:/halt }
  }
  if ($ibl($chan, $1)) return Remove $ifmatch :/mode $active -b $ifmatch
}


Like that?


-KingTomato
Page 1 of 2 1 2