mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
Would be nice if you could have commas and stuff in input boxes maybe by enclosing the text in quotes:
$input("hi, how are you",test,test)


If only women came with popup menus and online help.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Quoted strings are very unlikely to be implemented. Just use $chr(44) or a variable.

var %text = hi, how are you
$input(%text,blah,bleh)

Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
Variables don't work mirc still parses the comma.
Same for $chr(44).


If only women came with popup menus and online help.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
No it doesn't. You must be doing something wrong. Try this:

Code:
//var %a = a, b, c, d | noop $input(%a,b,c)

Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
Thats really strange because when I pass $2- or a %var with the same value though and input it processes the commas so I have to call a separate alias kinda messy.


If only women came with popup menus and online help.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
in stead of telling us, show us the code, you must be doing something extra

Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
Code:
raw *:*:{
  ;echo -s raw $numeric - $2-
  var %x = $numeric , %i = .timer -m 1 1 _input
  goto %x
  :301
  if (!$hget(whois,$2)) return
  hadd whois $2 $hget(whois,$2) $crlf $crlf $+ $2 is away: $3-
  goto done
  :305
  %i away $2- $crlf $+ $duration($awaytime)
  goto done
  :306
  %i away $2- $crlf $+ $awaymsg
  goto done
  :311
  hadd -m whois $2 Nickname: $2 $crlf $crlf $+ Realname: $6- $crlf $crlf $+ Address: $+($3,@,$4)
  goto done
  :312
  if ($hget(whois,$2)) {
    hadd whois $2 $v1 $crlf $crlf $+ Server: $3-
    haltdef
  }
  return
  :315
  var %x = 1
  while $gettok($2,%x,44) {
    var %# = $v1
    if ($hget(ial,$v1)) {
      echo -t %# Address list cached in $round($calc(($ticks - $v1) / 1000),2) $+ s
      haltdef
      hdel ial %#
    }
    inc %x 1
  }
  return
  :317
  hadd whois $2 $hget(whois,$2) $crlf $crlf $+ Idle: $duration($3) $crlf $crlf $+ Signed on: $asctime($4)
  goto done
  :318
  %i whois $strip($hget(whois,$2))
  hdel whois $2
  goto done
  :319
  hadd whois $2 $hget(whois,$2) $crlf $crlf $+ Channels: $3-
  goto done 
  :330
  hadd whois $2 $hget(whois,$2) $crlf $crlf $+ $iif($5 == logged,$2 $4- $3,$2-)
  goto done
  :352
  if (* isin $7) .guser oper $6 1
  if ($hget(ial,$2)) haltdef
  return
  :366
  if (($2 !ischan) || (!$hget(sync,$2))) return
  echo -c other $2 [[ @Ops: $nick($2,0,o) ( $+ $round($calc(($nick($2,0,o) / $nick($2,0)) * 100),2) $+ % $+ ) ]] $&
    [[ % $+ Halfops: $nick($2,0,h) ( $+ $round($calc(($nick($2,0,h) / $nick($2,0)) * 100),2) $+ % $+ ) ]] $&
    [[ +Voices: $nick($2,0,v) ( $+ $round($calc(($nick($2,0,v) / $nick($2,0)) * 100),2) $+ % $+ ) ]] $&
    [[ Regulars: $nick($2,0,r) ( $+ $round($calc(($nick($2,0,r) / $nick($2,0)) * 100),2) $+ % $+ ) ]] $&
    [[ Total: $nick($2,0,a) ]]
  echo -t $2 Synced in $round($calc(($ticks - $hget(sync,$2)) / 1000),2) $+ s
  hdel sync $2
  if ((!$chan($2).ial) && ($ial)) .timer.ialupdate 1 1 ialupdate $addtok($deltok($timer(.ialupdate).com,1,32),$2,44)
  goto done 
  :372
  echo $2-
  goto done
  :438
  if ($2 == $me) goto done
  .timer.nick 1 $9 nick $2
  %i error $2-6 Nick will change in $9-
  goto done
  :471
  %i join $2-5 (channel is full)
  goto done
  :473
  %i join $2-5 (invite only)
  goto done
  :474
  %i join $2-5 (address is banned)
  goto done
  :475
  .timer -m 1 1 join $2 $!$input(Enter $2 password/key,phk60,Channel key)
  goto done
  :482
  %i error $3-
  goto done
  :401
  :402
  :403
  :404
  :421
  :431
  :432
  :433
  :442
  :443
  :461
  :472
  :481
  :501
  :502
  %i error $2-
  :done
  haltdef
  return
  :%x
  if ($hget(whois,$2)) {
    hadd whois $2 $v1 $crlf $crlf $+ $2-
    haltdef
  }
}
alias _input {
  if ($1 == away) noop $input($2-,iok60,Away))
  if ($1 == whois) noop $input($2-,iok300,Whois)
  if ($1 == join) noop $input($2-,hok60,Cannot join)
  if ($1 == error) noop $input($2-,hok60,Error)
}

That currently works, but if I just have $input($2-,blah,blah) in the raw event the $input wont accept commas and brackets.


If only women came with popup menus and online help.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Well for a start you again failed to show us the code that doesnt work, making it all that much more dificult to diagnose what yyou have done wrong.

However i worked out from your statment what it is.

please see
/help $input

specificly
Note: This identifier cannot be used in a script event. One way around this is to use a /timer to initiate an input request after the script ends.

Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
Well that would mean I would have to change alot of code to make the thing "not" work that would be a bit stupid.
I am using a timer check the %i variable.


If only women came with popup menus and online help.
Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
Put this in your remotes:
Code:
raw 403:*:.timer -m 1 1 noop $!input( $2- ,o,cannot join)

Now type /join blah


If only women came with popup menus and online help.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Uhh there's no problem with the last code you posted, it works just fine as it should. It would only start becoming a problem if $2- contains commas, but for the raw 403 that will never happen. $2- will evaluate to "blah No such channel" and that is what will be shown in the input box, what's wrong about it?

Anyway, in response to your original post:

mIRC does allow for a string containing commas to be passed as a parameter to an identifier, as long as it is within a variable or within an identifier. You cannot put a string containing commas directly in an identifier because mIRC wouldn't be able to tell where the string ends and the second parameter starts. Since it will assume that the first comma it encounters is the end of the string, it will usually result into a "too many parameters" error report.

Now what exactly is the trick about passing strings with comma's in a var or token about? I guess it's best explained with an example:

1) //tokenize 32 a,b,c | .timer 1 0 echo -a $gettok( $1 ,1,44) | timers

The /timers command shows this:

* Timer 1 1 time(s) 1ms delay echo -a a

A timer evalutes the parameters passed to it 2 times. First time when passing parameters to it (this is standard procedure in mIRC when using double slashes from the command line, or in a script). The second time is when the timer is triggered. So let's apply this to our example.

1st evaluation: the timer command changes to .timer 1 0 echo -a a
2nd evaluation: timer is triggered and it simply echoes an a

Why didn't mIRC have any trouble with the fact that $1 is a,b,c? Well, mIRC sees three parameters: $1, 1 and 44. Even though $1 contains commas when evaluated, it doesn't matter mIRC already knows those are part of the first parameter.

2) //tokenize 32 a,b,c | .timer 1 0 echo -a $!gettok( $1 ,1,44) | timers

The /timers command shows this:

* Timer 1 1 time(s) 1ms delay echo -a $gettok( a,b,c ,1,44)

The result here is that you get the error message: * Too many parameters: $gettok

You immediately see why the error occurs from the message from the /timers command. Here mIRC will also evaluate the $gettok, but now it doesn't see 3 parameters, but 5, so it results into an error message.

I hope you see the subtle difference: because of the /timer command being used (same applies to scon/scid) you have to take into account double evaluation. My second code clearly shows that it ends up being the same thing as directly passing a string with commas to the $gettok identifier rather than passing it in a variable or token.


Gone.
Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
$2- wont equal anything because it is a timered command so a variable or hash table needs to set. Thanx for your help guys.
im now setting the hash table like this:
Code:
  hadd -mu1 raw %x $2-

and retrieving it like this:
Code:
%i $!input($hget(raw, %x ),hok,Error)

and using gettok if I want to modify the vaule.
Shame I cant tokenize the command in the timer.

Last edited by jizzy; 04/06/06 05:42 AM.

If only women came with popup menus and online help.
Joined: May 2006
Posts: 122
J
jizzy Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2006
Posts: 122
oh I can tokenize it:
Code:
%i = .timer -m 1 1 tokenize 32 $!hget(raw, %x ) $(|) noop

now I call the input with $!1-
Thanx for your help again.


If only women came with popup menus and online help.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
$2- wont equal anything because it is a timered command so a variable or hash table needs to set. Thanx for your help guys.
im now setting the hash table like this:

Have you even read my post clearly? $2- does equal to something in a timered command, just look at what the output of the /timers command was in my post. Your statement would be true if $2- was pasted together to the $!input() instead of letting it have some spaces around it. $!input($2-) will indeed not let the $2- evaluate at the first run, $!input( $2- ) would.

All that hacky code isn't necessary at all. You pass a simple alias name to the timer together with whatever string to it, be it $2- or a var, and in that alias your tokens will be $1- and then you use that in $input or whatever you want.

.timer 1 0 myalias $2-
alias myalias !.echo -q $input($1-,o,blah)

Note that passing tokens to a timer can be harmful in certain situations, but that won't be the case for your purposes.


Gone.

Link Copied to Clipboard