mIRC Home    About    Download    Register    News    Help

Print Thread
#189798 12/11/07 12:47 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
So, I have a menu nicklist{ } in a script. However, is there a way to make that extra option on the nicklist appear for only one window?

Also, I'm having trouble with /write. I want to write a file to the mirc directoy, IE: C:\Program Files\mIRC\, but the /write command doesn't work when there's a space in the specified location. How can I get around this?

Last edited by Mpot; 12/11/07 02:02 AM.
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: Mpot
So, I have a menu nicklist{ } in a script. However, is there a way to make that extra option on the nicklist appear for only one window?
Code:
menu nicklist {
  $iif(# == #channelname,Option):command
}



Originally Posted By: Mpot
Also, let's say I want to write to a file in the mIRC directory, will this work:

/write $mircdir $+ /filename.mrc texttowrite

Also, /write doesn't work with spaces in it, and since mIRC is installed in Program Files, that would put a space in the file path. IE: C:\Program Files\mIRC\ . Would using $mircdir get past the space snag?

write filename.mrc or write $qt($mircdir $+ filename.mrc)

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Alright. I'm lost. Could you edit this to work on one channel only:

Code:
menu nicklist { 
  A-Voice Shitlist Nick:/write shitlist.mrc $$1 yes
}


Also, can you explain $iif? Is it like if in an if-then-else statement?

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Code:
menu nicklist {
  $iif(# == #specificchannel, A-Voice Shitlist Nick): write shitlist.mrc $$1 yes
}


Yes, $iif() is an Inline-If-Else.

$iif([color:orange]condition, true, false)[/color].

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: Mpot
Alright. I'm lost. Could you edit this to work on one channel only:

Code:
menu nicklist { 
  A-Voice Shitlist Nick:/write shitlist.mrc $$1 yes
}
Code:
menu nicklist {
  $iif(# == #channelname,A-Voice Shitlist Nick):write shitlist.mrc $$1 yes
}
Change "#channelname"


Originally Posted By: Mpot
Also, can you explain $iif? Is it like if in an if-then-else statement?
Click

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I don't understand the comma separation in the $iff and what you cna put there.

Code:
menu nicklist {
  $iif(# == #channel,A-Voice Shitlist Nick):/write shitlist.mrc $$1 yes
}

on *:JOIN:#channel:{
  if ($me !isop $chan) { echo -a You're not opped on #channel, might wanna get that fixed. | return }
  elseif ($read(shitlist.mrc, s, $nick) == yes) { return }
  else { mode $chan +v $nick }
}


How is that? It supposed to be, if the nick is in the shitlist.mrc with yes after it, then the script halts.

Last edited by Mpot; 12/11/07 02:35 AM.
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
if ($true) { execute true command }
else { execute false command }

$iif($true,execute true command,execute false command)

Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: Mpot
How is that? It supposed to be, if the nick is in the shitlist.mrc with yes after it, then the script halts.

Well, does it? If it does what you want then it's OK...

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Post deleted by Mpot

Last edited by Mpot; 12/11/07 02:46 AM.
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I have decided to include a "unshitlist option". This will require changing the menu format to

A-Voice Control
.Shitlist
.Un-Shitlist

I also want the script to check if the nickname is already shitlisted. If the nickname is not already shitlisted, it will echo that it's not shitlisted. If it IS shitlisted, it would unshitlist and echo. This is what I have come up with, but something is messed up with the menu. How can I fix it?

Code:
menu nicklist {
  $iif(# == #mpot,A-Voice Control)
  $iif(# == #mpot,.Shitlist Nick):/write shitlist.mrc $$1 yes
  $iif(# == #mpot,.Unshitlist Nick):{ 
    elseif ($read(shitlist.mrc, s, $$1) == yes) { /write -ds $+ $$1 shitlist.mrc | /echo -a Unshitlisted Nickname. }
    elseif ($read(shitlist.mrc, s, $$1) != yes) { /echo -a Nickname is not shitlisted. }
  }
}

Last edited by Mpot; 12/11/07 03:28 AM.
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Code:
menu nicklist {
  $iif(# == #mpot,A-Voice Control)
  .Shitlist Nick:write shitlist.mrc $$1 yes
  .Unshitlist Nick:{
    if ($read(shitlist.mrc, s, $$1) == yes) { write -dl $+ $readn shitlist.mrc | echo -a Unshitlisted Nickname. }
    else echo -a Nickname is not shitlisted.
  }
} 

Or you could use menu styles
Code:
menu nicklist {
  $iif(# == #mpot,A-Voice Control)
  .$iif($read(shitlist.mrc, s, $$1) == yes,$style(2)) Shitlist $$1:write shitlist.mrc $$1 yes
  .$iif($read(shitlist.mrc, s, $$1) == yes,$style(1),$style(2)) Unshitlist $$1:write -ds $+ $1 shitlist.mrc
}

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I have decided to add shitlisting addresses to the menu as well. I created another menu to get the separation effect of a -. THat worked fine, and the menu is appearing properly. HOwever, something is wrong with the $address. It is not picking it up and just writing "yes" to the file, instead of the address and then yes. Here is what I have, how can I fix $address?

Code:
menu nicklist {
  $iif(# == #mpot,A-Voice Control)
  .Shitlist Nick:{
    if ($read(shitlist.mrc, s, $$1) != yes) { write shitlist.mrc $$1 yes | echo -a Shitlisted Nickname. }
    else echo -a Nickname is already shitlisted. 
  }
  .Un-Shitlist Nick:{
    if ($read(shitlist.mrc, s, $$1) == yes) { write -dl $+ $readn shitlist.mrc | echo -a Unshitlisted Nickname. }
    else echo -a Nickname is not shitlisted.
  } 
}
menu nicklist {
  $iif(# == #mpot,A-Voice Control)
  .Shitlist Address:{
    if ($read(shitlist.mrc, s, $address($$1,2)) != yes) { write shitlist.mrc $address($$1,2) yes | echo -a Shitlisted address. }
    else echo -a Address is already shitlisted.
  }
  .Un-Shitlist Address:{
    if ($read(shitlist.mrc, s, $address($$1,2)) == yes) { write -dl $+ $readn shitlist.mrc | echo -a Unshitlisted address. }
    else echo -a Address is not shitlisted.
  }
}

Last edited by Mpot; 12/11/07 11:40 PM.
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Anyone know how to get $address to work for me?

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Furthermore, why does this work with all if's and not with elseifs?

Code:
on mpot:text:!aop:#:{
  if ($2 == $null) { msg $chan Specify a nickname. }
  elseif ($2 != $null && $3 == $null) { msg $chan Specify information parameter. }
  elseif ($$2 !ison $chan) { msg $chan $$2 is not on $chan $+ ! }
  elseif (syscon isin $level($address($$2,2))) { msg $chan $address($$2,2) is already at access level syscon! }
  else { /guser syscon $$2 2 $$3 | msg $chan Addedd  $+ $nick $+  to access list at level syscon at address $+ $address($$2,2) $+  with notes  $+ $$3 $+  }
}

Joined: Dec 2002
Posts: 2,033
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,033

Try this.

Code:

on mpot:text:!aop *:#: {
  if ($2 == $null) msg $chan Specify a nickname.
  elseif ($3 == $null) msg $chan Specify information parameter.
  elseif ($2 !ison $chan) msg $chan $2 is not on $chan $+ !
  elseif (syscon isin $level($address($2,2))) msg $chan $address($2,2) is already at access level syscon!
  else {
    guser syscon $2 2 $3
    msg $chan Addedd  $+ $nick $+  to access list at level syscon at address $+ $address($2,2) $+  with notes  $+ $3 $+ 
  }
}


Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Oh, hell! No wonder the rest of it wasn't working, I didn't put a wildcard in the on text event. -_-

Also, see the post above last, about $address. Any ideas?

Joined: Dec 2002
Posts: 2,033
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,033

$address is only availabe if the users address is in the IAL.
Make sure the IAL is on by typing /ial on
You can fill the IAL with the addresses of all the users on a channel by doing a /who on the channel when you join...

Code:

on me:*:JOIN:#:who #



All users that join after you will automatically be added as long as the IAL is on.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
That script works by right-clicking on the nicklist, meaning that the nickname is sharing a channel with you, meaning they should already be in the IAL.

Edit: Got it working, somehow...

Last edited by Mpot; 15/11/07 09:11 PM.
Joined: Dec 2002
Posts: 2,033
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,033

Not necessarily, if they joined the channel before you, and if they haven't typed any channel messages, private messaged you or set any channel modes, then their address won't be in the IAL unless you /who them or the channel, or whois them.

~ Edit ~

From mirc.chm

"A user's address is added to the list either when they join the channel, send a message to a channel, or make a mode change."

If they haven't done any of the above, and you didn't use a server command to get their address, ie. /who /whois /userhost .. then their address may not be in the IAL.

/help /ial




Link Copied to Clipboard