Can someone tell me what's wrong with this script?

Results 1 to 3 of 3
  1. #1
    Valued Member Synica is offline
    MemberRank
    May 2012 Join Date
    Planet EarthLocation
    118Posts

    Can someone tell me what's wrong with this script?

    PASTE BIN : /* @Author Kyodia * NPC for : DRAZELMS * Purpose : Event Trophy Trade-I - Pastebin.com

    or

    THE CODE
    Spoiler:
    Code:
     /*
     
     @Author Kyodia
     * NPC for : DRAZELMS
     * Purpose : Event Trophy Trade-In
    
     */
    
    var yes1 = "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"
    var yes2 = "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"
    var no = "I'm not sure you have the items needed!"
    var status;
     
    function start() {
    	status = -1;
    	action(1, 0, 0);
    }
    
    function action(m, t, s) {
    	if (mode == 1) {
    		status++;
    		}else{
    		status--;
    		}
    		if (status == 0) {
    			cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); 
    		}else if (status == 1) {
    			if (selection == 0) {
    			if (cm.haveItem(4000038, 1)) {
    				cm.sendOk(yes1);
    				cm.gainNX(10000);
    				cm.dispose();
    			}else{
    				cm.sendOk(no);
    				cm.dispose();
    		}else if (selection == 1) {
    			if (cm.haveItem(4000038, 2)) {
    				cm.sendOk(yes2);
    				cm.gainNX(22500);
    				cm.dispose();
    			}else{
    				cm.sendOk(no);
    				cm.dispose();
    				}
    			}
    		}
    	}
    }



    Thanks,
    -Jonathan


  2. #2
    Account Upgraded | Title Enabled! Nmb1Gamer is offline
    MemberRank
    Apr 2009 Join Date
    Anime HeavenLocation
    383Posts

    Re: Can someone tell me what's wrong with this script?

    Here you are...

    PHP Code:
     /*
     
     @Author Kyodia
     * NPC for : DRAZELMS
     * Purpose : Event Trophy Trade-In

     */

    var yes1 "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"// Missing semicolon or ;
    var yes2 "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k"// Same as above
    var no "I'm not sure you have the items needed!"// Same as above
    var status;
     
    function 
    start() {
        
    status = -1;
        
    action(100);
    }

    function 
    action(mts) {
        if (
    mode == 1) {
            
    status++;
        }else{
            
    status--;
        }
        if (
    status == 0) {
            
    cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); 
        } else if (
    status == 1) {
            if (
    selection == 0) {
                if (
    cm.haveItem(40000381)) {
                    
    cm.sendOk(yes1);
                    
    cm.gainItem(4000038, -1); // Just assuming you want it to take away the item
                    
    cm.gainNX(10000);
                    
    cm.dispose();
                } else {
                    
    cm.sendOk(no);
                    
    cm.dispose();
                } 
    // Missing closing bracket for else statement
            
    } else if (selection == 1) {
                if (
    cm.haveItem(40000382)) {
                    
    cm.sendOk(yes2);
                    
    cm.gainItem(4000038, -2); // Assuming you want to remove the item
                    
    cm.gainNX(22500);
                    
    cm.dispose();
                } else {
                    
    cm.sendOk(no);
                    
    cm.dispose();
                }
            }
        }
    }
    // } <- Unnecessary or just not correctly placed 

  3. #3
    Ass > Tits Lapje is offline
    MemberRank
    Feb 2009 Join Date
    nullLocation
    1,879Posts

    Re: Can someone tell me what's wrong with this script?

    ^ That won't work.

    PHP Code:
    /*
     
     @Author Kyodia
     * NPC for : DRAZELMS
     * Purpose : Event Trophy Trade-In

     */

    var yes1 "Enjoy! \r\n #b(#kYou have traded #r1 Event Trophy for 10,000 NX#b)#k"//idem
    var yes2 "Enjoy! \r\n #b(#kYou have traded #r2 Event Trophies for 22,500 NX#b)#k";
    var 
    no "I'm not sure you have the items needed!";
    var 
    status;
     
    function 
    start() {
        
    status = -1;
        
    action(100);
    }

    function 
    action(mts) { //You defined Mode, Type and Selection as m, t and s. 
        
    status++;
        if (
    != 1) {
            
    cm.dispose();
            return;
        }
        if (
    status == 0) {
            
    cm.sendSimple("Hey there #h #, need to trade in a #revent trophy#k? \r\n\r\n #L0#Trade #e1#k Event Trophy for #b10,000 NX#k#l \r\n #L1# Trade #e2#k Event Trophies for #b22,500 NX#k #l"); 
        } else if (
    status == 1) {
            if (
    == 0) {
                if (
    cm.haveItem(40000381)) {
                    
    cm.gainItem(4000038, -1);
                    
    cm.sendOk(yes1);
                    
    cm.gainNX(10000);
                } else {
                    
    cm.sendOk(no);
                }
            } else if (
    == 1) {
                if (
    cm.haveItem(40000382)) {
                    
    cm.gainItem(4000038, -2);
                    
    cm.sendOk(yes2);
                    
    cm.gainNX(22500);
                } else {
                    
    cm.sendOk(no);
                }
            }
            
    cm.dispose(); //One general dispose has the same effect.
            //Fixed your syntax
        
    }

    Last edited by Lapje; 21-01-13 at 11:43 AM. Reason: BB tag typo



Advertisement