|
Here you find scripts for PCC. Each script contains some more or less useful function. Generally, you should load the script into PCC with the Load command from your autoexec.q file. Then, some new commands will be available on the console. If you have written a useful script, you can submit it to me (Streu@gmx.de) and I will place it here. If you modify and improve a script, I'd like to hear from you, too. You can also download all scripts at once: ccscripts.zip (41k). Note: some scripts may only run on a recent PCC version; not all contain an appropriate notice. Note 2: Scripts can do almost anything to your game which is permitted by the rules. Especially for "global action"-style scripts, you should have an idea how it works before letting it go on live game data.
auto.q - Auto TasksSome useful auto tasks I use. Feel free to add more and/or improve the existing ones. Needs PCC 1.1.2 or later. autoexec.q - Stefan's Autoexec ScriptThis is my actual autoexec script, for your inspiration. Version: February 2005. --Stefan Reuther bum.q - Cloaked Ship Detection using `bum'/`btm'First attempt to detect (cloaked) ships. If a cloaked ship orbits your planet, and your have the FCode set to `bum', the cloaked ship will receive your money, and you'll know that there was a cloaked ship (because the money is gone). This also works with ships and `btm'. This is a (simple) attempt of doing this in a script. To use,
History:
Needs PCC 1.0.18 or higher. cargo.q - Cargo Transfer `Macros'This script contains some small `macros' for cargo transfer. See the source code for comments on how to use them. checker.q - Simple Turn CheckerLoad your game into PCC and use the command `Check' to locate
(possible) errors in your turn. They'll be reported to the console.
What to be an error worth reporting can be configured with the
`Check.WarnLevel' variable; with `Check.Correct' set, this
program will also attempt to fix some of the errors. The preferred
way to set those variables is by placing appropriate assignment
statements in your autoexec script:
To check only a single object, go to its control screen and do `RunHook CheckShip' or `RunHook CheckPlanet', respectively. To add your own checks, write appropriate subroutines and make them known to the checker framework using `On CheckShip Do...' etc. comment.q - Comment TimestampsThis module provides comment timestamps. It attaches a marker of the form "|T:<turn number>" to every comment you change. For example, I often write to my ships what they're doing: "get fuel", "bring clans". Sometimes I forget clearing the comment after performing that task. This module brings a reminder -- when the comment is too old, it is probably stale. Hacked together on a snowy 24th of March 2002 by Stefan Reuther. Needs PCC 1.0.17 or later. explmap.q - Explore map trackerThis script is supposed to keep tracking on newly scanned planets with the add-on ExploreMap With ExploreMap players receive each turn a new XYplan.dat storing old and new planets. New planets occur based on the scanner settings in EploreMap and can be tricky to follow. The script verifies for each planet if a special property-tag from a former turn exists. If not (this means the planet was detected in the current turn) explmap adds a marker (green cactus) to the starmap for at least one turn. Additionally, a message box will inform the player how many new planets have been scanned. [18/Nov/2006: Tom Wuerzer] fborg.q - Show Hyperjump Routes ending at a Planet (including 3 Ly square GravityWell)Best use: press "b" and "Ctrl-b" in the StarChart to draw HyperJump routes into the Map or delete them fixtow.q - PCC Sample Script -- Fix ToweesTo try this function:
Alternatively, do `cc GAME PLAYER /rk Load "fixtow.q"' goto.q - Go to object - quicklyThis module provides functions to quickly go to particular objects by id, in the form of convenient short wrappers around `UI.GotoScreen'. For fast typists, this is much faster than the conventional way (using the search function or manual browsing).
Each function takes an argument, which it will try to use as an ID. If the argument is a string, then the functions search for the first ship or planet with that string in its name, preferably yours. hidename.q - Hide Ship NamesThis script will name ships using boring fake names. You can use this in anonymous games to avoid that enemies recognize you (as a person) by your ship naming style. Fake names will be made up of a prefix (`hn.Prefix') followed by several random digits. Outside PCC, only these fake names will be seen. To use this, simply load it from your gameinit/autoexec file. The rest is automatic. Like all automatisms, this one's dangerous: WARNING: if you load your turn with scrambled names, and your invoke PCC 1.0.14 or before without this script loaded, the original names will be lost! For a safer, semi-automatic version, use Manuel's `scr-s-o.q'. To stop this and restore the normal names, do the following:
History:
load.q - Load Minerals for Fighter / Torpedo BuildingThis provides a ship command `LoadForBuild' that will load the amount of minerals for building that ship's ammunition. You'll be prompted for the number of torps/fighters you want. The input line will be pre-initialized with the maximum number this script thinks is possible. Enter the desired amount and hit Enter.
Needs PCC 1.0.18 or above. marker.q - Display Markers at Current PositionThis will list all markers (with comment) from the current position in a list box. In particular, it will list all ships that exploded at a certain place. Just choose that place at the starchart and press Ctrl-L. Hacked together by Stefan Reuther, after a request by Lucas di Pentima, on 01/Oct/2002. Needs PCC 1.1.1 for the Listbox() construct. move.q - Advanced "MoveTo" commandUse these until we have a graphical "auto waypoint" editor:
These commands are to be entered at the console. For example,
nextturn.q - PCC Sample Script -- What will I have here next turn?To try this function:
Known problem: if ship A tows ship B, and both have their waypoint set to "here", B's cargo will be counted twice. A possible solution would be a helper property "this ship already counted". 22/Feb/2001 Native taxes fixed; added some comments. plist.q - PList support for PCCHullgen generates the short hull names for a given ship list. This module sets the short names for the other starship components, from PList (2.31b if anyone cares). Load it from autoexec.q/gameinit.q. (Except for someone who tells it the short names, PCC does not need other special support for nonstandard ship lists) Requires at least PCC 1.0.18. psmap.q - Experimental PostScript Map PrinterThis generates a postscript map from the current game data. You can then print that map on a normal PostScript printer. The PS output is almost readable so you can adjust it if you wish. Usage: call `ps.Print'. This will ask you for an extent and a file name. It will print the requested region around the current position in the map/control screen. To print the whole map, go to the map center and use the Extent you also configured in the chart options. 13/Oct/2002 by Stefan Reuther revive.q - Revive PCCThis script attempts to save and restore the current status of PCC between sessions. Hence you can exit PCC, do something else, and when you start PCC again, you'll be where you left off last time. In addition, this script provides a hook "NewTurn" which is run when a new turn has started. This script is far from complete. Usage: put `Load "revive.q"' in your autoexec/gameinit script. The rest is automatic. By default, this will also load the saved status when the turn number changed. If you don't want it to do that, do `Revive.LoadOldTurn := False' after the load instruction. History:
Note 15/Feb/2005: the NewTurn hook is now provided by the PCC core. You do no longer need this module to use that hook. However, PCC's core.q contains provisions that these two do not interfere (it makes sure the hook is called only once during each load). savehost.q - Save Game as Host DataThis saves your turn as host data. You can then run host.exe on it. It attempts to restore as much as possible of the original data. Of course, this is not always possible: missing information is guessed (minerals on enemy planets, fcodes) or set to zero (enemy ship cargo). This code is ALPHA, read, it worked correctly on the test data set I tested it on, and Host 3.22.020 / PHost 3.3d no longer complains. Usage: either, run this on the command line using PCC or CCS:
Right now, this can only read one player's data. If you have multiple RSTs, it would be nice to merge them, but right now this is not completely possible. For planets, PCC's history does a pretty decent job, but for ships and bases, we can't currently help. This script requires PCC 1.0.14 or later. File I/O has bugs in 1.0.13 which crash PCC. This is also a neat benchmark & crash test for PCC ;) Author: Stefan Reuther <Streu@gmx.de>
savemark.q - Save current map markersThis script generates another script that can be used to regenerate your current map drawings. One example use is sharing these drawings with a friend, or transferring them from one game to another. Instructions:
On the receiving end, run the script you just generated using Alt-R. You will now have the old drawings here, too. January 2006 by Stefan Reuther scr-s-f.q - Scramble Ships Names Off, restore the original namesAuthor: Manuel Fernandes Alonso
Run this after unpack the trn and prior other utilities scr-s-o.q - Scramble Ships Names On, generating and random nameRun this script before the last maketurn. This will scramble the ship names, saving the original names to a file. To unscramble them again, use `scr-s-f.q'. Author: Manuel Fernandes Alonso
shadow.q - Shadow (former Hide Ship Names)NEW ABILITY: individual fakenames Set your own fake names for ships to get your enemy confused. if the ShadowName is empty, the normal script of hidename will take control shipnames, for the case you just forget one new build ship to set in Shadowmode ;-)) This script will name ships using boring fake names. You can use this in anonymous games to avoid that enemies recognize you (as a person) by your ship naming style. Fake names will be made up of a prefix (`hn.Prefix') followed by several random digits. Outside PCC, only these fake names will be seen. To use this, simply load it from your gameinit/autoexec file. The rest is automatic. Like all automatisms, this one's dangerous: WARNING: if you load your turn with scrambled names, and your invoke PCC 1.0.14 or before without this script loaded, the original names will be lost! For a safer, semi-automatic version, use Manuel's `scr-s-o.q'. To stop this and restore the normal names, do the following:
History:
starbase.q - Starbase Building
Note: This script uses TaxYield from Taxes.q Author: Eric Wald
swapf4.q - Swap F4 and ESC in Control ScreensSome people like it better if [ESC] gets to the map, not to the race screen. This script swaps [ESC] and [F4] on control screens. Usage: simply put `Load "swapf4.q"' in your autoexec.q. target.q - TARGETx.DAT I/OThis (silly?) script creates TARGETx.DAT files. Note that this does not directly affect display in PCC.
Possible uses:
(note that in the above examples, `dir' should be `System.GameDirectory'). taxes.q - Taxation Scripts
Author: Eric Wald
tty.q - PCC on a TTY (text console)This module provides a text console for PCC. Basically, it shows a
prompt and lets you enter commands. You can enter as many commands as
you wish, confirm each one with [Enter]. [ESC] exits the console. So,
if you want to run PCC on the command line, do
In addition, this module provides a few commands that are useful on the console. In GUI mode, you should use the GUI equivalent, so there's no point in loading this file into the GUI.
In addition, the following shortcuts exist:
This module requires PCC 1.0.19. Older PCCs do not support input in text mode.
This script uses only variables named `tty.XXX' to avoid clashes with user variables. Todo: some sort of input history, with `bang' commands, would be nice. Somehow like in csh/bash. vis.q - Visualize Stuff, EchoView-likeThis is a simple attempt of implementing something similar to EchoView's visualisation feature for PCC. The basic principle: you enter an expression yielding a number, and PCC displays bars of appropriate size at every planet/ship. PCC already has something similar built in (object labels). There are 4 "layers" of visualisation, the appropriate bars are displayed in northeast, northwest, southwest and southeast of the labelled object. The main entry point is `Visualize'; it'll prompt for necessary parameters. Although not required by the rest of the code, the user interface fixes the ranges at 100..10000, that is, a value less than 100 will not be displayed; values larger than 10000 will yield a maximum-size bar (40 pixels, vis.Height). Besides being useful, this script demonstrates some funky uses of the `Eval' statement ;-)
Author: January 2002 by Stefan Reuther Needs PCC 1.0.16 (older ones don't have Eval). wpmove.q - Modeless Waypoint MovingThis allows you to move the waypoint of a ship in the ship screen without explicitly entering scanner-move mode or such. Arrows move by 10 ly, Ctrl-Arrows move by 100 ly (or prefix argument); Ctrl-Enter locks onto next planet. The script integration of PCC is not yet perfect, as you can see with this script: when you are locked at a ship in the starchart and hit Shift-Arrow, it'll move 10 ly (because our routine is called and can not tell apart Shift-Arrow from just Arrow). In older PCC versions (below 1.0.19) it is even worse. PCC II will be better. I promise :-)
This page has been generated automatically from the script headers. |