mIRC Home    About    Download    Register    News    Help

Print Thread
Problem using $right/$gettok #179802 28/06/07 09:51 AM
Joined: Sep 2003
Posts: 84
T
Turbo_boy Offline OP
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.

Re: Problem using $right/$gettok [Re: Turbo_boy] #179803 28/06/07 09:58 AM
Joined: Jun 2007
Posts: 933
5
5618 Offline
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.

Re: Problem using $right/$gettok [Re: 5618] #179847 28/06/07 07:10 PM
Joined: Sep 2003
Posts: 84
T
Turbo_boy Offline OP
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