mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 84
T
Babel fish
OP Offline
Babel fish
T
Joined: Sep 2003
Posts: 84
Hello there,

I was working on a script that needs to respons on this:
!Litle test for this is++ #nope it doesn't works...

But when I use this:
Quote:

$right($gettok($1-,1,35),3)

I get this back: ++

But when I try to recognize it using the if:
Quote:

if (($left($1,1) == !) && ($right($gettok($1-,1,35),3) == ++)) {
echo Yes it works
}


Then it doesn't response!

I know there is something after the ++ because I need to do 3 letters from the right to get ++
but even if I put $chr(32) in the if after ++ it doesn't work..

So can someone explain me what I do frong?

I used Version 6.2 and 6.21 to test.

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
If you want to insert $chr(32) you'll need to use $+ to make it:
Code:
if (($left($1,1) == !) && ($right($gettok($1-,1,35),3) == ++ $+ $chr(32))) {

Otherwise it will think you want two spaces.

As for your problem... Your first example returns ++ because the space behind it gets removed when echoing it back to you. But in the second example it's matched inside the script and then the space remains. It's one of those caveats you have to remember.

Joined: Sep 2003
Posts: 84
T
Babel fish
OP Offline
Babel fish
T
Joined: Sep 2003
Posts: 84
I tryed to put the $+ $chr(32) but didn't work for me.
But I already made it work, just used the $left(..,2) and that's fine smile


Link Copied to Clipboard