I guess you can do whatever you want with this little demo. If all goes well this show names thing will be one of functions of InSim helper program I'm currently working on.
I noticed that ViewPLID in STA packet shows some (random?) other player's ID when you go to pits (shift + P). Shouldn't it be in this case zero = none?
Hmm after some thinking, this automatic system isn't perhaps that good, or so to say future compatible. Suppose one day you want to make LFS UI fully configurable. Which is quite likely I guess. Or just rearrange screens. In this case "recommended area" has no meaning any more.
Anyway, simplest solution is perhaps clear screen completely on shift+B/I, if InSim program requests that (with BFN?). Plus possibility to make "always on" buttons, which would be then treated as part of LFS interface. Simple, but quite flexible.
That would be nice. For space clearing maybe BFN packet could be used, with commands like "clear space", "unclear space", "make this ClickID always visible/not affecting space clearing", etc.
And few questions...
I noticed that buttons don't work at all in MPR replay. Is that intentional or not done yet?
Is it somehow possible to use on buttons those seven-segment numbers LFS uses to display times?
Here's a little toy to test the new button interface.
Put this exe into main LFS directory, then type into LFS commands:
/insim 29999
/exec names
or
/exec names localhost 29999 <password>
if you have admin password set.
Now when switching view to other cars with TAB key, player name is shown on top of screen.
Say I want to just add one small button to race setup screen... then disappearing LFS buttons seems kinda weird. Why not make disappearing LFS buttons optional, controlled by InSim in some way? Could be special TINY packet. BStyle in BTN is already all used... Maybe Instance could be removed and BStyle made a word?
And to make this post more useful, little suggestion not related to buttons: CNL packet could have reason for disconnect, normal/connection lost/kick/ban(/something else possible?).
I create 60 buttons (as on picture - players list), and it takes somewhere between 1.2 - 1.5 sec. That's quite slow.
Also I think 79 (if I'm not mistaken) local buttons is not enough, for example for creating some bigger tables with many columns. Why there has to be two separate ClickID ranges anyway?
Aha. There's few more of those "PlyNum" thingies I think, in camera control packets. And as for colour codes, I guess better is to put them back. For example, one of possibilities with buttons is full message history, but that wouldn't look right without colours.
Tried to make use of ViewPlayer in STA packet, but to my surprise it's not player's unique id. That "Player index of viewed car" is kinda useless, as seems like it doesn't relate directly to any other data received from LFS. Also this number can change, while viewed car itself doesn't. Quite confusing.
It seems losing focus is impossible to prevent ATM, unless program that is run creates its window in some sort of "silent" way (dunno I'm not familiar with winzozz programming). It is possible to exec programs in a way that window is created somehow on background, seen it done in other programs (AutoGK for example).
It is already possible to /spec, /kick & /ban with InSim so I don't see problem here. If function is powerful enough to be useful it can also be abused. If somebody decides to spam buttons, then just leave that server...
And few more ideas:
How about possibility to position button also relative to existing HUD elements? For example, so that Y position is given with normal 0-200 coordinate, but in X direction button is placed as much right or left as possible, without covering HUD (X = some magic number > 200). In this case also makes sense to have button size defined as I proposed above (coordinate + size instead of pair of coordinates), as one coordinate is not known to InSim program.
Another idea is adding button to Escape menu, for easy access to InSim program without cluttering the screen. Could be enabled with IBtn.ClickID = some number > 159 in IS_BTN.
Also I don't see way to show same button on all connections? Maybe a flag in IBtn.BStyle to make button show on all connections, including those made after defining a button. So to say, a persistent button.
OK that's all I can think of right now, hope that some of my ideas are helpful.
I guess it would be useful if InSim programs could create screen with multi-line text field, like one that pops up when hires skins are enabled in Options/misc. Also with OK/(optional?)cancel buttons. Could display there for example help text for InSim program.
Only problem I can think of is if you have limit on packet size, then text could be split to multiple packets.
Edit: doh, of course there's packet size limit, as byte is used for it.
Few more thoughts... maybe slightly better would be to define button with top left coordinates X, Y and size X, Y. Also way to delete all buttons at once could be useful, perhaps with MaxType = 0; ClickID = 255.