Posting 2 timezones command

I’ve been looking at this command and am wondering why it isn’t working.
If anyone would kindly look at it, it would be highly appreciated.

This is a command for posting time depending on which name is input.

    var r = false;

    if( '$(touser)'.replace(/@/g,"")) == 'name1')
        r = '$(time America/Los_Angeles)';
    else if('$(touser)'.replace(/@/g,"")) == 'Name2'||'name2')
        r = '$(time Asia/Singapore)';

	if (r)
        'The time for ' + '$(touser)'.replace(/@/g,"")) +' is : '+ r + '.';

    else 'Too bad Mod is too lazy to code the timezone for you lmao';

The problem I’m having is that even if the touser variable is not equal to name1 or name2 it would still post a timezone instead of writing the else statement.

Thank you for your help.

I expect this is because your $(touser) is nested too deep and is not expanded. But I don’t see why you need the $(eval) inside an $(eval) – you can do that without.

oh didnt noticed I put too many $(eval). thanks for that. working with no sleep.
Also what do you mean its not expanded?

Sorry I havent coded anything for a decade now.

You can’t nest variables too deep; if you do the ones that are, are simply ignored.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.