chiark / gitweb /
Massively improved /officer cmd handling
[ypp-sc-tools.main.git] / yoweb-scrape.txt
1 Ian Jackson writes ("Choice of vessel for pillaging"):
2 > What I really want is something that redacts it into a table (ideally,
3 > by trawling the chat log).  I don't suppose someone fancies writing
4 > the yoweb screenscraper :-) ?
5
6 Here it is.  You run it like this:
7   ./yoweb-scrape ship-aid ~/yohoho/Aristarchus_midnight_chat-log-iwj 
8 It has various other modes - see the usage message.
9
10 Key features:
11
12  * Tracks boarding and departure of pirates and shows a table
13    of currently-aboard pirates with their relevant puzzle standings in
14    a compressed format.
15
16  * Shows time and nature their last interaction with you as XO
17    (abandoning stations, being given orders) and where and when their
18    last to-you-visible chat was.
19
20  * Remembers whether you have ever given the pirate an order to gun
21    since they boarded.
22
23  * Caches and severely rate-limits fetches from yoweb to avoid
24    overloading the Three Rings servers.  In ship-aid mode, will
25    display twirling batons while you wait for data, so that crew
26    on board info remains correct.
27
28 I know of one key defect:
29
30  * If you leave and then reboard a vessel, the list of pirates on
31    board may be wrong.  This is because the chat log doesn't contain
32    the necessary information.  The script assumes that the set of
33    pirates on board doesn't change while you're off the ship (unless
34    you're away for more than an hour, in which case it assumes the
35    ship is empty when you return to it).
36
37    This means that there needs to be a way to manually add and remove
38    pirates.  This is as follows: send or receive a message on the crew
39    officer chat, or send (not receive!) a private message, of the
40    following format:
41          /a <pirate>...                 /d <pirate>...
42          /a <ship>: <pirate>...         /d <ship>: <pirate>...
43    <pirate> and <ship> can be in any case and will be converted to
44    the proper mixed-case form automatically.  <ship>, if it is not
45    provided, will be assumed to be the one you're on (so officers
46    shouldn't send these runes unless only one ship is out).  If <ship>
47    is supplied it may match the full ship name, or only the second
48    word.  You can put `*'s in <ship> which will match anything.
49
50    For example:
51          /a haddock: aiah
52          /d aiah
53          /a smart sunfish: copperkatie
54          /a s* sunfish: anaplian
55    These are actually sent by typing in the chat box things like:
56          /o /d plonker
57          /off /a hypiscles
58    since other formulations interpret the scraper command as a YPP
59    chat command.  This is deliberate and makes it harder to invoke by
60    mistake.
61
62    These messages can also be sent by some other officer in your crew
63    while you are off the vessel (although currently a bug means that
64    if you board some _other_ vessel then these messages for the vessel
65    you come back to may not be properly recorded).
66
67    The program will notice that a pirate is on board if you give them
68    a stationing order or they abandon a duty station (in circumstances
69    where the game reports this in the log, which doesn't seem to be
70    all the time), and from many of the other messages that occur.
71
72    Matching for ship patterns in /a and /d commands picks the first
73    of the following which applies and is not contradicted by any
74    name or partial name specified in the command:
75       - The ship we think the person telling us is on board
76       - The ship we think we are on board
77       - Any other ship we know about, if at least a something was
78          specified, and provided that is not ambiguous
79       - The specific ship name if it is completely specified,
80          possibly recording this as a new ship
81
82 Other things to mention:
83
84  * There's nothing really resembling a manual.
85
86  * It doesn't notice when you yourself disembark.  That's because
87    that's not recorded in the chat log.
88
89  * Many people may find the output rather basic - it's ASCII art - and
90    it's not very customisable.
91
92  * It spends a while reading the whole of your chat log which can be
93    very long.  Perhaps it should be smarter (eg, bisect the log
94    to find `nearly now').
95
96  * It could have lots more features in general.
97
98  * The `tabulate details of my whole crew' mode takes a long time
99    to run.  This is normal; it's trying to spread the load on yoweb
100    (perhaps excessively so).
101
102  * I have it in git right now but here is just a copy of the single
103    file which is the script.  I'm planning to put my rum calculator
104    and other useful things into the same repo and put it on chiark
105    somewhere.  For my reference, this is from tree revision
106      15799130f8d34856b9cefe3c71103564413fa04a
107
108  * I haven't decided on a final copyright licence.  You may treat this
109    version as GPLv3.
110
111  * The program will become confused when the clocks change,
112    particularly when they go backwards.  This is due to the chat log
113    containing timestamps in local time without a timezone.  If this
114    bothers you, make everything be in UTC.  If it does get confused,
115    you can fix it by logging off and logging on again (perhaps waiting
116    until after the duplicated hour has passed) as that writes a new
117    date record to the log and starts a new series of timestamps.
118
119  * You have to enable the chat log for the ship-aid mode.
120
121 Ian.
122
123
124
125 Ian Jackson writes ("Re: Choice of vessel for pillaging"):
126 > Ian Jackson writes ("Choice of vessel for pillaging"):
127 > > What I really want is something that redacts it into a table (ideally,
128 > > by trawling the chat log).  I don't suppose someone fancies writing
129 > > the yoweb screenscraper :-) ?
130
131 > Here it is.  You run it like this:
132 >   ./yoweb-scrape ship-aid ~/yohoho/Aristarchus_midnight_chat-log-iwj 
133 > It has various other modes - see the usage message.
134
135 A couple more things:
136
137  * Please don't leave it running if you're not in charge.  If
138    everyone runs this it will produce precisely the load on the yoweb
139    servers that we want to avoid.
140  * It's Python so it may eat CPU and memory.
141  * You may need to install some python modules of course.
142  * Here's a version which is an attachment rather than asking you
143    to cut-and-paste.  That will save on you mangling it and getting
144    weird python errors.
145
146 Ian.
147
148 yoweb-scrape as a binary blobule, y [Press RETURN to save to a file]