mIRC Homepage
Posted By: Bast $strip into variable - 13/11/11 05:14 PM
I have made an dialog wich i have alots of vars

I want to get
if ($strip($2) == %triggertwo.1)

into somthing like this
if ($strip( $+ %stripnr $+ ) == %triggertwo.1)

anyone got an idea how to do this??
Posted By: Tomao Re: $strip into variable - 13/11/11 09:29 PM
No need for $+ on both sides of the variable.

$strip(%stripnr)

will do.
Posted By: Bast Re: $strip into variable - 13/11/11 10:11 PM
Cant get it to work that way either

It does react but it dosent set %savethis when i use $strip(%strip.1)

Code:
if ($strip($1) == %triggertwo.1) { set %savethis $strip($3) | goto setthings.1 }


Code:
if ($strip(%trgnutwo.1) == %triggertwo.1) { set %savethis $strip(%strip.1) | goto setthings.1 }


Posted By: Riamus2 Re: $strip into variable - 13/11/11 10:26 PM
Are you sure the variables match? What is each variable when you echo them?
Posted By: argv0 Re: $strip into variable - 13/11/11 11:04 PM
If it's not setting, either $3 is null or the if is $false and not triggering.
Posted By: Bast Re: $strip into variable - 14/11/11 12:58 AM
it does echo $3 so the vars is just fine.
But it dosent react to the strip part in the code at all.

Seems like it cant read ($strip(%vars) correct
Posted By: argv0 Re: $strip into variable - 14/11/11 01:15 AM
Before blaming mIRC for everything that goes wrong with your script, you should look at your code. "it" can read ($strip(%vars)) perfectly fine, the problem has nothing to do with syntax, but semantics. It's not "reacting" to the strip part because it's not reaching that block of code. DEBUG your code to ensure that the if statement is getting through. My bet is it's not. Check that the values you're testing in your if condition are actually what you expect them to be, that's likely the issue.
Posted By: Tomao Re: $strip into variable - 14/11/11 01:18 AM
Use:
Code:
tokenize 32 $strip($1-)
if ($1 == %triggertwo.1) {
set %savethis $3 
goto setthings.1 
}
but where is the $2 ?
Posted By: Riamus2 Re: $strip into variable - 14/11/11 01:58 AM
mIRC handles stripping variables just fine. You can verify it with this:

//var %t = 12testing | echo -a $strip(%t)

You will need to display your variables/$1- to see what's wrong. Echo all variables/$1- right before the IF statement. Then, since you're comparing two items in your IF, make sure they are exactly the same (with exception to control codes). You have something that you think is equal, but is not. You'll have to debug it to find out what. Without the exact values for your variables and $1-, we can't do anything other than tell you that you have to debug your code.
Posted By: Bast Re: $strip into variable - 14/11/11 03:09 AM
Well i have tried it all, cant figure it out.
Code:
if ($strip(%strip1) == %triggerone) {
if ($strip(%strip2) == %triggertwo) { set %savethis $strip(%strip3) | goto setthings }


This works just fine

Code:
if ($strip($1) == %triggerone) {
if ($strip($2) == %triggertwo) { set %savethis $strip($3) | goto setthings. }


And i have echoed out all %strip1-3 to see if they are set.
The scripts dosent trigger on the if statement if i use $strip(%strip1)
Posted By: Riamus2 Re: $strip into variable - 14/11/11 03:19 AM
What are the values of all variables and $1- that you are testing? Exact values before using $strip(). And why do you have an open IF on both of those?
Posted By: Tomao Re: $strip into variable - 14/11/11 04:20 AM
Why don't try it like so and see what happens:
Code:
if ($strip(%strip1) == $strip(%triggerone)) {
if ($strip(%strip2) == $strip(%triggertwo)) { 
set %savethis $strip(%strip3)
goto setthings
}


CODE EDITED -
Posted By: Riamus2 Re: $strip into variable - 14/11/11 11:12 AM
You still have an open IF. There needs to be another }.
Posted By: Bast Re: $strip into variable - 14/11/11 12:43 PM
the IF is closet further down, i have a couple of more %var to set if the if match.

if i echo

Code:
//echo ($strip(%trgnuone.1) == %triggerone.1)

i get
Code:
($strip(%trgnuone.1) ==


if i echo
Code:
//echo ($strip( $+ %trgnuone.1 $+ ) == %triggerone.1 $+ )

i get
Code:
($strip($1) == OK)


wich is the variable i want to check against.
If you guys say it should work i must work, i dont have qlue thou
Posted By: Riamus2 Re: $strip into variable - 14/11/11 05:44 PM
If you're echoing, then remove the extra ()'s around it...

Code:
//echo -a $strip(%var1) == %var2


That's why that's doing what you see. But that's not the problem you're asking about... From your example, you have $1 in your variable. And the TEXT "$1" is not equal to the TEXT "OK". If you want to use the value of $1, then you need to evaluate it (or just put the value into the variable instead of the TEXT "$1").

Code:
if ($strip($eval(%var1,2)) == %var2) { }


Anything in your variable will be treated as text and will not be evaluated unless you tell mIRC to evaluate it. $1 as text is simply $1. It's not the value within $1. To get that, you use $eval().
Posted By: Bast Re: $strip into variable - 14/11/11 06:41 PM
that was what i needed
thx Riamus2 smile
Posted By: Tomao Re: $strip into variable - 14/11/11 08:49 PM
So, as it turned out you wanted the value of the variable to be evaluated, but your explanation of the problem itself was ambiguous, let alone the $strip() matter.
Posted By: Bast Re: $strip into variable - 14/11/11 09:01 PM
well i have to thank you for being patient wink
© mIRC Discussion Forums