www.ClassicTW.com
https://mail.black-squirrel.com/

SWATH Script Problem
https://mail.black-squirrel.com/viewtopic.php?f=15&t=12892
Page 1 of 1

Author:  Aaron [ Tue Sep 04, 2001 5:47 pm ]
Post subject: 

I made a script for SWATH that t-warps to SD, buy shields and figs and is _supposed_ to t-warp back. However, after it buys the shields/figs
from SD it does not seem to want to engage TW. There _is_ enough fuel onboard the ship, so it must be another problem. The .java file follows :


import com.swath.*;
import com.swath.cmd.*;

/*
* This script buys shields and fighters from the
* StarDock and deposits them on a planet.
*
* author Aaron
*/

public class ShieldFigBuy extends UserDefinedScript {
private Parameter m_shields;
private Parameter m_fighters;
private Parameter m_loops;

public String getName() {
return "Shield/Fighter SD Buy";
}

public boolean initScript() throws Exception {
// Start on a planet
if(!atPrompt(Swath.PLANET_PROMPT)) return false;

m_shields = new Parameter("Planet Shields Per Loop");
m_shields.setType(Parameter.INTEGER);
m_fighters = new Parameter("Planet Fighters Per Loop");
m_fighters.setType(Parameter.INTEGER);
m_loops = new Parameter("Number of Loops");
m_loops.setType(Parameter.INTEGER);

registerParam(m_shields);
registerParam(m_fighters);
registerParam(m_loops);

return true;
}

public boolean runScript() throws Exception {
int current_sector = Swath.main.currSector();
int planet_number = Swath.main.currPlanet();
int shields = m_shields.getInteger();
int fighters = m_fighters.getInteger();
int loops = m_loops.getInteger();
int stardock = Swath.main.stardock();

for(int i=1; i<=loops; i++) {
TakeLeaveProducts.exec(-Swath.ship.fuel(),
-Swath.ship.organics(),-Swath.ship.equipment());
TakeLeaveProducts.exec(Swath.ship.holds(),0,0);
LiftOff.exec();
TransWarp.exec(stardock);
LandOnStarDock.exec();
BuyItems.exec(Swath.FIGHTERS,fighters);
BuyItems.exec(Swath.SHIELDS,shields*10);
LeaveStarDock.exec();
TransWarp.exec(current_sector); // <-- WONT TW BACK AT THIS POINT
Land.exec(planet_number);
if(shields != 0) {
EnterCitadel.exec();
TakeLeaveShields.exec(shields);
LeaveCitadel.exec();
}
if(fighters != 0) {
TakeLeaveFighters.exec(fighters);
}
}
return true;
}

public void endScript(boolean finished) {
}
}


I would appreciate comments as to how i could solve this problem. (BTW there _are_ figs in
destination sector, I am able to t-warp back to it, its just that the script wont do it
for some reason.)


"He who can destroy a thing, controls a thing."
Currently Playing on the [url="http://www.coastgames.com"]Coast Games[/url] [url="telnet://204.201.36.135:2002"]TWGS[/url]
[/url]

Edited by - aaron on 09/04/2001 3:49:14 PM

Edited by - aaron on 09/04/2001 3:50:05 PM

Edited by - aaron on 09/04/2001 3:51:34 PM

Edited by - aaron on 09/04/2001 3:52:00 PM

Edited by - aaron on 09/04/2001 5:41:29 PM

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/