View unanswered posts | View active topics It is currently Thu Mar 28, 2024 7:30 am



Reply to topic  [ 5 posts ] 
 A new script tool? Yes. 
Author Message
Civilian

Joined: Fri May 24, 2019 5:40 pm
Posts: 0
Unread post 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?


Fri May 24, 2019 5:53 pm
Profile
Civilian

Joined: Fri May 24, 2019 5:40 pm
Posts: 0
Unread post 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);
}


Sun Jun 02, 2019 10:06 pm
Profile
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2559
Location: Oklahoma City, OK 73170 US
Unread post Re: A new script tool? Yes.
Mongoose was doing some work in Java. Haven't heard from him in a while (aka years) though.

_________________
Regards,
Micro

Website: http://www.microblaster.net
TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002

ICQ is Dead Jim! Join us on Discord:
https://discord.gg/zvEbArscMN


Mon Jun 03, 2019 2:19 pm
Profile ICQ YIM WWW
1st Sergeant

Joined: Sat Aug 22, 2009 2:28 pm
Posts: 39
Unread post 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.


Sun Sep 01, 2019 7:58 pm
Profile
Chief Warrant Officer

Joined: Sun Mar 06, 2011 12:22 am
Posts: 183
Unread post Re: A new script tool? Yes.
Did anything come out of this?

_________________
Photons away!


Mon Jun 06, 2022 11:19 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.