Ulysses Stuff > Ulysses Release Archives
[BROKEN] UMotd Revived - Motd and OTHER informational screens.
Reiko:
That's great! I'll have a fiddle around with it myself then.
Thanks for the hint!
Reiko:
Sorry for the double post. I decided to grab myself an account since I modify guest posts.
I've changed a bit of "Umotd_client.lua" to;
--- Code: ---if UMotd.command == "radio" then
Ubutton:SetText( "Hide" )
Ubutton.DoClick = function() Uwindow:SetVisible( false ) end
else
Ubutton:SetText( "Close" )
Ubutton.DoClick = function() Uwindow:Close() end
end
--- End code ---
Which works a dream, which in itself is amazing because I know no LUA. However, I've come across another problem. Although this works well now, you can open up multiple radio windows at once because the old window just stays hidden, I was wondering if someone could tell me if there is any way to have the previous radio window close upon a new radio window opening? And if not, if there was a way to just make every window (hidden or not) close whenever a new window is opened so that there can only ever be one window open at once.
Thanks for all the help!
JamminR:
My guess, untested...
At the very top of the function before Uwindow gets set, check if it is nil and command = radio.
If it isn't nil and command = radio, Uwindow:Close() (Radio was shown already, close it)
If it is nil, do nothing. (Radio wasn't shown, this is first time)
Uwindow should stay the same in memory, and be able to be closed later before being reset in the function.
Reiko:
I currently have it set up like this;
--- Code: ---function UMotd.showUMotd()
if Uwindow != nil then
Uwindow:Close()
end
local Uwindow = vgui.Create( "DFrame" )
if ScrW() > 640 then -- Make it larger if we can.
Uwindow:SetSize( ScrW()*0.9, ScrH()*0.9 )
else
Uwindow:SetSize( 640, 480 )
end
Uwindow:Center()
Uwindow:SetTitle( "UMotd v" .. UMotd.version .." - Viewing the " .. UMotd.command .. " screen." )
Uwindow:SetVisible( true )
Uwindow:MakePopup()
etc...
--- End code ---
I've also tried every variation of the;
--- Code: ---if Uwindow != nil then
Uwindow:Close()
end
--- End code ---
That I can think of and sometimes I would get this error;
--- Quote ---Couldn't include file 'Umotd/umotd_client.lua' (File not found)
--- End quote ---
So basiclly the server refused to send it, and every other time there were no errors, but nothing happened.
It behaved exactly as I described before.
Any ideas?
JamminR:
Try removing 'local' from in front of the Uwindow = vgui... line.
I forgot about that.
Up near the top of the client file,
--- Code: ---local HTML = { }
local UMotd = { }
--- End code ---
Add "local Uwindow"
(Lua lesson for you, 'local' inside a function makes the variable local to the function only)
I'm thinking that may cause other issues, but we'll go from there.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version