mIRC Home    About    Download    Register    News    Help

Print Thread
Text into variable calculated #84447 28/05/04 11:06 PM
Joined: May 2004
Posts: 3
C
Cresso Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: May 2004
Posts: 3
Code example:
Code:
alias typed {
  var %text = $1-
  echo -a You typed: %text
}


When you type:
Code:
/typed just a test

It returns:
Code:
You typed: just a test



But when you type:
Code:
/typed 150 / 2

It returns:
Code:
You typed: 75


It goes like this with - / + and any number.

Only tested with version 6.14

Re: Text into variable calculated #84448 28/05/04 11:11 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
This was intended, it's not a bug.
Simple workaround:

//var %test = "8 / 2 | echo -a $right(%test,-1)


New username: hixxy
Re: Text into variable calculated #84449 28/05/04 11:14 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

that is not a bug, mIRC simply evaluated the incoming string, in this case it evaluated 150 / 2 which is 75

If you want for mIRC to only show exactly what is passed to the alias, then you could do:
Code:
 
alias typed {
  set -ln %test $1-
  echo -a You typed: %test
}

the -n switch will treat all input as plain text, and not evaluate it.

the -l switch makes the variable local, so don't worry that it's going to be in your variables section, it is deleted when your script finishes.

Greets

Last edited by FiberOPtics; 28/05/04 11:20 PM.

Gone.
Re: Text into variable calculated #84450 28/05/04 11:28 PM
Joined: May 2004
Posts: 3
C
Cresso Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: May 2004
Posts: 3
Ah, I thought it was a bug since the help file says nothing about the evaluating content of the variable as a whole.

Thanks for the replies guys smile