示例#1
0
  public boolean initScript() throws Exception {
    // Initialisation of the script is done in this method.
    // All parameters should be created and registered here.
    // If something goes wrong, return false.

    // Check that we are at the correct prompt
    if (!atPrompt(Swath.COMMAND_PROMPT)) return false;

    // Create the parameter 'startSector' and set the value to
    // the current sector.
    // The type will be set to INTEGER by setInteger().

    startSector = new Parameter("What sector do you want to start at?");
    startSector.setInteger(Swath.main.currSector());

    // Create the parameter 'cycles' and set the value to
    // to zero.
    // The type will be set to INTEGER by setInteger().
    cycles = new Parameter("How many cycles (0 = until done)");
    cycles.setInteger(0);

    // If we want to set voids during ether probe or not.
    // setting voids will result in longer warp paths.
    // but you will also possible lock out certain parts of
    // the universe so voids is good on a first run.
    // then do a second run without setting any voids.
    // to get the rest of the universe.
    toggleVoid = new Parameter("Set voids ?");
    toggleVoid.setType(Parameter.BOOLEAN);
    toggleVoid.setBoolean(true);

    oneWarps = new Parameter("One Warps ?");
    oneWarps.setType(Parameter.BOOLEAN);
    oneWarps.setBoolean(true);

    twoWarps = new Parameter("Two Warps ?");
    twoWarps.setType(Parameter.BOOLEAN);
    twoWarps.setBoolean(true);

    threeWarps = new Parameter("Three Warps ?");
    threeWarps.setType(Parameter.BOOLEAN);
    threeWarps.setBoolean(false);

    fourWarps = new Parameter("Four Warps ?");
    fourWarps.setType(Parameter.BOOLEAN);
    fourWarps.setBoolean(false);

    fiveWarps = new Parameter("Five Warps ?");
    fiveWarps.setType(Parameter.BOOLEAN);
    fiveWarps.setBoolean(false);

    sixWarps = new Parameter("Six Warps ?");
    sixWarps.setType(Parameter.BOOLEAN);
    sixWarps.setBoolean(true);

    // Resgister the parameters the the user picked
    // so we can use them from inside the script.
    registerParam(startSector);
    registerParam(cycles);
    registerParam(toggleVoid);
    registerParam(oneWarps);
    registerParam(twoWarps);
    registerParam(threeWarps);
    registerParam(fourWarps);
    registerParam(fiveWarps);
    registerParam(sixWarps);

    // Some other initialisation could be done here
    // ...

    return true;
  }