protected Invocable getInvocable(String path, MapleClient c) {
		try {
			path = "scripts/" + path;
			engine = null;
			if (c != null) {
				engine = c.getScriptEngine(path);
			}
			if (engine == null) {
				File scriptFile = new File(path);
				if (!scriptFile.exists())
					return null;
				engine = sem.getEngineByName("javascript");
				if (c != null) {
					c.setScriptEngine(path, engine);
				}
				FileReader fr = new FileReader(scriptFile);
				engine.eval(fr);
				fr.close();
			}		
			return (Invocable) engine;
		} catch (Exception e) {
			log.error("Error executing script.", e);
			return null;
		}
	}