[Last Update: June/01/2010]
Here's a starcraft script...to play around with.. hopefully someone out there gets inspired to add to it..
I once wrote a very elaborate script for SC but lost the code.. I was just wishing that I'd posted it here so I'd have a copy again..
recently I powered up SC and was goofing off a little and decided to make another one just for kicks... I rewrote the most useful functions from the original.
********** MICRO MANAGEMENT HOTKEYS **********
Mass spell casting.. Ever wish you could just grab a group of units and then cycle through them 1 by 1 to cast spells? This macro will do that for you...it lets you do massive multi lock downs, multi psi storms, irradiate, matrix's, yamatos, mineral assignments, etc...
Mouse wheel up: Assigns all selected units to a group (Uses hotkey #7 ), then selects the first unit for use.
Mouse wheel down: Selects next unit of the group.
This is great for performing mass micro tasks like.. massive spell casts, lockdowns or massive psi storms.. It auto cycles through the whole group then loops over and starts again at unit 1, if any units die then the group is automatically reduced to the new count.
It can also be used for placing hatches, or units to mineral patches, is great for fast money maps where you need to send 3 units to gas, for example.
1. Select a group of 12 workers.
2. Push the wheel forward to assign them to a group, the script will auto select the first unit.
3. right click the gas.
4. pull the wheel back.
5. right click on the gas.
6. pull the wheel back.
7. right click on the gas.
You can rapidly execute up to 24 spells, for example, to perform mass lockdowns...
1. Select a group of 12 ghosts (ctrl click a ghost)
2. mouse wheel forward to assign all ghosts to the group, a single ghost will be selected.
3. [L]ockdown an enemy.
4. mouse wheel backwards to select the next unit.
5. [L] lock down the next unit.
6. mouse wheel backwards for next ghost.. etc.
'P'ylon short cut key. Allows you to use a single keystroke to place a pylon, without needing the B key, speeds up your initial base setup.
'G'ate short cut key. Allows you to use a single keystroke to place a gate.
'F'orge short cut key. Allows you to use a single keystroke to place a forge when protoss.
'C'annon short cut key. Allows you to use a single keystroke to place a cannon when protoss.
sound up/down Sets latency settings to high / low. In theory, handy if right before the battle you expect lots of micro and need accuracy, during initial game you set to extra high, then just before you need to throw lots of psi storms and lockdowns you hit low latency and attack.
pause keya pause short cut
[`] key.. performs a clone command, good for assigning workers to minerals on low money maps.. just select all units then hit the [`] key over each mineral patch, for the perfect split. You can use the same idea to spread units out and send multi units to scout. There's many uses.
********** MASS ATTACK MACROS **********
CTRL numpad keys
The script has predefined a number of hot spots around the map, and you can attack them quickly by using the keys of the Numpad. You can also create a dynamic hotpoint and assign it to the numpad[0] key. You can use this to rapidly attack multiple points on the map, to retreat rapidly to home base, assist an ally, or mass attack a single point.
Code:
(10) (12) (2)
\ | /
[7][8][9]
(9)--[4][5][6]--(3)
[1][2][3]
/ | \
(7) (6) (5)
.. this is especially nasty when zerg, although it works with any race, for example, to use it effectively...
1. CTRL click a unit to group them
2. press CTRL numpad 8 to attack the 12oclock position.. cntrl-5 for mid map, etc..
You can send an insane amount of units very quickly across the map.
3. CTRL click a different type of unit, hydras then lings for example...
4. Press CTRL numpad to attack position.
5. CTRL click larvae, then click icon to train new units
6. CTRL click lords, then move them off map.
7. CTRL+H / CTRL+Z initiates mass build sequences.... (see mass train)
8. CTRL+ {Rbutton} sets a global Attack Hotpoint and makes it active on numpad 0
9. CTRL+A activates all assigned hotkey groups to attack the Hotpoint.
CTRL R-Click Assigns a global attack hot point, for the other automated functions to use. Lets say you set the point in the heart of the enemy base first by right clicking in the mini map, and then....
CTRL numpad 0 CTRL r-click in the minimap and you will setup an attack point that will be assigned to numpad 0. It almost makes the other numpad keys obsolete. just select a group and hit numpad 0 and it will attack your hotspot.
CTRL A / ALT-A Tells all hotkey groups to attack the hotspot at once. This is a really evil mass attack option..
1. Assign all your armies to hotkeyed groups,
2. CTRL+ R-click in the minimap to set the hot point.
3. Now hit CTRL-A and all the groups attacks at once or retreats at once, it will look like your whole army is moving as 1 group.
********** BASE MANAGEMENT MACROS **********
A trick to manage your base more easily is to use the F2,F3,F4 keys to create work areas. You assign F2 to the mineral area, F3 to the military production area, and F3 to the upgrades area, then you can jump to each area rapidly by using the Function keys and effectively do 3 things at once, you're never behind on upgrades when you do this and you can reassign the work areas as the game progresses. To assist with this idea...
Tab ignores the minimap toggle and cycles through the SHIFT F2, F3, F4 assigned locations.. Now you can hit tab or Mbutton to check minerals then army production then upgrades locations. note that the normal behaviour of F1,f2,f3,f4 have been replaced with other functions in this script, but you can still assign the locations by using the shift+f2/f3/f4 keys, its just that to bring them up you need to use the tab key which cycles through them, this is more efficient and easier to manage.
F5 = roller ball building control This is a shortcut that lets you set a default building for the F5 key. For example, have you ever got confused about which hotkey to use to create a gas mine?
1. Select a worker,
2. click F5,
3. Use the roller ball to change the default building for F5 to extractor/assimilator/refinary.
4. the next time you hit F5 it will be pre-ready to build a gas extractor.
When used in conjunction with the other mouse roller functions, to build mass buildings.. for example a zerg that needs to make 8 hatches..
1. Ctrl click drones.
2. push mouse roller forward to assign group
3. Hit F5
4. push mouse roller to set to hatch.
5. place the building
6. pull back on the mouse roller.
7. Hit F5
8. place the next hatch..
9 repeat from step 6...
[f8] Tries to perform upgrades universally with 1 key. Ever click on a building and scratch your head trying to remember the correct hotkey for the upgrade, this key does the guess work for you...
1. Click an upgrade building.
2. Click f8..
[f9] universal depot key. Makes a depot / pylon / overlord.
[f10] universal miltary building key. barracks / gate / hatch
[f11] universal extractor / gas key refinary / assimilator / extractor
[f12] universal main building key. Command Center/ nexus / hatch
********** MASS TRAINING MACROS **********
Introducing Zones....
Zones are areas that you can jump to by using the ALT+number keys, and just like the standard F2 - F3 - F4 keys allow you to navigate multiple work areas of focus, but with some key differences.
Zones can have a sequence of buildings assigned to them, which can then have macro sequences executed on them, like you can tell all buildings in the zone to rally to the global rally point, or mass train.
you can assign/unassign zones by using the SHIFT+number keys, and recall the zones using the ALT+number keys. You can also cycle through the zones using the [<] [>] keys and by using the [CTRL+Mbutton].
For example when used with the mass attack macros, you can do things like this..
1. Align your screen position to see as many buildings as possible.
2. Press Shift 1 to assign zone 1.
3. You have 2 seconds now to shift R-click on buildings, each click will assign a building to the zone.
4. Pause 2 seconds and a message 'record mode off' will appear. The building assignment phase is now over. If you have messed up you'll need to press shift 1 again to unassign the zone and then again to reassign it.
5. Align your screen position to see another group of buildings
6. Press shift 2 to assign zone 2.
7. you have 2 seconds to assign buildings by using shift+Rclicks.
8. pause 2 seconds for the 'record mode off' message.
9. CTRL Mbutton will move between zones.. or press the [<] and [>] keys to switch zones.
10. Select a building and press F3 and the building will produce a unit.
11. Press CTRL F3 and all the buildings of the currently active zone will produce units. Note that it doesnt matter where on the map you press CTRL F3, as the script will move to the zone, perform the commands and then return to your original position.
12. Press CTRL Mbutton to switch zones.
13. Press CTRL F3 and the other group of buildings will go to work.
Assigning and recalling zones....
SHIFT+0..9 keys, To assign zone 1, hit shift+1 then you have 2 seconds to assign the buildings. Use shift and Rclick to assign the buildings. Press shift+1 again and the zone will be removed and the building count reset.
ALT+0..9 keys, Will recall the zone and locate it on your screen, and inform you of the number of assigned buildings in the zone.
ALT {R-button} in minimap sets a global rally point This can be used to assign rally points to buildings individually or to a whole zone. Now ALT+{Lbutton} on a building and it will automatically set that rally point to the building. Or CTRL+R will assign rally points very quickly for all the buildings in the zone. This can be handy for directing your armies into a choke point, into the map center, or into an enemy base.
CTL-R rally all buildings in the zone to the global rally point that you created with your ALT+{Rbutton} click in the mini map.
The Basic Training macros... F1 ... F4 on their own will train a single unit, while the CTTL+F1 ... CTRL+F4 will execute mass build sequences on a zone. You can also try the unit hotkey, like CTRL+H will mass build hydras while you are zerg or CTRL+Z will mass zealots or zerglings, etc..
F1 Train A default Unit - a universal key for default units, just click the building and hit F1 and if it is an upgrade it will be triggered, if a barracks it will make marines, a command center scvs', etc. the script will remember the last unit you tried to make and use that as the default, so you can switch from mellee to ranged units.
F2 train base military unit - a universal key for attacking units.. terran makes marines, zerg=zerglings, protoss=zealots
F3 train secondary miltary unit - terran makes tanks, protoss=dragoons,zerg=hydra
F4 train support unit - goliath/ghost/battle cruiser/templar/overlord.
CTRL+F1 Mass Train default units - checks all queued buildings to see if they can make workers, and tries to make workers, or military units, or upgrades. the script remembers the last unit you tried to make and uses that as a default, so you can switch between mellee and ranged units.
CTRL+F2 Mass Train base military unit - a universal key for attacking units.. terran makes marines, zerg=zerglings, protoss=zealots
CTRL+F3 Mass Train secondary miltary unit - terran makes tanks, protoss=dragoons,zerg=hydra
CTRL+F4 Mass Train support unit - goliath/ghost/battle cruiser/templar/overlord.
CTRL H mass build hydras
CTRL+H / M / T / G / Z / W / O / D / S ctrl key + hotkey will mass build hydra,muta,marines, tanks, templar, ghost, goliaths,dragoons,zealots,zerglings,overlords,etc..
Mbutton on it's own, will cycle through the activated hotkeyed units and automatically trigger work on them, for example.. hotkey a command center, 2 workers, 2 barracks and an engineering bay, and then cycle through them with the Mbutton, the script will automatically produce workers and marines, and check the upgrades on the ebay, and pass control between your 2 workers and the buildings.
In the original I had a lot of auto stuff, a lot of setTimer functions, image and pixel scans, and arrays for tracking building and minimap locations.
to be honest though, although those things were cool to mess with, they werent often practical because timed interuptions will really screw you up, so I found that the current set of macros here, were the most often used.
The best I ever managed to get out of it, was about 20 actions per second...
You might still need to edit the F8 key here.. I havent rigorously tested the hotkey lists under all races...
Version notes ...
V1.1b
- Modified ^f1 to build default units
- added %lastUnit% to remember last unit as the default unit -allows auto train functions to switch from mellee to ranged units by hitting the units training hotkey.
- added auto upgrade to ^f1,^f2^f3^f4 hotkey sequences, if notRally()=true then assume to be a building requiring upgrades.
- added option to cycle hotkeys 0..9 via the Mbutton
- Hotkeyed buildings will autobuild and auto upgrade if in the mbutton cycle
- patched F8's protoss and terran upgrade options
- CTL Mbutton rotates zones
- MButton rotates the hotkeys
- rearranged code so that functions are in alphabetical order.
- added / to the start of messages so in event of failure they wont flash bogus messages to your allies.
v1.2b
-patched the mouse forward to debounce a little.. slowing it down to stop accidental assignments
- you now dont need to hold CTRL (its optional) to get the numpad buttons to work, and numlock is ignored.
V1.3b
-Patched the pixel search functions for unit count and race detection, to allow for gamma variance.
For the code.. see the post below...