CPQ Script Error

Newbie Spellweaver
Joined
Jul 31, 2015
Messages
10
Reaction score
0
Script :
PHP:
/**  *  [USER=19862]id[/USER] 2042000
 *        [USER=806871]NPC[/USER] Spiegelmann
 *        [USER=836108]Function[/USER] Monster Carnival Lobby NPC
 * @author s4nta
 */

// Relevant Monster Carnival classes
var MonsterCarnival = net.sf.odinms.server.partyquest.mcpq.MonsterCarnival;
var MCTracker = net.sf.odinms.server.partyquest.mcpq.MCTracker;
var MCParty = net.sf.odinms.server.partyquest.mcpq.MCParty;
var MCField = net.sf.odinms.server.partyquest.mcpq.MCField;
var MCTeam = net.sf.odinms.server.partyquest.mcpq.MCField.MCTeam;

// NPC variables
var status = -1;
var carnival, field;
var room = -1;

function start() {
    if (cm.getMapId() != 980000000) {
        MCTracker.log("Spiegelmann called on invalid map " + cm.getMapId() + " by player " + cm.getName());
        cm.sendOk("You are not authorized to do this.");
        cm.dispose();
        return;
    }
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
        return;
    }
    if (mode == 1) status++;
    else status--;

    if (status == 0) {
        if (cm.getParty() == null) {
            cm.sendOk("You are not in a party.");
            cm.dispose();
            return;
        } else if (!cm.isLeader()) {
            cm.sendOk("If you want to try Carnival PQ, please tell the #bleader of your party#k to talk to me.");
            cm.dispose();
            return;
        }
        carnival = MonsterCarnival.getMonsterCarnival(cm.getChannel());
        cm.sendSimple(carnival.getNPCAvailableFields());
    } else if (status == 1) {
        room = selection;
        if (room < 1 || room > 6) {
            cm.sendOk("That is not a valid room.");
            cm.dispose();
            return;
        }
        var code = carnival.registerStatus(cm.getParty(), selection);
        if (code == MonsterCarnival.STATUS_FIELD_FULL) {
            cm.sendOk("This room is currently full.")
        } else if (code == MonsterCarnival.STATUS_PARTY_SIZE) {
            cm.sendOk("Your party is not the right size for this field.");
        } else if (code == MonsterCarnival.STATUS_PARTY_LEVEL) {
            cm.sendOk("Please check to see that the members in your party are between level 30 and 50.");
        } else if (code == MonsterCarnival.STATUS_PARTY_MISSING) {
            cm.sendOk("Please make sure everyone in your party is in this lobby.");
        } else if (code == MonsterCarnival.STATUS_FIELD_INVALID) {
            cm.sendOk("Unauthorized request.");
        }

        if (code == MonsterCarnival.STATUS_PROCEED) {
            field = carnival.getField(room);
            party = carnival.createParty(cm.getParty());
            field.register(party, MCTeam.RED);
            cm.sendOk("You will have 3 minutes to accept challenges from other parties.");
        } else if (code == MonsterCarnival.STATUS_REQUEST) {
            cm.sendOk("Sending request to room " + room + ". You will be automatically warped in if they accept your challenge.");
            field = carnival.getField(room);
            party = carnival.createParty(cm.getParty());
            field.request(party);
        }
        cm.dispose();
    }
}

Error:
Code:
±⌠Φ 27, 2016 10:21:11 PM net.sf.odinms.scripting.npc.NPCScriptManager startSEVERE: Error executing NPC script.javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getChannel in object Conversation with NPC: 2042000. (<Unknown source>#47) in <Unknown source> at line number 47        at com.sun.script.javascript.RhinoScriptEngine.invoke(Unknown Source)        at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(Unknown Source)        at net.sf.odinms.scripting.npc.NPCScriptManager.start(NPCScriptManager.java:50)        at net.sf.odinms.scripting.npc.NPCScriptManager.start(NPCScriptManager.java:24)        at net.sf.odinms.net.channel.handler.NPCTalkHandler.handlePacket(NPCTalkHandler.java:44)        at net.sf.odinms.net.MapleServerHandler.messageReceived(MapleServerHandler.java:117)        at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)        at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)        at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58)        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180)        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)        at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)        at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)        at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)        at java.lang.Thread.run(Unknown Source)Caused by: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getChannel in object Conversation with NPC: 2042000. (<Unknown source>#47)        at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(Unknown Source)        at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(Unknown Source)        at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError(Unknown Source)        at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError2(UnknownSource)        at sun.org.mozilla.javascript.internal.ScriptRuntime.notFunctionError(Unknown Source)        at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThisHelper(Unknown Source)        at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThis(Unknown Source)        at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Unknown Source)        at sun.org.mozilla.javascript.internal.Interpreter.interpret(Unknown Source)        at sun.org.mozilla.javascript.internal.InterpretedFunction.call(UnknownSource)        at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(UnknownSource)        at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(UnknownSource)        at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(Unknown Source)        at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(Unknown Source)        at sun.org.mozilla.javascript.internal.InterpretedFunction.call(UnknownSource)        ... 21 more
the bat says that the function cm.getChannel is missing , can someone give me a working getchannel function for XiuzSource v62?

thanks.
 
Last edited:
Well yeah since it's missing (but not broken). Once you add the 1 line method to NPCConversationManager, the error will be fixed.
it dosent need to do something ? only 1 line method? i dont want this to be just null method when the guy that wrote the script meant something else.

and 2nd : this is ok?
PHP:
    public void getChannel(int id) {            }

or maybe it should be like this :
PHP:
     public void getChannel(ChannelServer channel) {            }
 
Upvote 0
Back