-
August 3rd, 2011, 22:17 #1
How to create a resizable chatwindow
I worked at creating this as an extension but due to the way the default chat is a panel and this is a pure windowclass it isn't working. Video will take a second to load.
You will be needing to modify 2 XML files and 1 LUA file.
File 1: desktop_panels.xml
Step 1: Comment out the current chat panel so that it looks like this:
Code:<!--<panel name="chat" modes="host,client"> <class>chat</class> <bounds>15,90,390,-118</bounds> </panel>-->
Comment out the parent node for the top anchor and left anchor and add a left offset to the identitylist control like so:
Code:<top> <!--<parent>chat</parent>--> <anchor>bottom</anchor> <offset>-50</offset> </top> <left> <!--<parent>chat</parent>--> <anchor>left</anchor> <offset>100</offset> </left>
Step 1: Add a width to the sizelimits maximum node of the chat windowclass. This will allow maximum stretchability.
Code:<maximum> <height>10000</height> <width>10000</width> </maximum>
Code:<left> <anchor>right</anchor> <offset>-55</offset> </left>
Code:<softclose /> <sharable /> <script> function onInit() User.onLogin = reshare Input.onAlt = reopen self.onMove = onMove end function reshare() share() end function reopen() Interface.openWindow("chat","") share() end function onMove() self.setSize(self.getSize()) end </script>
Also, if your ruleset does not have the current chat windowclass as dynamic you should add the following under the sizelimits node:
Code:<dynamic> <resize>both</resize> </dynamic>
Step 1: Basically here we are adding in a call to the desktop initialization to open our modified chat windowclass for the GM. Modify the onInit function and add an Interface.openWindow right under the first if User.isHost() statement.
Code:function onInit() if not User.isLocal() then if User.isHost() then Interface.openWindow("chat","")
Last edited by joshuha; August 10th, 2011 at 15:27.
-
August 3rd, 2011, 22:30 #2
This is Cool. Two questions:
1) Am I right in understanding that you remove the underlying chat panel and simply call for the chatwindow to render as a standard window?
a) if so do dice rolls still fire OK when the chatwindow is sized larger than the original default?
2) do you not also need to add the <dynamic /> tag to the chat windowclass to allow for dynamic resizing of the chatwindow?FG Project Development
Next Project(s)*: Starfinder v1.2 Starship Combat
Current Project: Starfinder v1.1 - Character Starships
Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
* All fluid by nature and therefore subject to change.
-
August 3rd, 2011, 22:36 #3Originally Posted by DrZeuss
a) Yes they come across fine, I tested with several players. Whats neat is if the players window is bigger then your it seems to overlap the vector of where it fires but still lands in your smaller window and the results are still the same.
2) Yes but its already like that in the base 4E ruleset in 2.8 even though its tied to a panel and therefor not really dynamic. Will add a note though.Last edited by joshuha; August 3rd, 2011 at 23:14.
-
August 3rd, 2011, 23:12 #4
It works beautifully. Just added this to the ArsMagica ruleset.
- Obe
-
August 4th, 2011, 00:16 #5
Ouch. Noticed the first bug with this aproach... in it's current form the window can be accidentially closed by the clients.
- Obe
-
August 4th, 2011, 02:07 #6
Updated post so user's cannot close chat down. GM could still though and can get window back by pressing ALT. Might be a more elegant way to prevent GM from doing it or auto-reopen but can't think of it right this second.
Last edited by joshuha; August 4th, 2011 at 02:50.
-
August 4th, 2011, 15:11 #7
Nice mod joshuha!
I've just added it to my ruleset and noticed a minor issue. When you move the chat window the subjacent area that receives the thrown dice is not updated to the new position until the chat window is resized.
-
August 4th, 2011, 15:16 #8
Hmm didn't notice that but will test it and see if I can figure out why its doing that.
-
August 4th, 2011, 16:50 #9
- Join Date
- Apr 2011
- Posts
- 2,254
Great job joshuha!
I was able to add it to a ruleset also. I did add the <placement> tag so I could set a default position and size which replicated the original placement before I made changes.
I am able to replicate psicodelix's issue. I did notice that it will still register the roll if you drop it in the old location before you moved it.
-
August 4th, 2011, 21:33 #10
a work around to the issue isto force a resize every time you move the window.
add an on move event handler to the chat window onInit and then set the onMove function to resize to the current window size and it should work
Code:function onInit() User.onLogin = reshare Input.onAlt = reopen self.onMove = onMove end function reshare() share() end function reopen() Interface.openWindow("chat","") share() end function onMove(source) source.setSize(source.getSize()) end
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks