|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
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??
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
No need for $+ on both sides of the variable.
$strip(%stripnr)
will do.
|
|
|
|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
Cant get it to work that way either It does react but it dosent set %savethis when i use $strip(%strip.1)
if ($strip($1) == %triggertwo.1) { set %savethis $strip($3) | goto setthings.1 }
if ($strip(%trgnutwo.1) == %triggertwo.1) { set %savethis $strip(%strip.1) | goto setthings.1 }
Last edited by Bast; 13/11/11 10:13 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Are you sure the variables match? What is each variable when you echo them?
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,641 |
If it's not setting, either $3 is null or the if is $false and not triggering.
|
|
|
|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
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
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,641 |
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.
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
Use: tokenize 32 $strip($1-)
if ($1 == %triggertwo.1) {
set %savethis $3
goto setthings.1
} but where is the $2 ?
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
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.
|
|
|
|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
Well i have tried it all, cant figure it out.
if ($strip(%strip1) == %triggerone) {
if ($strip(%strip2) == %triggertwo) { set %savethis $strip(%strip3) | goto setthings } This works just fine
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)
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
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?
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
Why don't try it like so and see what happens: if ($strip(%strip1) == $strip(%triggerone)) {
if ($strip(%strip2) == $strip(%triggertwo)) {
set %savethis $strip(%strip3)
goto setthings
} CODE EDITED -
Last edited by Tomao; 14/11/11 04:57 AM.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
You still have an open IF. There needs to be another }.
|
|
|
|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
the IF is closet further down, i have a couple of more %var to set if the if match. if i echo //echo ($strip(%trgnuone.1) == %triggerone.1) i get if i echo //echo ($strip( $+ %trgnuone.1 $+ ) == %triggerone.1 $+ ) i get wich is the variable i want to check against. If you guys say it should work i must work, i dont have qlue thou
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
If you're echoing, then remove the extra ()'s around it... //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"). 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().
|
|
|
|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
that was what i needed thx Riamus2
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
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.
|
|
|
|
Joined: Nov 2011
Posts: 36
Ameglian cow
|
OP
Ameglian cow
Joined: Nov 2011
Posts: 36 |
well i have to thank you for being patient 
|
|
|
|
|