41 lines
2.5 KiB
Markdown
41 lines
2.5 KiB
Markdown
# L2 UI harness — driving the SOTS strategy map from outside the guest
|
|
|
|
Written for lane L2's multiplayer-combat run on VM141. It is lane W2's `C:\SOTS\w2\ui.ps1` plus the
|
|
two things that run needed and W2's version could not do.
|
|
|
|
## What is different from W2's `ui.ps1`
|
|
|
|
1. **Real mouse motion.** `SetCursorPos` alone does **not** move the game's cursor as far as the
|
|
starmap is concerned — the move-mode arrow and the destination tooltip never update, and clicks
|
|
land on stale hit-test state. Every `move` and `click` here warps with `SetCursorPos` and then
|
|
emits an actual `mouse_event(MOUSEEVENTF_MOVE, …)` relative jiggle. Without this you can drive
|
|
fixed-position buttons (which is all W2 needed) but you cannot drive the map.
|
|
2. **`wheel <x> <y> <notches>`** — starmap zoom, via `mouse_event(MOUSEEVENTF_WHEEL)`. System banners
|
|
overlap and hide each other's stars at default zoom; you have to zoom in before you can click a
|
|
star.
|
|
3. `rclick` and `dbl`.
|
|
|
|
Commands, one per line, read from `C:\SOTS\l2\cmd.txt`:
|
|
`fg | move X Y | click X Y | rclick X Y | dbl X Y | wheel X Y N | key <SendKeys> | type <text> | sleep ms`
|
|
|
|
The target process id is read from `C:\SOTS\l2\pid.txt` (or `-1` for "do not foreground anything",
|
|
which is how a firewall or UAC dialog gets clicked). Run it from an **interactive** scheduled task
|
|
with `LogonType=InteractiveToken`; a process started straight from an SSH session lands in a
|
|
different window station and cannot click anything.
|
|
|
|
## Gotchas that cost this lane a run each
|
|
|
|
- **Move mode does not survive between invocations.** "Select fleet → press Move → click the
|
|
destination" has to be one `cmd.txt`, not three.
|
|
- **The banner is not the star.** Banners sit up-left of their star with a short leader stem, and a
|
|
neighbouring banner will cover the star. Clicking the banner does nothing; so does clicking where
|
|
the hover tooltip is drawn. Zoom in until they separate, then click the star.
|
|
- **A modal dialog silently eats an unattended turn loop.** Screenshot and check before each blind
|
|
click; a "plot a sublight course?" dialog swallowed four end-turn cycles without the turn moving.
|
|
|
|
## Files
|
|
|
|
- `ui.ps1` — the driver. Deploy to `C:\SOTS\l2\ui.ps1` and register a task pointing at it.
|
|
- `socks.ps1` — non-perturbing socket-table probe: which SOTS pid holds which UDP/TCP port, now.
|
|
- `launch-b.cmd` — second-instance launcher; reads its argument line from `C:\SOTS\w2\argsB.txt`.
|
|
`C:\SOTS\w2\sotsb.xml` invokes this path but the file itself is **not** on the VM140 image.
|