• Opening the menu to Lua - Your contribution needed
    363 replies, posted
A few of you might have already seen my new video, others don't - here is it again: [hd]http://www.youtube.com/watch?v=pTA9Ry_Q9Fg&fmt=37[/hd] [b]Media:[/b] [img]http://stoned.bplaced.net/img/luapad_v1.png[/img] [img]http://stoned.bplaced.net/img/appstore_v2.png[/img] [img]http://stoned.bplaced.net/img/itunes_v2.png[/img] [img]http://stoned.bplaced.net/img/server%20browser_v1.png[/img] [img]http://stoned.bplaced.net/img/twitter_v1.png[/img] My goal is to make everything in the menu environment with pure lua. In the video you see something called LuaMenu which includes already five tabs (Console, Error, Luapad, Chat, Irc) but I need some community input to extend this as far as possbile. A basic Plugin looks like this: [lua]-- Sample Plugin for LuaMenu PANEL = {} PANEL.Name = "Chat" PANEL.Desc = "Chat" PANEL.TabIcon = "gui/silkicons/comments" function PANEL:Init() self:SetMouseInputEnabled(true) self:SetKeyboardInputEnabled(true) self.Output = vgui.Create("DListView",self) self.Output:AddColumn("TimeStamp"):SetFixedWidth(60) self.Output:AddColumn("Name"):SetFixedWidth(200) self.Output:AddColumn("Message") self.Output:SetDataHeight(16) function ChatPrint(str,name) local pnl = GetError().Output:AddLine(tostring(os.date("%I:%M:%S")),name,str:gsub("\n"," ")) pnl.FullText = str end function GetChat() return self end hook.Add("ChatText","Shoop",function(str,clr,name) local pnl = GetChat().Output:AddLine(tostring(os.date("%I:%M:%S")),name,str:gsub("\n"," ")) pnl.FullText = str end) end function PANEL:PerformLayout() self:StretchToParent(4,27,4,4) self.Output:StretchToParent(0,0,0,0) end function PANEL:Paint() end [/lua] If you've seen the taskbar in the video, there is a lot of stuff that could be changed/improved. You might have a nice idea howto draw the items or the bar itself? Post it here and i'll see if it fits. If you click on the GMod Icon this is what pops up, it's ugly code atm, no custom paint or anything. If you want to improove it please go ahead :eng101: [lua] local menu = DermaMenu() menu:SetMinimumWidth(200) menu:SetDrawBorder(false) menu.OpenSubMenu = function(self,item,menu) -- Do we already have a menu open? local openmenu = self:GetOpenSubMenu() if (openmenu) then -- Don't open it again! if ( menu and openmenu == menu ) then return end -- Close it! self:CloseSubMenu( openmenu ) end if (!menu) then return end local x,y = item:LocalToScreen( self:GetWide(), 0 ) menu:Open(x-1,y-36,false,item) self:SetOpenSubMenu(menu) end[/lua] You might have also seen the SteamServer Frame on which I also need some help. I think about swithing to PcWiz' Server Query API ([url]http://www.facepunch.com/showthread.php?t=894952[/url]) but there would be also TheLinx' ([url]http://github.com/TheLinx/steam-condenser/blob/master/lua/steam/init.lua[/url]) Help is appreciated. That's all what I have to say at the moment. I hope that you'll bring up some cool ideas to make this project epic. [b]If you want to test your plugins/tabs do this:[/b] [list] [*]Copy the code below to lua/vgui/luaconsole.lua [*]Create a folder called luaconsole in vgui (lua/vgui/luaconsole/*) [*]Name your file tab_*.lua so it'll get loaded properly [/list] [highlight]Some Ideas:[/highlight] [list] [*]Itunes/WinAmp Interace [*]Web browser [/list] [highlight]Download / SVN:[/highlight] [url]http://luastoned.googlecode.com/svn/trunk/luamenu/[/url] Howto install: Create a new folder in /addons/ preferably named LuaMenu and make a checkout :)
Awesome.
:buddy:
[lua] local menu = DermaMenu() menu:SetMinimumWidth(200) menu:SetDrawBorder(false) function menu:OpenSubMenu(item, menu) --why can menu be nil anyway? Just don't call this callback if it's nil if not menu then return end local openMenu = self:GetOpenSubMenu() if openMenu and openMenu ~= menu then self:CloseSubMenu(openMenu) else local x, y = item:LocalToScreen(self:GetWide(), 0) menu:Open(x - 1, y - 36, false, item) self:SetOpenSubMenu(menu) end end [/lua] Your function is a mess, so it's a bit difficult to read its purpose, but would this do? edit os.date with a format string (that isn't "*t") will return a string to begin with, by the way.
[QUOTE=iRzilla;20344086]-<Giant Picture>-[/QUOTE] I loled.
Currently working on something like a AppStore, get plugins/snippets from the web. [img]http://stoned.bplaced.net/img/appstore_v1.png[/img]
[QUOTE=The-Stone;20345507]Currently working on something like a AppStore, get plugins/snippets from the web. -snip-[/QUOTE] Autor? Haha.
[QUOTE=Neux;20346565]Autor? Haha.[/QUOTE] German ~
[QUOTE=iRzilla;20344086]<Giant Picture> Am I doing it right?[/QUOTE] Do you reckon you could get Alan hooked into the normal gmod chat? I've been wanting to do that for ages...
Post sum plugins plox.
Do I still need to slave over fucking with my lua query api shit for you :3 Please free me from this oh shit stained unthreaded query api and give me threaded sockets PLEASE
This looks like it has potential. I want a mini-IDE so I can code simple stuff without switching between notepad++ Is that what luapad is? can't really see what's going on, even in the 1080p vid
[QUOTE=thomasfn;20348958]Do you reckon you could get Alan hooked into the normal gmod chat? I've been wanting to do that for ages...[/QUOTE] It's from Alan the fairy by me and deco, you can find the source for it here: [url]http://code.google.com/p/alanthefairy/source/browse/trunk/lua/entities/gmod_alan/sv_alan.lua[/url] it requires luasocket (I think I did some modifications to it to get it working, if you can't get it working with your luasocket try changing the way you require or try this: [url]http://dl.dropbox.com/u/244444/luasocketgmod.rar[/url])
Sorry if this isn't on-topic at all, but how do I make an SVN?
[QUOTE=Metanoia;20352689]This looks like it has potential. I want a mini-IDE so I can code simple stuff without switching between notepad++ Is that what luapad is? can't really see what's going on, even in the 1080p vid[/QUOTE] I will post pics of the luapad when I'm back home :)
Epique!
[QUOTE=Metanoia;20352689]This looks like it has potential. I want a mini-IDE so I can code simple stuff without switching between notepad++ Is that what luapad is? can't really see what's going on, even in the 1080p vid[/QUOTE] [img]http://stoned.bplaced.net/img/luapad_v1.png[/img] Is that what you want? :D
Is that LuaPad?(from gmod.org) [editline]02:18PM[/editline] *gay'd* [editline]02:18PM[/editline] *at dave*
+ Support from us (gmod.biz) You know what I mean :v:
[QUOTE=Map in a box;20365516]Is that LuaPad?(from gmod.org) [editline]02:18PM[/editline] *gay'd* [editline]02:18PM[/editline] *at dave*[/QUOTE] It's the expression 2 editor modified to fit lua syntax, I don't know what I used for all the code reference tho.
Oh? Really looks like that luapad, if its not, then it sure wouldve saved some time.(modify it with permission ofc)
[img]http://stoned.bplaced.net/img/appstore_v2.png[/img] Quickly wrapped up AppStore design :D
Please don't call it "App Store".
Holy shit this looks good. I hate to do this, and I don't ever condone doing this, but when will it be released?
Never, you just killed it :byodood:
The app store idea is brilliant, the editor looks like it integrates well with everything else. I noticed there's a Chrome module for gmod out there ([url]http://www.facepunch.com/showthread.php?t=704294[/url]) -- if that can be integrated as a browser tab, it would complete it for me (though I guess modules aren't pure lua.. still want it. maybe there's a way to attempt use of the module if present, and fall back on the crappy default integrated-IE otherwise).
[QUOTE=Chad Mobile;20371590]Never, you just killed it :byodood:[/QUOTE] D: how could I do this!
With one post.
yeah
They're happy because they eat LARD.
Sorry, you need to Log In to post a reply to this thread.