cm.getText help

Results 1 to 3 of 3
  1. #1
    Novice afreckle is offline
    MemberRank
    Jul 2011 Join Date
    1Posts

    cm.getText help

    so i wanted to make an npc that checked for a password and this is what i did. in-game, the npc shows the status 0 window, but when you click the Ok button it comes up with the npc not working properly error (no matter whether you entered a word or not). i tried looking online, but couldn't find anything that could help in this situation. i want the password to be "luminous" (doesn't matter with capitals). so my question is: what is wrong with my password check?

    Code:
    status = -1;
    
    function start() {
        status = -1;
        action(1, 0, 0);
    }
    
    function action(mode, type, selection) {
        if (mode == -1)
            cm.dispose();
        else {
            if (mode == 0 && status == 0)
                cm.dispose();
            if (mode == 1)
                status++;
            else
                status--;
            if (status == 0) {
    			cm.sendGetText("Hello there #b#h ##k! May I be the first to congratulate you on getting this far. But I guess that for someone with your reputation, it would've been a piece of cake. Well, I shall not hinder you any further so we shall just move on. Of course you know the rules by now, so please just enter the password to move onto the next stage!.\n");
    		} else if (status == 1) {
    		var pw = cm.getText();
    			if (pw = luminous) {
    				cm.sendOk("Excellent! The password you entered was correct yet again! Good luck with the rest of the competition!");
    				cm.dispose();
    			} else {
    				cm.sendSimple("Sorry, the password was not the correct one. What happened? You've gotten all the passwords correct so far...\r\n\r\n#L0#I don't even know what's going on or where/who I am!#l");
    			}
    		} else if (status == 2) {
    			cm.sendSimple("Oh dear... I guess that last challenge's twist must have tinkered with your memory a bit. And now I can see that even your equipment may have been set back as well.\r\n\r\n#L1#Well, what can I do to get these memories back?#l");
    		} else if (status == 3) {
    			cm.sendNext("Hmmm... I do not have enough power to restore memories, but I think I may know someone who can. I will warp you to Henesys now so that you can find #rSmall Street Lamp#k. He used to be an adventurer like you, but he took a curse to his body when he stole a very powerful item from Grendel. I can also provide you with a few necessary beginning items that you can use until you find your old gear again. Good luck with your new adventure, and I hope to see you back in the championship one day, #h #!");
    		} else if (status == 4) {
    			cm.warp(100000000);
    			cm.dispose();
    		}
    	}
    }


  2. #2
    Member cntkillme is offline
    MemberRank
    Feb 2009 Join Date
    51Posts

    Re: cm.getText help

    if (pw = luminous) {

    Is wrong

    It should be if(pw == luminous) {
    1 '=' Means Set
    2 '=' Means Compare

  3. #3
    Account Upgraded | Title Enabled! Dichotome is offline
    MemberRank
    Apr 2008 Join Date
    385Posts

    Re: cm.getText help

    Where is luminous defined? or did you mean to compare the pw to the word luminous, in which case luminous should be in quotes ie
    if (pw == 'luminous')



Advertisement