mIRC Homepage
Posted By: Turbo_boy Problem using $right/$gettok - 28/06/07 09:51 AM
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.
Posted By: 5618 Re: Problem using $right/$gettok - 28/06/07 09:58 AM
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.
Posted By: Turbo_boy Re: Problem using $right/$gettok - 28/06/07 07:10 PM
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
© mIRC Discussion Forums