What I do wrong here? - I'm unable to get anything to work - I'm not expert on this scripting but doing the best I could wink

Trying to check if I'm in channel on or not (base on several networks) and if I'm not in channel (due to netsplit or such) - it'll auto join/run commands.

I've tried 2 different ways but no luck.

Code:
/scid $scon(%network1) {
    if ($chan(#chan1).status == joined) { echo @Chan.Status You are in #chan1 }
    else { echo @Chan.Status You are NOT in #chan1 | /join #chan1 }
}

or even this one doesn't work for me

Code:
/scid $scon(%network1) {
    if ($me(#chan1,$me,a)) { echo @Chan.Status You are in #chan1 }
    else { echo @Chan.Status You are NOT in #chan1 | /join #chan1 }
}


Once I got the working code, I plan to run this script on timer every 15-30 mins or so to ensure that i'm in channel all the times.

Thanks