LockCamera v2.91

LockCamera v2.91

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

LockCamera v2.91

Post by Evil4Zerggin »

LockCamera

Get it from vsync.de: http://spring.vsync.de/luaManager/index.php#84

This widget allows you to broadcast your camera position to allies and/or specs, and to lock your camera to anyone else broadcasting using this widget.

Note on version numbers: Major version changes (the first number) will not be compatible, except v0.X is compatible with v1.X. Likewise, any versions with the same major version number are compatible. I may make v3.X when null characters work with LuaMsg.

Changelog
v2.91
Added the explicit L to "LockCamera". Happy now?
Fixed a misspelling with free camera (was causing bad packets).
Some other stuff I don't remember.

v2.7
Dark-colored players have light background; decodes all message for more responsive switching.

v2.5
Now broadcasts a packet to indicate transmission has stopped. This does not break compatibility, although older versions will treat this as a bad packet, and they do not send such packets.

v2.4
Added command /luaui lockcamera_interval [number] to set broadcast interval (minimum 0.25 s). Saves between games. Default is 1 s. This used to be 0.5s; hopefully this will make it less twitchy as well as reducing network traffic.

v2.3
No longer highlights/tooltips when closed.
Title bar now highlights instead of refresh button when closed.
Recent broadcaster time increased to 30s (from 10s).

v2.2
Enabled by default again.
Now highlights the component your mouse is over.
Players are now displayed in color.
Background is now more opaque.
Refresh button highlights in yellow if there are new broadcasters since last refresh.
Currently locked player always shows on list, even if they have not broadcasted recently.

v2.1
Fixed some issues in the custom floating-point representation.

v2.0
New EXPERIMENTAL version. NOT COMPATIBLE WITH VERSIONS 0.X or 1.X. This one uses compression, hopefully reducing packet sizes tenfold or so. Disabled by default since it is likely buggy. Layer is now -5, so you can move it off of Advanced Players List.

v1.6
Fixed a crashbug.

v1.5
No longer sends duplicate packets.

v1.4
Starts closed when player, open when spec.
Separate broadcast settings for players and specs. Default: only broadcast to specs and only as player. Still saves settings.

v1.3
Enabled by default.
Fixed some lock/unlock bugs.

v1.2
Added tooltips. Now automatically refreshes list on game start.

v1.1
Bugfix, hopefully you can actually lock camera now.
Clicking on the name of the player you are already locked to or your own name will unlock your camera.

v1.0
Basic GUI. Probably buggy.

v0.3
Fixed crash when invalid team is specified in specteam.

v0.2
Increased transition time a little, hopefully this will make the camera smoother.
Now broadcasts by default.
Added new command lockcamera_specteam, this works like the standard specteam command but it locks the camera as well.

v0.1
First forum release.

Thanks to MidKnight and rakhim for testing.
Thanks to jK, det, and aegis for getting me started with packet size reduction.

Use the GUI, or the following commands:

/luaui lockcamera_interval [number] to set broadcast interval (minimum 0.25 s).
/luaui lockcamera_broadcastallies to toggle broadcasting to allies. Defaults to true, is saved across games.
/luaui lockcamera_broadcastspecs to toggle broadcasting to specs. Defaults to true, is saved across games.
/luaui lockcamera_list to list recent broadcasters.
/luaui lockcamera [number|name] to lock camera to that player (to unlock camera, don't provide a number/name).
/luaui lockcamera_specteam [number] to specteam and lock camera.
/luaui lockcamera_gui to toggle GUI.

Put this in uikeys.txt to replace normal /specteam:

Code: Select all

unbind             1  specteam 0  
unbind             2  specteam 1
unbind             3  specteam 2
unbind             4  specteam 3
unbind             5  specteam 4
unbind             6  specteam 5
unbind             7  specteam 6
unbind             8  specteam 7
unbind             9  specteam 8
unbind             0  specteam 9
unbind        Ctrl+1  specteam 10
unbind        Ctrl+2  specteam 11
unbind        Ctrl+3  specteam 12
unbind        Ctrl+4  specteam 13
unbind        Ctrl+5  specteam 14
unbind        Ctrl+6  specteam 15
unbind        Ctrl+7  specteam 16
unbind        Ctrl+8  specteam 17
unbind        Ctrl+9  specteam 18
unbind        Ctrl+0  specteam 19

bind             1  luaui lockcamera_specteam 0  
bind             2  luaui lockcamera_specteam 1
bind             3  luaui lockcamera_specteam 2
bind             4  luaui lockcamera_specteam 3
bind             5  luaui lockcamera_specteam 4
bind             6  luaui lockcamera_specteam 5
bind             7  luaui lockcamera_specteam 6
bind             8  luaui lockcamera_specteam 7
bind             9  luaui lockcamera_specteam 8
bind             0  luaui lockcamera_specteam 9
bind        Ctrl+1  luaui lockcamera_specteam 10
bind        Ctrl+2  luaui lockcamera_specteam 11
bind        Ctrl+3  luaui lockcamera_specteam 12
bind        Ctrl+4  luaui lockcamera_specteam 13
bind        Ctrl+5  luaui lockcamera_specteam 14
bind        Ctrl+6  luaui lockcamera_specteam 15
bind        Ctrl+7  luaui lockcamera_specteam 16
bind        Ctrl+8  luaui lockcamera_specteam 17
bind        Ctrl+9  luaui lockcamera_specteam 18
bind        Ctrl+0  luaui lockcamera_specteam 19
If you use player list widgets such as Advanced Players List or IceUI, you could replace "specteam " with "luaui lockcamera_specteam " there as well (IceUI/playerlist.lua for the latter).

Dev Notes
As with all of my widgets, several of the major config variables are at the top. You can change the packet header, but you can't communicate with anybody with a different header. I used custom pack/unpacks to a) save on packet size, since it is not essential that camera positions are really precise, and b) to get past null-unsafeness, which has since been fixed. I won't update the format unless I have another reason besides the new null-safeness, though, since my hack to get past it only affects roughly one out of every 256 packets, and even then it only results in a error of 1 part in 256.
Last edited by Evil4Zerggin on 27 Aug 2009, 19:24, edited 29 times in total.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: LockCamera v0.1

Post by MidKnight »

yay!
more to come later...

we could intergate it into the CA GUI, along with a nicer menu system....
/wishful thinking
User avatar
Hoi
Posts: 2917
Joined: 13 May 2008, 16:51

Re: LockCamera v0.1

Post by Hoi »

Good for speccing :P
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v0.1

Post by Evil4Zerggin »

Added a lockcamera_specteam command so you can lock camera and view a player with a single command. See original post for uikeys.txt binding.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: LockCamera v0.3

Post by REVENGE »

GUI plz, kthx.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v0.3

Post by Evil4Zerggin »

Fine, I'll make a GUI... stay tuned.
Ashnal
Posts: 104
Joined: 24 Jun 2008, 00:57

Re: LockCamera v0.3

Post by Ashnal »

I wonder if I can modify iceui to activate lock camera when clicking a player in the list to spec.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: LockCamera v0.3

Post by MidKnight »

Evil4Zerggin wrote:Fine, I'll make a GUI... stay tuned.
huzzah! :P
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v0.3

Post by Evil4Zerggin »

Ashnal wrote:I wonder if I can modify iceui to activate lock camera when clicking a player in the list to spec.
Search for "specteam" in the code and replace with "luaui lockcamera_specteam". Hopefully that works. I'm working on a standalone GUI as well.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: LockCamera v0.3

Post by MidKnight »

the iceui widget file has no "specteam"

to get it to work, you need to o into the iceui folder and edit the playerlist.lua (find specteam, replace with luaui lockcamera_specteam)

you may want to add that to main post
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v1.0

Post by Evil4Zerggin »

Now has a basic GUI. It starts in the lower right corner of the screen; click it to open it. You can click on "move" and drag to move it, and click "refresh" to refresh the list of players. Click on a player to lock to that player.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v1.2

Post by Evil4Zerggin »

Now with tooltips, and automatically refreshes list on game start.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v1.4

Post by Evil4Zerggin »

No longer sends duplicate packets, hopefully this should reduce the load.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v1.6

Post by Evil4Zerggin »

Fixed a crashbug. This will probably be the last version before 2.0. I'm going to try to implement a more efficient packet format, which will result in lower network use. This will break compatibility with the current version.
YHCIR
Posts: 190
Joined: 12 Aug 2006, 23:06

Re: LockCamera v1.6

Post by YHCIR »

Is there any way to make the GUI dragable? It hides behind the playerlist widget :cry:
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v1.6

Post by Evil4Zerggin »

It is draggable. Open it, click on "Move", and drag. Unless the player list is intercepting the mouse click; I might change the layer then.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v1.6, v2.0

Post by Evil4Zerggin »

New EXPERIMENTAL version, v2.0. NOT COMPATIBLE WITH VERSIONS 0.X or 1.X. This one uses compression, hopefully reducing packet sizes tenfold or so. Disabled by default since it is likely buggy. Layer is now -5, so you can move it off of Advanced Players List.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v2.7

Post by Evil4Zerggin »

Now at v2.7; there's been several changes (see the changelog). v2.X is now stable; it should transmit less than a tenth of the bytes that v1.X did. If I find a better packet system I may make v3.X since LuaMsg is now null-safe, but otherwise it might not be worth it.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: LockCamera v2.7

Post by manolo_ »

could u make it dragable?
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: LockCamera v2.7

Post by Evil4Zerggin »

To move the panel, click on "Move" and drag. Although I could change it if people want.
Post Reply

Return to “Lua Scripts”