| www.ClassicTW.com https://classictw.com/ |
|
| scripting with ChatGPT https://classictw.com/viewtopic.php?f=15&t=35966 |
Page 1 of 1 |
| Author: | Crosby [ Wed May 28, 2025 8:43 am ] |
| Post subject: | scripting with ChatGPT |
Is anybody working on teaching an AI to do some TWX scripting? I've gone from thinking I'd never need AI to wondering if a couple years from now we'll be totally dependent on its use. |
|
| Author: | Astrochimp [ Wed Jun 04, 2025 8:41 pm ] |
| Post subject: | Re: scripting with ChatGPT |
We won't be dependent on it - it's just a productivity tool. And anyway, it looks like ChatGPT already knows some stuff. Here's what it gave me for the prompt "can you write a twxproxy script that moves colonists from sector 1 to planet number 23 in the current sector and assigns them to fuel ore?" I haven't tested it. (edit:) looks like it's not gonna get to sector 1 unless it's right next door, maybe. But if you tell that to ChatGPT it'll probably fix it properly. Then you'll find another problem, and you can get ChatGPT to help you fix that, too. And on and on, just like with any other language. It's pretty tedious but it still beats doing all of it yourself. Sometimes. # SCRIPT: move_colonists_to_planet23.ts # PURPOSE: Move colonists from sector 1 to a planet in another sector, then assign to Fuel Ore proc main # Move to sector 1 setTextLineTrigger 1 moveDone "Command [TL=" send "1*" pause :moveDone # Check if we have colonists in our hold setTextLineTrigger 2 checkColonists "Citadel command (?=Help)" send "c" pause :checkColonists # Launch from citadel send "q" # Assuming we're carrying colonists now # Move to the destination sector (example: 5) # If you want to stay in current sector and planet is here, skip this # Uncomment below and change sector if needed # setTextLineTrigger 3 warpDone "Command [TL=" # send "5*" # pause :warpDone # Land on planet #23 setTextLineTrigger 4 planetMenu "Planet #23 command (?=Help)" send "l23" pause :planetMenu # Transfer all colonists from ship to planet setTextLineTrigger 5 planetMenu2 "Planet #23 command (?=Help)" send "tc" pause :planetMenu2 # Assign colonists to Fuel Ore production setTextLineTrigger 6 prodMenu "Production command (?=Help)" send "p" pause :prodMenu # Assign all available colonists to Fuel Ore setTextLineTrigger 7 done "Production command (?=Help)" send "f" pause :done # Done! send "q" halt end |
|
| Author: | Star Killer [ Wed Jun 25, 2025 3:33 pm ] |
| Post subject: | Re: scripting with ChatGPT |
Micro is working on that since he can't see well anymore he's using it as a programing tool. not for twx though. sk |
|
| Author: | ElderProphet [ Fri Oct 10, 2025 11:07 am ] |
| Post subject: | Re: scripting with ChatGPT |
Astrochimp wrote: We won't be dependent on it - it's just a productivity tool. And anyway, it looks like ChatGPT already knows some stuff. Here's what it gave me for the prompt "can you write a twxproxy script that moves colonists from sector 1 to planet number 23 in the current sector and assigns them to fuel ore?" I haven't tested it. (edit:) looks like it's not gonna get to sector 1 unless it's right next door, maybe. But if you tell that to ChatGPT it'll probably fix it properly. Then you'll find another problem, and you can get ChatGPT to help you fix that, too. And on and on, just like with any other language. It's pretty tedious but it still beats doing all of it yourself. Sometimes. # SCRIPT: move_colonists_to_planet23.ts You're fired, ChatGPT. That script was terrible. |
|
| Author: | Grey Gamer [ Sun Nov 23, 2025 7:01 pm ] |
| Post subject: | SWATH Hostile Sector Cleaner |
I recently read that LLMs are adequate at basic coding, but can't do complex programming, and if humans don't master the basic work, they will never be able to handle it when it becomes advanced. "LLMs allow programmers to write code without understanding it and to increase productivity without increasing skill." https://tomlee.wtf/2024/08/13/llms-and-programming I don't know how I could have gotten through grad school without LLMs because whenever I asked my classmates for help, they either ignored me or said "We'll get through this together." Did that make them feel good? It didn't accomplish anything! It was infuriating because if anyone else asked for help, one of us replied. I helped my classmates vastly more than they helped me. My professors almost always refused to help (or just ignored me), but then they made me sign a form claiming I never asked for help. I did finally graduate, but I haven't found a job... The most useful thing LLMs ever did was give me a response so bad I figured out how to do it myself, but I don't have any idea what I would have done when my advisor ordered me to completely rewrite my 50-page research paper the first 8 times if I couldn't feed it into an LLM and tell it what changes I needed. I don't know if Grammarly could have done that, but I had a professor command me to pay for it, and I responded "Why? I write better than it does." The problem was that I would tell the LLM "Please change x, y, and z throughout my paper while maintaining two spaces between sentences and the Oxford comma in accordance with my school requirements. It would respond "I changed x, y, and z throughout your paper while maintaining two spaces between sentences and the Oxford comma in accordance with your school requirements." However, it always reduced the spaces between sentences, and eliminated the Oxford comma. Then I fed it into Grammarly and it demanded I put two spaces between sentences, although it has some weird inverse Oxford comma rule. "I ate dinner, and my brother went to bed" was allegedly correct, but "Larry, Curly, and Moe" was incorrect. It also pointed out hundreds of errors in my quotes. Sure, they wrote poorly, but I can't change their words! All of this was too complicated to search and replace. I wrote "Dr." dozens of times in my 50-page research paper! I used to pull up Gemini, ChatGPT, and CoPilot, ask the same questions, and 2-3 of them would give garbage answers, but I didn't have all night to try to figure out everything on my own, I had too many deadlines! Since I finished my classes, I tend to use Gemini because I'll ask ChatGPT something and it asks me some silly follow-up question. "Obviously. Why haven't you done that yet?!" This repeats until it says “You’ve hit your usage limit. Please try again later.” Obviously, useful responses aren't the product. We're training it so it can sell services to corporations, but I have hit the usage limit so many times, it seems like its purpose is to waste our time unless we pay. Gemini doesn't have a usage limit, but even though I tell it when to change # to //, it either uses # everywhere (which fails), or // everywhere, which is unnecessary and looks weird. Every LLM I have tried always tries to use statements like: If ($string CONTAINS "ack) Unfortunately, each time I attempt to run a script containing a "CONTAINS" statement, it errors out. However, I mentioned to Gemini that I was pulling a list of known hostile sectors from SWATH, adjusting formatting in Word (which was probably unnecessary), stripping unnecessary columns in Excel, and then pasting the list of targets in Notepad, and it wrote this: Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SWATH Data Sector Cleaner</title> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Inter', sans-serif; background-color: #f7f7f7; } textarea { resize: none; font-family: monospace; min-height: 200px; } </style> </head> <body class="p-4 sm:p-8"> <div class="max-w-4xl mx-auto bg-white shadow-xl rounded-xl p-6 md:p-10"> <h1 class="text-3xl font-bold text-gray-800 mb-2">SWATH Hostile Sector Cleaner</h1> <p class="text-gray-600 mb-6">Paste your raw, multi-column report data from SWATH below. This tool will automatically extract only the sector numbers (the first column) into a clean list for your TWX-Proxy script.</p> <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <!-- Input Area --> <div> <label for="rawInput" class="block text-sm font-medium text-gray-700 mb-2">1. Paste Raw SWATH Data Here:</label> <textarea id="rawInput" class="w-full border-2 border-gray-300 rounded-lg p-3 focus:ring-blue-500 focus:border-blue-500 transition duration-150" placeholder="Example line: 368 --- 12 2025-11-23 -"></textarea> <button onclick="cleanData()" class="mt-4 w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded-lg shadow-md transition duration-200"> Process Data (Click Here) </button> </div> <!-- Output Area --> <div> <label for="cleanOutput" class="block text-sm font-medium text-gray-700 mb-2">2. Clean Sector List (Ready for hostiles.txt):</label> <textarea id="cleanOutput" class="w-full border-2 border-green-300 bg-green-50 rounded-lg p-3 focus:ring-green-500 focus:border-green-500 transition duration-150" placeholder="1234 5678 9012" readonly></textarea> <p id="statusMessage" class="mt-2 text-sm text-gray-500"></p> </div> </div> </div> <script> function cleanData() { const rawText = document.getElementById('rawInput').value; const outputField = document.getElementById('cleanOutput'); const statusMsg = document.getElementById('statusMessage'); const lines = rawText.split('\n'); const cleanSectors = []; let extractedCount = 0; // Clear previous output and status outputField.value = ''; statusMsg.textContent = 'Processing...'; statusMsg.classList.remove('text-red-500', 'text-green-600'); // Regex to find the first sequence of digits at the start of a line, // ignoring leading whitespace/tabs and the optional column header line. const sectorRegex = /^\s*(\d+)/; lines.forEach((line) => { // Skip header lines or obvious non-data lines if (line.includes("Sector") || line.trim() === '') { return; } const match = line.match(sectorRegex); if (match && match[1]) { const sectorNumber = match[1]; cleanSectors.push(sectorNumber); extractedCount++; } }); if (extractedCount > 0) { outputField.value = cleanSectors.join('\n'); statusMsg.textContent = `Successfully extracted ${extractedCount} sector numbers. Copy this list and save it as hostiles.txt.`; statusMsg.classList.add('text-green-600'); } else { outputField.value = ''; statusMsg.textContent = 'No valid sector numbers found. Ensure you are pasting the raw SWATH report text.'; statusMsg.classList.add('text-red-500'); } } </script> </body> </html> Does it know html better than it knows TWX-Proxy? I could easily do that in TWX-Proxy, but it wouldn't look as nice! |
|
| Author: | Grey Gamer [ Mon Dec 01, 2025 4:43 pm ] |
| Post subject: | Re: scripting with ChatGPT |
I asked ChatGPT: Quote: What does CBY do in TW2002 and how to best implement using a TWX-Proxy script? It responded with a word salad, but suddenly, it is a big fan. I tried quoting it, but I don't know if it uses characters not supported by phpBB, but it was 1.5-2 pages of utter nonsense. Clod told me it didn't know, which was refreshing, if useless, although of course, it used two paragraphs to say that. Gemini had some weird story about being a "Corporate buy [fuel]" command. It wrote a script which wouldn't do anything, but it only guesses how everything works and assumes commands, etc. If you insist on working with LLMs, you're going to explain the same things over and over again. |
|
| Author: | Xanos [ Thu Dec 04, 2025 9:40 pm ] |
| Post subject: | Re: scripting with ChatGPT |
Garbage in, garbage out. A hammer is a useful tool also, but not everything is a nail. |
|
| Author: | Hammer_2 [ Mon Dec 08, 2025 7:14 am ] |
| Post subject: | Re: scripting with ChatGPT |
Xanos wrote: Garbage in, garbage out. A hammer is a useful tool also, but not everything is a nail. I resemble that comment! That being said; if anyone has looked at some of my scripts they'd have made the same garbage comment. Hope everyone is doing well! |
|
| Author: | Grey Gamer [ Wed Dec 10, 2025 4:19 pm ] |
| Post subject: | Re: scripting with ChatGPT |
My scripts stopped working. The planetary trader I wrote a couple of years back and used without a problem all of that time doesn't do anything. The Ptrader someone gave me runs CIM and claims it is out of ports when there are hundreds at 100% in sectors with fighters. |
|
| Author: | ElderProphet [ Sun Feb 01, 2026 6:02 pm ] |
| Post subject: | Re: scripting with ChatGPT |
I hate to hear your scripts stopped working. I wonder if it is a TW change, or a TW Proxy change. Maybe try an older TW Proxy version and see. As for coding, I find Claude to be super capable. I'm sure you could include the script.html reference and point it to that, and it should script capably. I expect it will still need a human in the loop for debugging though. |
|
| Author: | klypto [ Mon Feb 09, 2026 3:26 am ] |
| Post subject: | Re: scripting with ChatGPT |
Any scripts out there for moving fighters from planet to sector or just buying down and deploying them to sector? |
|
| Author: | Grey Gamer [ Tue Sep 29, 2026 8:03 am ] |
| Post subject: | Re: scripting with ChatGPT |
ElderProphet wrote: I hate to hear your scripts stopped working. I wonder if it is a TW change, or a TW Proxy change. Maybe try an older TW Proxy version and see. As for coding, I find Claude to be super capable. I'm sure you could include the script.html reference and point it to that, and it should script capably. I expect it will still need a human in the loop for debugging though. I periodically go inactive, lose my empires, and when I find the time, I invade my old stuff, and straighten out everything. It's always a pain trying to figure out which TWX-Proxy file goes with which SWATH file. Right now, I have most of my active games named for the server and game letter--in SWATH, although I need to log out of the game to do so. I haven't tried to figure out TWX-Proxy yet. Usually, I just open as many copies of SWATH and TWX-Proxy as I want, open the most recent files in SWATH, and TWX-Proxy automatically opens the right ones, but when I returned the last time, and then after my PC froze, SWATH isn't automatically logging into a single game despite every game being set to automatically log in, and I ended up with multiple game files for the same game letter, but SWATH screamed my data was wrong, and then I didn't have files for other games, so I ended up resetting some, losing my game data. It's always complicated being me. In the games where I have fully-upgraded planets, someone blew up all of the ports, so I'm building new ones. In the games where there are still ports, I'm still upgrading my planets, so I don't know when I'll try those planetary traders again. I did finally find my old trader from over a decade ago, but don't have any idea where I put it. I also think that I wrote dozens of new versions trying out different things. Each change had a different file. At one time I had an LLM prompt which seemed to work fairly well, but the only scripting I've tried to do lately was just trying to tweak a public scouting script. Gemini keeps telling me it doesn't keep track of my conversations, but it used to (kind of)! ChatGPT and Clod sometimes seem okay, but I keep hitting their limits. For Clod, I might upgrade a script, ask for help, and it told me I was at the limit. I use LLMs far too much, but I struggle to organize, so I try to talk through my plans with them, and it's frustrating. I'll ask one a question, need to specify I'm discussing TW2002, and then need to tell it what TW2002 is. If I need to explain that much, what help can it possibly be? I know people pay to use LLMs, but I don't feel like I receive enough benefit from the free tier, I'm not convinced the paid one would be worthwhile. I have a poor memory, which makes everything difficult, but forgetting I asked LLMs about CBY, I did it again, and had another frustrating experience. |
|
| Author: | Grey Gamer [ Mon Oct 12, 2026 4:26 pm ] |
| Post subject: | Re: scripting with ChatGPT |
Sorry, I tend to use too many words. I feel like I'm good at figuring out a simpler way of rephrasing what other people say, but not what I want to say. I've tried to find a scouting\mower script for years. LoneStar's Unexplored Sector Scout v2.0 may work in one game, but not another. I think the first thing is it can't tell it is at the command prompt if ANSI is on. I'm not sure about the rest. I don't know how many times I've tried to write my own script, but I thought that if I just had a script send "nn" each time my route got interrupted, that would save me time and frustration. Well, there are often unexplored sectors, so "shnn." Whoever blew up all of the ports and left fighters everywhere also left mines, so I wanted it to send "*shnn." There were usually unexplored sectors at the destination and I wanted to leave fighters, so I figured out how to determine once I arrived (probably not the most effective method), and had it scan and drop fighters. When TWGS asked if I wanted to engage the transwarp, I had it respond "ney." Once that was stable, I wanted to read a list of destinations from a sector. I hadn't scripted in a while and at my best, I've never been great. I wasn't sure how to start that. I opened my last attempt, which used a file, but instead of figuring out the rest, I asked ChatGPT. This was infuriating. I also asked Gemini, Duck.ai, and Bing. Bing, the MySpace of search engines, was absolutely the worst. Honestly, for this, Duck.ai did the best, but it basically figured out one thing, and left me to my own devices. I finally logged into Claude for the first time since grad school. For my more complicated scripts or my research paper, it kept saying "I received it, but you're at your limit, so you need to pay if you want to do anything." Duck.ai kept telling me to start over, it hit its limit. Claude said several of the same things other LLMs said, but it didn't hallucinate anything. It spent far longer responding, but its suggestions were great, and after wasting hours with other LLMs, I finally had it working. It ran until I encountered a Ferrengi, I added a routine for that, and it ran until I ran low on fighters. I reloaded a few times and each time, it ran until I ran low on fighters. It seems like I finally have a functional explorer\mower. I asked it to add a feature to a script I wrote and it gave me something which looked viable, but I don't think I have any games where I can test it. I had it look at LoneStar's scout and it replied: Quote: I read it rather than ran it, so these are conclusions from the code, not test results. **What it is:** A fast explorer. It plots a path with the computer, builds one long keystroke macro (move, attack, drop a fighter, holo-scan where needed), and sends it in one go. After about 60% explored it switches to TransWarp hops to the nearest known fighter. The design is clever and it fails safe: if you don't end up at the destination or you're under 1,000 fighters, it halts rather than carrying on blind. **Likely bugs, most serious first** 1. **`:Read_Computer` looks like it loops forever.** `setVar $columnCount 0` sits *after* the `:grab_secs` label, so every pass resets the column to 1 and re-reads the same word. `add $Target_CNT 1` also runs before the validity check. This runs at the end of every run (Pass 2) and when it starts at 100% explored. A fix: ``` setVar $columnCount 1 :grab_secs getWord CURRENTLINE $sektor $columnCount if (($sektor > 0) AND ($sektor <= SECTORS)) add $Target_CNT 1 setVar $Targets[$Target_CNT] $sektor add $columnCount 1 goto :grab_secs end ``` 2. **The Pass 1 rebuild writes `$Targets[0]`.** `$Target_CNT` starts at 0 there, and I believe TWX arrays are 1-based, so that either errors or silently drops the first target. Start it at 1 and subtract afterward, as the initial build does. 3. **Backwards mode drops one target.** The copy loop uses `< $Target_CNT` instead of `<=`. The pass logic probably papers over it. 4. **Zero targets reports one.** `$Target_CNT` starts at 1 and only gets decremented if it's above 1. 5. **`$hops` isn't a depth.** The breadth-first loops count dequeued sectors, not levels, so "40 hops" means about 40 sectors examined. The nearest-fighter and nearest-unexplored searches give up much earlier than the comment suggests. **Behavior to know about** - **`:CN_Check` changes your game settings and never restores them.** It turns off animation, screen pauses and Online Auto Flee, and sets message and abort-key modes. If you run other scripts, those changes persist. - **It never writes the fighter file.** `$FIGS` is read at startup and lives only in memory, so some other tool has to maintain `_MOM_<game>.figs`. - **It's blind-macro driven**, the same desync class you fought earlier. Nothing handles the Ferrengi "Choose your action" prompt, and an interruption mid-macro gets caught only afterward by the `$CURRENT_SECTOR <> $destination` halt. Your 60-second keepalive Escape could land in the middle of a macro, so I'd disable it while this runs. - **Pre-queued keys.** It sends `Z A <fighters>*` in every sector over 10. I don't know exactly what those do when no fighters are present, so test somewhere safe before trusting it with a big ship. **Cosmetic:** The header says 75% for the TransWarp switch but the code uses 60. It lists 1M credits as required, but that check is commented out. The time estimate hardcodes a 2.2 GHz clock, so "Minutes Left" is wrong on other machines. `Corbo` in `:quikstats` should be `Crbo` (your stat line says `Crbo`), but nothing uses it. **Fit for your ship:** You meet its requirements (TWarp 2, Holo, 118k fighters, no photons), and it only buys fuel, so your low credits are fine. I'd fix items 1 and 2 before running it, since the first would hang the end of a run. Want me to write the patched `:Read_Computer` and rebuild block in full? |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|