[Help] News System Problem

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    [Help] News System Problem

    i'm trying to use that http://forum.ragezone.com/f427/add-n...system-743848/ news system
    but when i click the NPC i get error, everything else is fine, the command adding the column and everything is fine,but when i click the NPC i get error.

    using v83 MapleSolstice source

    Last edited by MrCrazy; 27-02-15 at 05:37 PM.


  2. #2
    Valued Member Tyler1q1q is offline
    MemberRank
    Aug 2009 Join Date
    136Posts

    Re: [Help] News System Problem

    Quote Originally Posted by MrCrazy View Post
    i'm trying to use that http://forum.ragezone.com/f427/add-n...system-743848/ news system
    but when i click the NPC i get error, everything else is fine, the command adding the column and everything is fine,but when i click the NPC i get error.

    using v83 MapleSolstice source
    It would be great if you could post the error you get.

  3. #3
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    Re: [Help] News System Problem

    Quote Originally Posted by Tyler1q1q View Post
    It would be great if you could post the error you get.
    This just says in bat
    Error npc: NPC ID

  4. #4
    Enthusiast vTim is offline
    MemberRank
    Feb 2015 Join Date
    40Posts

    Re: [Help] News System Problem

    @MrCrazy post a screenshot of your error. Also, read the release. People added stuff for it to work it looks like. Maybe I suggest you do the same and read the comments on the release.

  5. #5
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    Re: [Help] News System Problem

    Quote Originally Posted by vTim View Post
    @MrCrazy post a screenshot of your error. Also, read the release. People added stuff for it to work it looks like. Maybe I suggest you do the same and read the comments on the release.
    i tried what other people post, and there is nothing to picture, i'm saying it's only says " NPC Error: ID 2001004 "

  6. #6
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: [Help] News System Problem

    Find out in your source where it shows the following message: "NPC Error: ID" and print the exception instead so you know what's wrong with it.

  7. #7
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    Re: [Help] News System Problem

    Quote Originally Posted by Fraysa View Post
    Find out in your source where it shows the following message: "NPC Error: ID" and print the exception instead so you know what's wrong with it.
    Quote Originally Posted by xStr0nGx View Post
    'Exception.StackTrace' for being exact, and be sure to post it here if you'd like us to help.
    PHP Code:
    [CODE]public void start(MapleClient cint npcString filenameMapleCharacter chr) {
            
    c.getPlayer().setLastNpc(npc);
            try {
                
    NPCConversationManager cm = new NPCConversationManager(cnpc);
                if (
    cms.containsKey(c)) {
                    return;
                }
                
    cms.put(ccm);
                
    Invocable iv null;
                if (
    filename != null) {
                    
    iv getInvocable("npc/" filename ".js"c);
                }
                if (
    iv == null) {
                    
    iv getInvocable("npc/" npc ".js"c);
                }
                if (
    iv == null || NPCScriptManager.getInstance() == null) {
                    
    dispose(c);
                    return;
                }
                
    engine.put("cm"cm);
                
    NPCScript ns iv.getInterface(NPCScript.class);
                
    scripts.put(cns);
                if (
    chr == null) {
                    
    ns.start();
                } else {
                    
    ns.start(chr);
                }
            } catch (
    UndeclaredThrowableException ute) {
                
    ute.printStackTrace();
                
    System.out.println("Error: NPC " npc ". UndeclaredThrowableException.");
                
    dispose(c);
                
    cms.remove(c);
                
    notice(c);
            } catch (
    Exception e) {
                
    System.out.println("Error: NPC " npc ".");
                
    e.printStackTrace();
                
    e.printStackTrace(System.out);
                
    dispose(c);
                
    cms.remove(c);
                
    notice(c);
            }
        }


        public 
    void action(MapleClient cbyte modebyte typeint selection) {
            
    NPCScript ns scripts.get(c);
            if (
    ns != null) {
                try {
                    
    ns.action(modetypeselection);
                } catch (
    UndeclaredThrowableException ute) {
                    
    ute.printStackTrace();
                    
    //System.out.println("Error: NPC " + getCM(c).getNpc() + ". UndeclaredThrowableException.");
                    
    System.out.println("Error executing NPC script. " c.getPlayer().getLastNpc() + ".js");// My Change
                    
    dispose(c);
                    
    notice(c);
                } catch (
    Exception e) {
                    
    //System.out.println("Error: NPC " + getCM(c).getNpc() + ".");
                    
    System.out.println("Error executing NPC script. " c.getPlayer().getLastNpc() + ".js");// My Change
                    
    e.printStackTrace();
                    
    e.printStackTrace(System.out);
                    
    dispose(c);
                    
    notice(c);
                }
            }
        }
    [/
    CODE
    Last edited by MrCrazy; 27-02-15 at 05:36 PM.

  8. #8
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    Re: [Help] News System Problem

    there i posted the error, and now nobody helps

  9. #9
    C# developer xStr0nGx is offline
    MemberRank
    Dec 2013 Join Date
    UnknownLocation
    659Posts

    Re: [Help] News System Problem

    What's on line 69?

    [NPCScriptManager class]

  10. #10
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    Re: [Help] News System Problem

    Quote Originally Posted by xStr0nGx View Post
    What's on line 69?

    [NPCScriptManager class]
    PHP Code:
    ns.start(); 
    all start function

    PHP Code:
    46:public void start(MapleClient cint npcString filenameMapleCharacter chr) {        47:c.getPlayer().setLastNpc(npc);
            
    48:try {
                
    49:NPCConversationManager cm = new NPCConversationManager(cnpc);
               
    50: if (cms.containsKey(c)) {
                   
    51: return;
               
    52: }
                
    53:cms.put(ccm);
                
    54:Invocable iv null;
                
    55:if (filename != null) {
                    
    56:iv getInvocable("npc/" filename ".js"c);
                
    57:}
                
    58:if (iv == null) {
                    
    59:iv getInvocable("npc/" npc ".js"c);
                
    60:}
                
    61:if (iv == null || NPCScriptManager.getInstance() == null) {
                    
    62:dispose(c);
                    
    63:return;
                
    64:}
                
    65:engine.put("cm"cm);
                
    66:NPCScript ns iv.getInterface(NPCScript.class);
                
    67:scripts.put(cns);
                
    68:if (chr == null) {
                    
    69:ns.start();
                
    70:} else {
                    
    71:ns.start(chr);
                
    82:}
            
    83:} catch (UndeclaredThrowableException ute) {
                
    84:ute.printStackTrace();
                
    85:System.out.println("Error: NPC " npc ". UndeclaredThrowableException.");
                
    86:dispose(c);
                
    87:cms.remove(c);
                
    88:notice(c);
            
    89:} catch (Exception e) {
                
    90:System.out.println("Error: NPC " npc ".");
                
    91:e.printStackTrace();
                
    92:e.printStackTrace(System.out);
                
    93:dispose(c);
                
    94:cms.remove(c);
                
    95:notice(c);
            
    96:}
        
    97:} 

  11. #11
    C# developer xStr0nGx is offline
    MemberRank
    Dec 2013 Join Date
    UnknownLocation
    659Posts

    Re: [Help] News System Problem

    Try changing the method to this:

    public void start(MapleClient c, int npc, String filename, MapleCharacter chr) {
    try {
    NPCConversationManager cm = new NPCConversationManager(c, npc);
    if (cms.containsKey(c)) {
    dispose(c);
    return;
    }
    cms.put(c, cm);
    Invocable iv = null;
    if (filename != null) {
    iv = getInvocable("npc/world" + c.getWorld() + "/" + filename + ".js", c);
    }
    if (iv == null) {
    iv = getInvocable("npc/world" + c.getWorld() + "/" + npc + ".js", c);
    }
    if (iv == null || NPCScriptManager.getInstance() == null) {
    dispose(c);
    return;
    }
    engine.put("cm", cm);
    scripts.put(c, iv);
    try {
    iv.invokeFunction("start");
    } catch (final NoSuchMethodException nsme) {
    try {
    iv.invokeFunction("start", chr);
    } catch (final NoSuchMethodException nsma) {
    iv.invokeFunction("action", (byte) 1, (byte) 0, 0);
    }
    }
    } catch (final UndeclaredThrowableException | ScriptException ute) {
    FilePrinter.printError(FilePrinter.NPC + npc + ".txt", ute);
    notice(c, npc);
    dispose(c);
    } catch (final Exception e) {
    FilePrinter.printError(FilePrinter.NPC + npc + ".txt", e);
    notice(c, npc);
    dispose(c);
    }
    }
    It seems to be more completed. Taken from MoopleDEV.

  12. #12
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: [Help] News System Problem

    Quote Originally Posted by xStr0nGx View Post
    Try changing the method to this:



    It seems to be more completed. Taken from MoopleDEV.
    that'd break it. he doesn't even have multi worlds so using "scripts/npc/world0" would already throw a new error.

    @OP I'd like to see your current NPC script you're attempting to use in the first place, post that please.

  13. #13
    C# developer xStr0nGx is offline
    MemberRank
    Dec 2013 Join Date
    UnknownLocation
    659Posts

    Re: [Help] News System Problem

    Quote Originally Posted by chunkarama View Post
    that'd break it. he doesn't even have multi worlds so using "scripts/npc/world0" would already throw a new error.

    @OP I'd like to see your current NPC script you're attempting to use in the first place, post that please.
    Didn't noticed this part, it shouldn't be a problem if he knows what he is doing.


    Anyways the problem is that
    iv.getInterface(NPCScript.class);
    returns null,

    which means it should be removed and replaced by:
    scripts.put(c, iv);
    instead of the ns variable.

    Or if it works differently, then the problem could be laying somewhere else, I don't know.


    @OP, is the problem occurs only for this specific NPC? if so then please post the script as Chunkarama said.
    Last edited by xStr0nGx; 28-02-15 at 08:45 PM.

  14. #14
    They listening... MrCrazy is offline
    MemberRank
    Feb 2013 Join Date
    325Posts

    Re: [Help] News System Problem

    Quote Originally Posted by chunkarama View Post
    that'd break it. He doesn't even have multi worlds so using "scripts/npc/world0" would already throw a new error.

    @op i'd like to see your current npc script you're attempting to use in the first place, post that please.
    Code:
    function start() {
        cm.sendok("dfhdf");
        cm.dispose();
    }
    Quote Originally Posted by xstr0ngx View Post
    didn't noticed this part, it should be a problem if he knows what he is doing.


    Anyways the problem is that returns null,

    which means it should be removed and replaced by: Instead of the ns variable.

    Or if it works differently, then the problem could be laying somewhere else, i don't know.


    @op, is the problem occurs only for this specific npc? If so then please post the script as chunkarama said.
    your fix
    NPCScript ns = scripts.put(c, (NPCScript) iv);//iv.getInterface(NPCScript.class);
    Last edited by MrCrazy; 28-02-15 at 11:22 AM.

  15. #15
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: [Help] News System Problem

    The problem is with your script, not with your scripting interface. Remove the script suggested by xStr0nGx and read the error again to see what's wrong with your script.



Page 1 of 2 12 LastLast

Advertisement