mIRC Home    About    Download    Register    News    Help

Print Thread
#78077 05/04/04 08:04 PM
Joined: Dec 2002
Posts: 1,536
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,536
Ok, I dont know if this is a bug or is working as designed. i use the 2nd editbox in mirc for ops talking (among other things) and if I enter in (for example) $me, my script does NOT evaluate $me to be my nickname. Let me show you some more info and you guys can help me understand this (sections snipped from different files):

Code:
on *:input:#: {
  if ($cmdbox) {
    if ($me isop $chan) {
      if (($chan == #channel1) || ($chan == #channel2)) { //ops $1- | halt }
    }
  }
}


/ops {
  if ((# == #chan1) || (# == #chan2) || (# == #chan3)) { //.notice @ $+ # 11,1 ¯ @ $+ # ¯  $1-  | //echo 1 -ta 11,1 ¯ @ $+ # ¯  $1- | //halt }
  //.notice @ $+ # 11,1 ¯ [@ $+ # MSG] ¯  $1-  | //echo 1 -ta 8[@ MSG]1 $1- | //halt
}


So shouldnt the double / make mirc evaluate $identifyers such as $me? It doesnt and shows them as is ($me vs my nickname)


Those who fail history are doomed to repeat it
M
MIMP
MIMP
M
I'm pretty sure I know what you're after but it doesn't quite work that way.

Basically you want to be able to type in:

"stuff $me other stuff" and hit enter. Then to have the script resolve the identifier. The problem is things are evaluated on the command line differently than they are in scripts. To evaluate something on the command line it must start with two of the command prefixes (/ by default) otherwise mIRC handles it like plain text.

You could use the on input event to look for known (or specific) identifiers and manually $eval() them get the desired display. Passing the data inside the on input event using 0, 1 or 2 /'s makes no difference.

Joined: Dec 2002
Posts: 1,536
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,536
Gotcha, no worries. Just wondered why it didnt work smile Thanks for the info


Those who fail history are doomed to repeat it
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I'm not one to really deal with the INPUT remote much, but try this:
---
on *:input:#:if ($cmdbox && $me isop # && $istok($ops,#,32)) { .ops $1- | halt }
alias ops {
  if ($isid) { return #channel1 #channel2 ... channel8675309 }
  if ($istok(#chan1 #chan2 #chan3,#,32)) {
    tokenize 32 11,1 ¯ $+(@,#) ¯  $1- 
    .notice $+(@,#) $1- | echo $color(notice).dd -t # $1-
  }
  else {
    .notice $+(@,#) 11,1 ¯ $+([@,#) MSG] ¯  $1-
    echo $color(notice).dd -t # 8[@ MSG]1 $1-
  }
}
---
Just copy/paste what you see into the remotes, and see if that doesn't work. On the line that has "if ($isid)", put a complete list of rooms there for the "INPUT" to be valid in. Seperate with spaces. It'll make it easier to add/remove rooms to be valid in.

I
Iori
Iori
I
Or this...
on @*:input:#channel1,#channel2:if ($cmdbox) { ops $($1-,2) | halt }

Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I like to use identifiers for room control because it makes it easier to control multiple events with one stroke, thus not using the room names in the event itself.

and $($1-,2) just sends whatever was typed in with the # 2 added to the end. I tested it to be sure (in case I wasn't reading it right).

smile

I
Iori
Iori
I
Um try it again, maybe you tried $+($1-,2) in which case 2 would be appended to whatever was typed. wink
$() is simply a short version of $eval()

Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Actually that's what I did (habit, I make use of it often for my scripts).. Now, upon a correct test I have this question... What are you trying to accomplish with doing $($1-,2) anyway?

As near as I can see, unless there is something happening that I just cannot detect, it's just as useful to do $1-

I
Iori
Iori
I
It fixes the problem landon described.
From landons first post: and if I enter in (for example) $me, my script does NOT evaluate $me to be my nickname.
Using $($1-,2) "$me" will be evaulated.

Joined: Dec 2002
Posts: 1,536
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,536
and thanks to the !, I can tell it to not eval $me (by the use of $!me) and can display $identifyers without evaluating them - awesome, thanks for the heads up about the $($1-,2). Dont think I ever woulda come up with that one.


handfull of cookies out of the cookie jar as payment smile


Those who fail history are doomed to repeat it
I
Iori
Iori
I
Welcome smile

Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Ah, I overlooked the part of re-evaluating the text before sending it. oops. But as far as simplicity and slightly better scripting, I stand by the what I wrote.

Joined: Dec 2002
Posts: 1,536
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,536
There's nothing wrong with your method at all (tho I admit I didnt try it). All I wound up doing was changing $1- to $($1-,2) and left everything else as it was.

EDITED

Also, that was taken from a larger script (none of which mattered for my issue). If that was the ONLY part of the script, then I wouldnt have put it here like that smile


Those who fail history are doomed to repeat it

Link Copied to Clipboard