00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.scripts;
00023
00024 import com.realtime.crossfire.jxclient.faces.Face;
00025 import com.realtime.crossfire.jxclient.items.CfItem;
00026 import com.realtime.crossfire.jxclient.items.FloorView;
00027 import com.realtime.crossfire.jxclient.items.ItemSet;
00028 import com.realtime.crossfire.jxclient.map.CfMap;
00029 import com.realtime.crossfire.jxclient.map.CfMapSquare;
00030 import com.realtime.crossfire.jxclient.map.MapUpdaterState;
00031 import com.realtime.crossfire.jxclient.queue.CommandQueue;
00032 import com.realtime.crossfire.jxclient.server.crossfire.CrossfireDrawinfoListener;
00033 import com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection;
00034 import com.realtime.crossfire.jxclient.server.socket.ClientSocketListener;
00035 import com.realtime.crossfire.jxclient.skills.Skill;
00036 import com.realtime.crossfire.jxclient.skills.SkillSet;
00037 import com.realtime.crossfire.jxclient.spells.Spell;
00038 import com.realtime.crossfire.jxclient.spells.SpellsManager;
00039 import com.realtime.crossfire.jxclient.stats.Stats;
00040 import com.realtime.crossfire.jxclient.util.EventListenerList2;
00041 import java.io.BufferedReader;
00042 import java.io.IOException;
00043 import java.io.InputStream;
00044 import java.io.InputStreamReader;
00045 import java.io.OutputStreamWriter;
00046 import java.io.UnsupportedEncodingException;
00047 import java.nio.ByteBuffer;
00048 import org.jetbrains.annotations.NotNull;
00049 import org.jetbrains.annotations.Nullable;
00050
00056 public class DefaultScriptProcess implements Runnable, ScriptProcess {
00057
00061 private final int scriptId;
00062
00066 @NotNull
00067 private final String filename;
00068
00072 @NotNull
00073 private final CommandQueue commandQueue;
00074
00078 @NotNull
00079 private final CrossfireServerConnection crossfireServerConnection;
00080
00084 @NotNull
00085 private final Stats stats;
00086
00090 @NotNull
00091 private final FloorView floorView;
00092
00096 @NotNull
00097 private final ItemSet itemSet;
00098
00102 @NotNull
00103 private final Iterable<Spell> spellsManager;
00104
00108 @NotNull
00109 private final MapUpdaterState mapUpdaterState;
00110
00114 @NotNull
00115 private final SkillSet skillSet;
00116
00120 @NotNull
00121 private final Process process;
00122
00126 @NotNull
00127 private final InputStream in;
00128
00132 @NotNull
00133 private final OutputStreamWriter osw;
00134
00138 @NotNull
00139 private final EventListenerList2<ScriptProcessListener> scriptProcessListeners = new EventListenerList2<ScriptProcessListener>(ScriptProcessListener.class);
00140
00144 @NotNull
00145 private final PacketWatcher packetWatcher;
00146
00150 private boolean isMonitoring = false;
00151
00155 private boolean killed = false;
00156
00161 @NotNull
00162 private final ClientSocketListener clientSocketListener = new ClientSocketListener() {
00163
00164 @Override
00165 public void connecting() {
00166
00167 }
00168
00169 @Override
00170 public void connected() {
00171
00172 }
00173
00174 @Override
00175 public void packetReceived(@NotNull final ByteBuffer packet) {
00176
00177 }
00178
00179 @Override
00180 public void packetSent(@NotNull final byte[] buf, final int len) {
00181 final String cmd;
00182 try {
00183 cmd = new String(buf, 0, len, "ISO-8859-1");
00184 } catch (final UnsupportedEncodingException ex) {
00185 throw new AssertionError(ex);
00186 }
00187 commandSent(cmd);
00188 }
00189
00190 @Override
00191 public void disconnecting(@NotNull final String reason, final boolean isError) {
00192
00193 }
00194
00195 @Override
00196 public void disconnected(@NotNull final String reason) {
00197
00198 }
00199
00200 };
00201
00216 public DefaultScriptProcess(final int scriptId, @NotNull final String filename, @NotNull final CommandQueue commandQueue, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final Stats stats, @NotNull final FloorView floorView, @NotNull final ItemSet itemSet, @NotNull final Iterable<Spell> spellsManager, @NotNull final MapUpdaterState mapUpdaterState, @NotNull final SkillSet skillSet) throws IOException {
00217 this.scriptId = scriptId;
00218 this.filename = filename;
00219 this.commandQueue = commandQueue;
00220 this.crossfireServerConnection = crossfireServerConnection;
00221 this.stats = stats;
00222 this.floorView = floorView;
00223 this.itemSet = itemSet;
00224 this.spellsManager = spellsManager;
00225 this.mapUpdaterState = mapUpdaterState;
00226 this.skillSet = skillSet;
00227 packetWatcher = new PacketWatcher(crossfireServerConnection, this);
00228 final Runtime rt = Runtime.getRuntime();
00229 process = rt.exec(filename);
00230 in = process.getInputStream();
00231
00232 osw = new OutputStreamWriter(process.getOutputStream());
00233 }
00234
00238 @Override
00239 public int getScriptId() {
00240 return scriptId;
00241 }
00242
00246 @NotNull
00247 @Override
00248 public String getFilename() {
00249 return filename;
00250 }
00251
00255 @Override
00256 public void run() {
00257 @Nullable String result = "unexpected";
00258 try {
00259 try {
00260 final InputStreamReader isr = new InputStreamReader(in);
00261 try {
00262 final BufferedReader br = new BufferedReader(isr);
00263 try {
00264 while (true) {
00265 final String line = br.readLine();
00266 if (line == null) {
00267 break;
00268 }
00269
00270 runScriptCommand(line);
00271 }
00272 } finally {
00273 br.close();
00274 }
00275 } finally {
00276 isr.close();
00277 }
00278 try {
00279 final int exitStatus = process.waitFor();
00280 result = exitStatus == 0 ? null : "exit "+exitStatus;
00281 } catch (final InterruptedException ex) {
00282 result = ex.getMessage();
00283 }
00284 } catch (final IOException ex) {
00285 result = ex.getMessage();
00286 }
00287 crossfireServerConnection.removeClientSocketListener(clientSocketListener);
00288 } finally {
00289 if (isMonitoring) {
00290 crossfireServerConnection.removeClientSocketListener(clientSocketListener);
00291 }
00292 packetWatcher.destroy();
00293 for (final ScriptProcessListener scriptProcessListener : scriptProcessListeners.getListeners()) {
00294 scriptProcessListener.scriptTerminated(result);
00295 }
00296 }
00297 }
00298
00302 @Override
00303 public void commandSent(@NotNull final String cmd) {
00304 if (killed) {
00305 return;
00306 }
00307
00308 try {
00309 osw.write(cmd+"\n");
00310 osw.flush();
00311 } catch (final IOException ex) {
00312 reportError(ex.getMessage());
00313 killScript();
00314 }
00315 }
00316
00322 private void commandSentItem(@NotNull final String cmd, @NotNull final CfItem item) {
00323 int flags = 0;
00324 if (item.isMagic()) {
00325 flags |= 0x100;
00326 }
00327 if (item.isCursed()) {
00328 flags |= 0x80;
00329 }
00330 if (item.isDamned()) {
00331 flags |= 0x40;
00332 }
00333 if (item.isUnpaid()) {
00334 flags |= 0x20;
00335 }
00336 if (item.isLocked()) {
00337 flags |= 0x10;
00338 }
00339 if (item.isApplied()) {
00340 flags |= 0x08;
00341 }
00342 if (item.isOpen()) {
00343 flags |= 0x04;
00344 }
00345 final int nrof = Math.max(1, item.getNrOf());
00346 final String name = nrof <= 1 ? item.getName() : nrof+" "+item.getName();
00347 commandSent(cmd+" "+item.getTag()+" "+nrof+" "+Math.max(0, item.getWeight())+" "+flags+" "+item.getType()+" "+name);
00348 }
00349
00356 private void commandSentMap(@NotNull final CfMap map, final int x, final int y) {
00357 final StringBuilder sb = new StringBuilder("request map ");
00358
00359 synchronized (map) {
00360 final CfMapSquare square = map.getMapSquare(x, y);
00361 sb.append(x);
00362 sb.append(' ');
00363 sb.append(y);
00364 sb.append(' ');
00365 sb.append(square.getDarkness());
00366 sb.append(" n y n ");
00367 sb.append(square.isFogOfWar() ? 'y' : 'n');
00368 sb.append(" smooth 0 0 0 heads");
00369 for (int i = 0; i < 3; i++) {
00370 sb.append(' ');
00371 final Face face = square.getFace(i);
00372
00373 sb.append(face == CfMapSquare.DEFAULT_FACE ? 0 : face.getFaceNum());
00374 }
00375 sb.append(" tails");
00376 for (int i = 0; i < 3; i++) {
00377 final CfMapSquare headSquare = square.getHeadMapSquare(i);
00378 if (headSquare == null) {
00379 sb.append(" 0");
00380 } else {
00381 sb.append(' ');
00382 final Face face = headSquare.getFace(i);
00383
00384 sb.append(face == CfMapSquare.DEFAULT_FACE ? 0 : face.getFaceNum());
00385 }
00386 }
00387 }
00388 commandSent(sb.toString());
00389 }
00390
00394 @NotNull
00395 @Override
00396 public String toString() {
00397 return scriptId+" "+filename;
00398 }
00399
00404 private void cmdRequest(@NotNull final String params) {
00405 if (params.equals("player")) {
00406 commandSent("request player "+itemSet.getPlayer().getTag()+" "+stats.getTitle());
00407 } else if (params.equals("range")) {
00408 commandSent("request range "+stats.getRange());
00409 } else if (params.equals("weight")) {
00410 commandSent("request weight "+stats.getStat(Stats.CS_STAT_WEIGHT_LIM)+" "+itemSet.getPlayer().getWeight());
00411 } else if (params.equals("stat stats")) {
00412 commandSent("request stat stats "+stats.getStat(Stats.CS_STAT_STR)+" "+stats.getStat(Stats.CS_STAT_CON)+" "+stats.getStat(Stats.CS_STAT_DEX)+" "+stats.getStat(Stats.CS_STAT_INT)+" "+stats.getStat(Stats.CS_STAT_WIS)+" "+stats.getStat(Stats.CS_STAT_POW)+" "+stats.getStat(Stats.CS_STAT_CHA));
00413 } else if (params.equals("stat stats_race")) {
00414 commandSent("request stat stats_race "+stats.getStat(Stats.CS_STAT_RACE_STR)+" "+stats.getStat(Stats.CS_STAT_RACE_CON)+" "+stats.getStat(Stats.CS_STAT_RACE_DEX)+" "+stats.getStat(Stats.CS_STAT_RACE_INT)+" "+stats.getStat(Stats.CS_STAT_RACE_WIS)+" "+stats.getStat(Stats.CS_STAT_RACE_POW)+" "+stats.getStat(Stats.CS_STAT_RACE_CHA));
00415 } else if (params.equals("stat stats_base")) {
00416 commandSent("request stat stats_base "+stats.getStat(Stats.CS_STAT_BASE_STR)+" "+stats.getStat(Stats.CS_STAT_BASE_CON)+" "+stats.getStat(Stats.CS_STAT_BASE_DEX)+" "+stats.getStat(Stats.CS_STAT_BASE_INT)+" "+stats.getStat(Stats.CS_STAT_BASE_WIS)+" "+stats.getStat(Stats.CS_STAT_BASE_POW)+" "+stats.getStat(Stats.CS_STAT_BASE_CHA));
00417 } else if (params.equals("stat stats_applied")) {
00418 commandSent("request stat stats_applied "+stats.getStat(Stats.CS_STAT_APPLIED_STR)+" "+stats.getStat(Stats.CS_STAT_APPLIED_CON)+" "+stats.getStat(Stats.CS_STAT_APPLIED_DEX)+" "+stats.getStat(Stats.CS_STAT_APPLIED_INT)+" "+stats.getStat(Stats.CS_STAT_APPLIED_WIS)+" "+stats.getStat(Stats.CS_STAT_APPLIED_POW)+" "+stats.getStat(Stats.CS_STAT_APPLIED_CHA));
00419 } else if (params.equals("stat cmbt")) {
00420 commandSent("request stat cmbt "+stats.getStat(Stats.CS_STAT_WC)+" "+stats.getStat(Stats.CS_STAT_AC)+" "+stats.getStat(Stats.CS_STAT_DAM)+" "+stats.getStat(Stats.CS_STAT_SPEED)+" "+stats.getStat(Stats.CS_STAT_WEAP_SP));
00421 } else if (params.equals("stat hp")) {
00422 commandSent("request stat hp "+stats.getStat(Stats.CS_STAT_HP)+" "+stats.getStat(Stats.CS_STAT_MAXHP)+" "+stats.getStat(Stats.CS_STAT_SP)+" "+stats.getStat(Stats.CS_STAT_MAXSP)+" "+stats.getStat(Stats.CS_STAT_GRACE)+" "+stats.getStat(Stats.CS_STAT_MAXGRACE)+" "+stats.getStat(Stats.CS_STAT_FOOD));
00423 } else if (params.equals("stat xp")) {
00424 final StringBuilder sb = new StringBuilder("request stat xp ");
00425 sb.append(stats.getStat(Stats.CS_STAT_LEVEL));
00426 sb.append(' ').append(stats.getExperience());
00427 for (int i = Stats.CS_STAT_SKILLINFO; i < Stats.CS_STAT_SKILLINFO+Stats.CS_NUM_SKILLS; i++) {
00428 final Skill skill = skillSet.getSkill(i);
00429 if (skill != null) {
00430 sb.append(' ').append(skill.getLevel());
00431 sb.append(' ').append(skill.getExperience());
00432 } else {
00433 sb.append(" 0 0");
00434 }
00435 }
00436 commandSent(sb.toString());
00437 } else if (params.equals("stat resists")) {
00438 final StringBuilder sb = new StringBuilder("request stat resists");
00439 for (int i = Stats.CS_STAT_RESIST_START; i <= Stats.CS_STAT_RESIST_END; i++) {
00440 sb.append(' ');
00441 sb.append(stats.getStat(i));
00442 }
00443
00444 for (int i = Stats.CS_STAT_RESIST_END+1-Stats.CS_STAT_RESIST_START; i < 30; i++) {
00445 sb.append(" 0");
00446 }
00447 commandSent(sb.toString());
00448 } else if (params.equals("stat paths")) {
00449 commandSent("request stat paths "+stats.getStat(Stats.CS_STAT_SPELL_ATTUNE)+" "+stats.getStat(Stats.CS_STAT_SPELL_REPEL)+" "+stats.getStat(Stats.CS_STAT_SPELL_DENY));
00450 } else if (params.equals("flags")) {
00451 commandSent("request flags "+stats.getStat(Stats.CS_STAT_FLAGS)+" "+(commandQueue.checkFire() ? "1" : "0")+" "+(commandQueue.checkRun() ? "1" : "0")+" 0");
00452 } else if (params.equals("items inv")) {
00453 for (final CfItem item : itemSet.getPlayerInventory()) {
00454 commandSentItem("request items inv", item);
00455 }
00456 commandSent("request items inv end");
00457 } else if (params.equals("items actv")) {
00458 for (final CfItem item : itemSet.getPlayerInventory()) {
00459 if (item.isApplied()) {
00460 commandSentItem("request items actv", item);
00461 }
00462 }
00463 commandSent("request items actv end");
00464 } else if (params.equals("items on")) {
00465 for (final CfItem item : itemSet.getItemsByLocation(0)) {
00466 commandSentItem("request items on", item);
00467 }
00468 commandSent("request items on end");
00469 } else if (params.equals("items cont")) {
00470 final int containerTag = floorView.getCurrentFloor();
00471 if (containerTag != 0) {
00472 for (final CfItem item : itemSet.getItemsByLocation(containerTag)) {
00473 commandSentItem("request items cont", item);
00474 }
00475 }
00476 commandSent("request items cont end");
00477 } else if (params.equals("map pos")) {
00478 commandSent("request map pos "+mapUpdaterState.getMapWidth()/2+" "+mapUpdaterState.getMapHeight()/2);
00479 } else if (params.equals("map near")) {
00480 final CfMap map = mapUpdaterState.getMap();
00481 final int centerX = mapUpdaterState.getMapWidth()/2;
00482 final int centerY = mapUpdaterState.getMapHeight()/2;
00483 for (int y = -1; y <= +1; y++) {
00484 for (int x = -1; x <= +1; x++) {
00485 commandSentMap(map, centerX+x, centerY+y);
00486 }
00487 }
00488 } else if (params.equals("map all")) {
00489 final CfMap map = mapUpdaterState.getMap();
00490 final int width = mapUpdaterState.getMapWidth()/2;
00491 final int height = mapUpdaterState.getMapHeight()/2;
00492 for (int y = 0; y < height; y++) {
00493 for (int x = 0; x < width; x++) {
00494 commandSentMap(map, x, y);
00495 }
00496 }
00497 } else if (params.startsWith("map ")) {
00498 final String[] tmp = params.split(" +");
00499 if (tmp.length != 3) {
00500 reportError("syntax error: request "+params);
00501 return;
00502 }
00503
00504 final int x;
00505 try {
00506 x = Integer.parseInt(tmp[1]);
00507 } catch (final NumberFormatException ignored) {
00508 reportError("syntax error: request "+params);
00509 return;
00510 }
00511
00512 final int y;
00513 try {
00514 y = Integer.parseInt(tmp[2]);
00515 } catch (final NumberFormatException ignored) {
00516 reportError("syntax error: request "+params);
00517 return;
00518 }
00519
00520 commandSentMap(mapUpdaterState.getMap(), x, y);
00521 } else if (params.equals("skills")) {
00522 for (int i = Stats.CS_STAT_SKILLINFO; i < Stats.CS_STAT_SKILLINFO+Stats.CS_NUM_SKILLS; i++) {
00523 final Object skill = skillSet.getSkill(i);
00524 if (skill != null) {
00525 commandSent("request skills "+i+" "+skill);
00526 }
00527 }
00528 commandSent("request skills end");
00529 } else if (params.equals("spells")) {
00530 for (final Spell spell : spellsManager) {
00531 commandSent("request spells "+spell.getTag()+" "+spell.getLevel()+" "+spell.getMana()+" "+spell.getGrace()+" "+spell.getSkill()+" "+spell.getPath()+" "+spell.getCastingTime()+" "+spell.getDamage()+" "+spell.getName());
00532 }
00533 commandSent("request spells end");
00534 } else {
00535 reportError("syntax error: request "+params);
00536 }
00537 }
00538
00543 private void cmdIssueMark(@NotNull final String params) {
00544 final int tag;
00545 try {
00546 tag = Integer.parseInt(params);
00547 } catch (final NumberFormatException ignored) {
00548 reportError("syntax error: issue mark "+params);
00549 return;
00550 }
00551 crossfireServerConnection.sendMark(tag);
00552 }
00553
00558 private void cmdIssueLock(@NotNull final String params) {
00559 final String[] tmp = params.split(" +", 2);
00560 if (tmp.length != 2) {
00561 reportError("syntax error: issue lock "+params);
00562 return;
00563 }
00564 final int val;
00565 final int tag;
00566 try {
00567 val = Integer.parseInt(tmp[0]);
00568 tag = Integer.parseInt(tmp[1]);
00569 } catch (final NumberFormatException ignored) {
00570 reportError("syntax error: issue lock "+params);
00571 return;
00572 }
00573 if (val < 0 || val > 1) {
00574 reportError("syntax error: issue lock "+params);
00575 return;
00576 }
00577 crossfireServerConnection.sendLock(val != 0, tag);
00578 }
00579
00584 private void cmdIssue(@NotNull final String params) {
00585 final String[] pps = params.split(" +", 3);
00586 if (pps.length != 3) {
00587 reportError("syntax error: issue "+params);
00588 return;
00589 }
00590 final int repeat;
00591 final int tmp;
00592 try {
00593 repeat = Integer.parseInt(pps[0]);
00594 tmp = Integer.parseInt(pps[1]);
00595 } catch (final NumberFormatException ignored) {
00596 reportError("syntax error: issue "+params);
00597 return;
00598 }
00599 if (tmp < 0 || tmp > 1) {
00600 reportError("syntax error: issue "+params);
00601 return;
00602 }
00603 final boolean mustSend = tmp != 0;
00604 final String command = pps[2];
00605 commandQueue.sendNcom(mustSend, repeat, command);
00606 }
00607
00612 private void cmdDraw(@NotNull final String params) {
00613 final String[] pps = params.split(" +", 2);
00614 if (pps.length != 2) {
00615 reportError("syntax error: draw "+params);
00616 return;
00617 }
00618 final int color;
00619 try {
00620 color = Integer.parseInt(pps[0]);
00621 } catch (final NumberFormatException ignored) {
00622 reportError("syntax error: draw "+params);
00623 return;
00624 }
00625 crossfireServerConnection.drawInfo(pps[1], color);
00626 }
00627
00631 private void cmdMonitor() {
00632 if (!isMonitoring) {
00633 isMonitoring = true;
00634 crossfireServerConnection.addClientSocketListener(clientSocketListener);
00635 }
00636 }
00637
00641 private void cmdUnmonitor() {
00642 if (isMonitoring) {
00643 isMonitoring = false;
00644 crossfireServerConnection.removeClientSocketListener(clientSocketListener);
00645 }
00646 }
00647
00652 private void runScriptCommand(@NotNull final String cmdLine) {
00653 final String[] tmp = cmdLine.split(" +", 2);
00654 if (tmp[0].equals("watch")) {
00655 if (tmp.length == 1) {
00656 packetWatcher.addCommand("");
00657 } else if (tmp[1].indexOf(' ') != -1) {
00658 reportError("syntax error: "+cmdLine);
00659 } else {
00660 packetWatcher.addCommand(tmp[1]);
00661 }
00662 } else if (tmp[0].equals("unwatch")) {
00663 packetWatcher.removeCommand(tmp.length >= 2 ? tmp[1] : "");
00664 } else if (tmp[0].equals("request")) {
00665 if (tmp.length == 2) {
00666 cmdRequest(tmp[1]);
00667 } else {
00668 reportError("syntax error: "+cmdLine);
00669 }
00670 } else if (tmp[0].equals("issue")) {
00671 if (tmp.length != 2) {
00672 reportError("syntax error: "+cmdLine);
00673 } else if (tmp[1].startsWith("mark ")) {
00674 cmdIssueMark(tmp[1].substring(5));
00675 } else if (tmp[1].startsWith("lock ")) {
00676 cmdIssueLock(tmp[1].substring(5));
00677 } else {
00678 cmdIssue(tmp[1]);
00679 }
00680 } else if (tmp[0].equals("draw")) {
00681 if (tmp.length == 2) {
00682 cmdDraw(tmp[1]);
00683 } else {
00684 reportError("syntax error: "+cmdLine);
00685 }
00686 } else if (tmp[0].equals("monitor")) {
00687 if (tmp.length == 1) {
00688 cmdMonitor();
00689 } else {
00690 reportError("The 'monitor' command does not take arguments.");
00691 }
00692 } else if (tmp[0].equals("unmonitor")) {
00693 if (tmp.length == 1) {
00694 cmdUnmonitor();
00695 } else {
00696 reportError("The 'unmonitor' command does not take arguments.");
00697 }
00698 } else {
00699 reportError("unrecognized command from script: "+cmdLine);
00700 }
00701 }
00702
00707 private void reportError(@NotNull final String string) {
00708 crossfireServerConnection.drawInfo(string, CrossfireDrawinfoListener.NDI_RED);
00709 }
00710
00714 @Override
00715 public void addScriptProcessListener(@NotNull final ScriptProcessListener scriptProcessListener) {
00716 scriptProcessListeners.add(scriptProcessListener);
00717 }
00718
00722 @Override
00723 public void killScript() {
00724 killed = true;
00725 process.destroy();
00726 }
00727
00731 @Override
00732 public int compareTo(@NotNull final ScriptProcess o) {
00733 if (scriptId < o.getScriptId()) {
00734 return -1;
00735 } else if (scriptId > o.getScriptId()) {
00736 return +1;
00737 } else {
00738 return 0;
00739 }
00740 }
00741
00745 @Override
00746 public int hashCode() {
00747 return scriptId;
00748 }
00749
00753 @Override
00754 public boolean equals(@Nullable final Object obj) {
00755 if (obj == null || !(obj instanceof ScriptProcess)) {
00756 return false;
00757 }
00758
00759 final ScriptProcess scriptProcess = (ScriptProcess)obj;
00760 return scriptProcess.getScriptId() == scriptId;
00761 }
00762
00763 }