www.ClassicTW.com
http://classictw.com/

A new script tool? Yes.
http://classictw.com/viewtopic.php?f=15&t=35530
Page 1 of 1

Author:  Kevlar [ Fri May 24, 2019 5:53 pm ]
Post subject:  A new script tool? Yes.

Long time lurker, first time poster.

I've been a TW2002 player since the 2400 baud days and have written my fair share of scripts and helpers. Recently I tried to get my registered SWATH working and TWC going, but despite best efforts, ran into issues that just made it unworkable.

So, being the programmer I am, I decided I would just start over again, except this time, do it for real. I never liked the TWC programming model, and SWATH just doesn't want to play ball, and TWC was programmed in Turbo Pascal (IEW), so I figured, "I know how to do this... why not" and got to hacking last week.

So far I have the following in place:
Java/Spring/Spring Data/MongoDB up and working
Telnet proxy via Netty
Event dispatching for ongoing events, listen once events, and listen once for one of multiple possible events, canceling the other listeners when one arrives.
Framework for parsing the stream via RegExps and String buffers to capture events.
Parsing a fair number of events and dispatching them to listeners.
Storing sector information in the DB.
Sending commands.
Waiting for events (like prompts) and getting callbacks with the data those prompts contained to make future decisions with.
Sending commands.
A few complete commands, like land on a planet which accepts a callback to see the planets you can land on, and return which planet to land on before finishing the land command.

I was wondering if there was any interest in anyone hacking on this with me? I would be happy to put it up on my Github, with the understanding it's "source only/programmers only" at this time.

And if not, I'll just go back to hacking away and post again in another month when it can actually do something useful and cool. :)

Let me know?

Author:  Kevlar [ Sun Jun 02, 2019 10:06 pm ]
Post subject:  Re: A new script tool? Yes.

A quick update: I've gotten the first script running. I'm still having an occasional problem with it but it's REALLY fast and easy to work with.

The script looks like this:
try {
game.waitFor(Game.Prompt.Command);
while (running) {
if(game.currentSector == null){
Thread.sleep(100);
continue;
}
Optional<Sector> sectorOptional = sectorRepository.findById(game.currentSector);
if(sectorOptional.get().getPort() != null) {
game.trade();
game.upgradeStarport(Port.CargoType.FUEL_ORE, 1);
game.upgradeStarport(Port.CargoType.ORGANICS, 1);
game.upgradeStarport(Port.CargoType.EQUIPMENT, 1);
}
game.move(sectorOptional.get().getWarps().get(random.nextInt(sectorOptional.get().getWarps().size())));
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}

Author:  Micro [ Mon Jun 03, 2019 2:19 pm ]
Post subject:  Re: A new script tool? Yes.

Mongoose was doing some work in Java. Haven't heard from him in a while (aka years) though.

Author:  draconia [ Sun Sep 01, 2019 7:58 pm ]
Post subject:  Re: A new script tool? Yes.

Returning to the game... I'm following this thread with interest... I do not have time to get involved in this project at the moment but possibly in the future.

I'm just stretching my legs with all the old stuff thats been sitting around all these years playing catch up.

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