1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

NightAngel's Development Thread

Discussion in 'Development' started by NightAngel, Jul 20, 2014.

  1. NightAngel

    NightAngel Fuck off Lev

    Figured I'd make a thread of screenies of stuff that I'm working on, cuz I love to show off my work while I'm making plugins.

    Enhanced Description Plugin:

    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    Zombie Plugin:

    [​IMG]
     
  2. Martz

    Martz Guest

    Re: NightAngel's Development Thead

    I can't wait, they look great!
     
  3. Re: NightAngel's Development Thead

    -snip-
     
  4. Crater

    Crater Hostell Roleplay

    Re: NightAngel's Development Thead

    How exactly is the voice description going to work? I understand it's used in place of a physical one when not looking at someone, but isn't the voice description going to be restricted to like 5-10 characters due to the "[<desc>...] <chat>" format of unknown character speech in chat?
     
  5. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    I was thinking that it would show the full voice description on the character or when you look at them for a few seconds or so after they say something ICly, it would also show up while they are typing something ICly. So that way, you could match the voice description to the ingame character. Only problem is getting it to replace the physdesc info with the voicedesc info in the IC message. xO
     
  6. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Okay, so I've run into a little hitch with changing the IC chat name from the physdesc to the voicedesc. It uh.. doesn't really work at all. xD

    Here's my cl_plugin.lua:

    Code:
    local PLUGIN = PLUGIN;
    local Clockwork = Clockwork;
    
    Clockwork.config:AddToSystem("Minimum voice description length", "minimum_voicedesc", "The minimum amount of characters a player must have in their voice description.", 0, 128);
    
    --Called when the chatbox info needs to be adjusted with the voice desc.
    function PLUGIN:ChatBoxAdjustInfo(info)
    	local icClass = {"ic", "whisper", "yell", "radio", "radio_eavesdrop"}
    	for k, v in ipairs (icClass) do
    		if (info.class == v) then
    			if (info.unrecognized) then
    				local unrecognisedVoice, usedVoiceDesc = PLUGIN:GetUnrecognisedName(info.speaker);				
    				if (usedVoiceDesc and string.len(unrecognisedVoice) > 24) then
    					unrecognisedVoice = string.sub(unrecognisedVoice, 1, 21).."...";
    				end;
    				info.name = "["..unrecognisedVoice.."]";
    			end;
    		end;
    	end;
    end;
    
    -- A function to get a player's unrecognised name.
    function PLUGIN:GetUnrecognisedName(player)
    	local unrecognisedVoiceDesc = self:GetVoiceDesc(player);
    	local unrecognisedVoice = Clockwork.config:Get("unrecognised_name"):Get();
    	local usedVoiceDesc;
    	
    	if (unrecognisedVoiceDesc) then
    		unrecognisedVoice = unrecognisedVoiceDesc;
    		usedVoiceDesc = true;
    	end;
    	
    	return unrecognisedVoice, usedVoiceDesc;
    end;
    
    -- A function to get a player's voice description.
    function PLUGIN:GetVoiceDesc(player)
    	if (!player) then
    		player = Clockwork.Client;
    	end;
    	
    	local voiceDesc = player:GetSharedVar("VoiceDesc");
    	local team = player:Team();
    	
    	if (voiceDesc == "") then
    		voiceDesc = Clockwork.class:Query(team, "defaultVoiceDesc", "");
    	end;
    	
    	if (voiceDesc == "") then
    		voiceDesc = Clockwork.config:Get("default_voicedesc"):Get();
    	end;
    	
    	if (!voiceDesc or voiceDesc == "") then
    		voiceDesc = "This character has no voice description set.";
    	else
    		voiceDesc = Clockwork.kernel:ModifyVoiceDesc(voiceDesc);
    	end;
    	
    	return voiceDesc;
    end;
    My sh_plugin.lua:

    Code:
    local PLUGIN = PLUGIN;
    
    Clockwork.kernel:IncludePrefixed("cl_plugin.lua");
    Clockwork.kernel:IncludePrefixed("sv_plugin.lua");
    
    -- A function to modify a voice description.
    function PLUGIN:ModifyVoiceDesc(description)
    	if (string.len(description) <= 128) then
    		if (!string.find(string.sub(description, -2), "%p")) then
    			return description..".";
    		else
    			return description;
    		end;
    	else
    		return string.sub(description, 1, 125).."...";
    	end;
    end;
    And my sv_plugin.lua:

    Code:
    local Clockwork = Clockwork;
    local PLUGIN = PLUGIN;
    
    Clockwork.config:Add("minimum_voicedesc", 32, true);
    
    -- Called when a player's shared variables should be set.
    function PLUGIN:PlayerSetSharedVars(player, curTime)
    	player:SetSharedVar("VoiceDesc", player:GetCharacterData("VoiceDesc"));
    end;
    Basically, I just copied over how the physical description is handled, and just changed all the variables to match the new voice description. But it doesn't change the unrecognized name from the physical description into the voice description in IC chat or anything else. So uh.. help please? :D

    [member=5482]duck[/member]
    [member=5522]Atebite[/member]
    [member=5495]Polis[/member]

    disisthefirsttimeI'veaskedforhelpI'msonervous
     
  7. Polis

    Polis Guest

    Re: NightAngel's Development Thead

    Have you made sure the physical description isn't conflicting with the voice description over which one appears in the chatbox?

    You may have to overwrite the 'GetUnrecognisedName' function.
     
  8. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    I haven't, I'll look into doing that now.
     
  9. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Got it working! Danke~ <3

    [​IMG]

    [​IMG]
     
  10. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Edited OP with some more pics of the voice descript, got it showing up on player's heads when they speak now.
     
  11. Polis

    Polis Guest

    Re: NightAngel's Development Thead

    You magician, I'm going to learn a lot from this plugin if you release it.
     
  12. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Fixed dat for you. :p
     
  13. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Well, it turns out /charexamine in the enhanced description plugin was broken... ;-;

    Fixed it up, and adding the option to add a link to a picture in your detailed description. Right now, the picture opens in the overlay when someone clicks a button in your /charexamine form. But I'd like it if I could find a way to have the picture either in the derma form, or in another derma form that can be viewed quick and easy ingame. Just gotta wait for me to update it on the plugin collection, I'll post on there when I do. So hang tight! :O
    [​IMG]
     
  14. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Alright, so I was looking into trying to get a picture to show in the derma panel of my detailed description. I basically just took the code from the dynamic adverts, tried to inject my link into it and then tried to fit it into the derma panel. All it did was just create a big space between the description and the button to look at the picture in the steam overlay. Basically, it's not working, and I'm thinking it's because of my inexperience with derma and HTML code. Soo uhh... help please..? :D

    Here's the derma code for viewing the detailed description.

    Code:
    --[[
    	? 2013 CloudSixteen.com do not share, re-distribute or modify
    	without permission of its author ([email protected]).
    --]]
    
    local PLUGIN = PLUGIN;
    
    local PANEL = {};
    
    -- Called when the panel is initialized.
    function PANEL:Init()
    	self:SetBackgroundBlur(true);
    	self:SetDeleteOnClose(false);
    	
    	-- Called when the button is clicked.
    	function self.btnClose.DoClick(button)
    		self:Close(); self:Remove();
    		
    		gui.EnableScreenClicker(false);
    	end;
    	
    	self.panelList = vgui.Create("DPanelList", self);
     	self.panelList:SetPadding(2);
     	self.panelList:SetSpacing(3);
     	self.panelList:SizeToContents();
    	self.panelList:EnableVerticalScrollbar();
    end;
    
    -- Called each frame.
    function PANEL:Think()
    	local scrW = ScrW();
    	local scrH = ScrH();
    	
    	self:SetSize(512, 512);
    	self:SetPos( (scrW / 2) - (self:GetWide() / 2), (scrH / 2) - (self:GetTall() / 2) );
    	
    	if (!IsValid(self.target) or self.target:GetPos():Distance( Clockwork.Client:GetPos() ) > 192) then
    		self:Close(); self:Remove();
    		
    		gui.EnableScreenClicker(false);
    	end;
    end;
    
    -- A function to populate the panel.
    function PANEL:Populate(target, data, link)
    	local colorWhite = Clockwork.option:GetColor("white");
    	local name = target:GetName()
    	self.target = target
    	if (!Clockwork.player:DoesRecognise(target, RECOGNISE_TOTAL)) then
    		name = "Someone"
    	end;
    	self:SetTitle(name.."'s Detailed Description");
    	
    	self.panelList:Clear();
    	
    	self.label = vgui.Create("DLabel");
    	self.button = vgui.Create("DButton");	
    	self.button:SetText("Picture Description!");
    	-- Called when the button is clicked.
    	function self.button.DoClick()
    		gui.OpenURL(tostring(link))	
    	end;
    	
    	self.picture = vgui.Create("HTML");
    	self.picture:SetPaintedManually(true);
    	self.picture:SetSize(400, 400);
    	self.picturesize = 400
    	self.picture:SetHTML([[
    	<head>
    			<style type="text/css">
    				body, html {
    					vertical-align: 50%;
    					overflow: hidden;
    					text-align: center;
    					padding: 0;
    					margin: 0;
    					height: 100%;
    				}
    				img {
    					position: relative;
    					margin-top: -]]..(self.picturesize / 2)..[[px;
    					heigth: ]]..self.picturesize..[[;
    					width: ]]..self.picturesize..[[;
    					top: 50%;
    				}
    			</style>
    		</head>
    	<body scroll="no" scrolling="no">
    			<img src="]]..tostring(link)..[[/>
    	</body>
    	]]);
    	
    	self.label:SetAutoStretchVertical(true);
    	self.label:SetTextColor(colorWhite);
    	self.label:SetWrap(true)
    	self.label:SetText(data);
    	
    	self.panelList:AddItem(self.label);
    	self.panelList:AddItem(self.picture);
    	self.panelList:AddItem(self.button);
    end;
    
    -- Called when the layout should be performed.
    function PANEL:PerformLayout()
    	self.panelList:StretchToParent(4, 28, 4, 4);
    	
    	DFrame.PerformLayout(self);
    end;
    
    vgui.Register("cwViewDetDesc", PANEL, "DFrame");
    The self.picture is the HTML element that I want to show a picture based on the link that someone put in their detailed descript.

    [member=5482]duck[/member]
    [member=5522]Atebite[/member]
    [member=5495]Polis[/member]
    [member=1397]trurascalz[/member]
    [member=1314]Arbiter329[/member]
    @Someonesmarterthanme :eek:
     
  15. Polis

    Polis Guest

    Re: NightAngel's Development Thead

    Derma works best if you use DMaterialOverlay to stick images on your panels. HTML has it's problems with derma.

    Also, within your HTML (script?) I don't see any URL or directory, but I have just woken up so that may be me being incompetent.

    EDIT: From what I can see you also haven't set a position for the picture, and I don't think using self.picturesize will work the way you are using it. It should be self.picture:Height() and self.picture:Width().

    I hope this helped, I'm not all that great with derma.
     
  16. SevenLions

    SevenLions Post 123 for a Door Giveaway!!! Clockwork Customer

    Re: NightAngel's Development Thead

    Polis pls, you've seen my shitty derma lol, you're decent, anyway, I feel Polis neglected to mention another issue at line 66 on the cl_viewdetdesc.

    EDIT: Realized there was nothing wrong there I just hit my teamspeak talk key and thought there was an extra ) lol.
     
  17. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Alrighty, let me explain my logic with this thing. :p

    So here's a video example of what my detailed description does so far, and where I'm getting the URL for the picture.

    http://youtu.be/8KhLOjVVkM0

    So in the case of my character 'Medic' the 'link' variable for her picture description would be equal to:
    http://www.chickenkiller.net/uploads/posts/2013-01/gsvvbfta5k.jpg

    So this link is set in the detailed description edit panel, then transferred to the server with datastream magic, then saved to the characterdata of 'Medic'.

    That's where this line of code would get its link for the picture:

    Code:
    <img src="]]..tostring(link)..[[/>
    I figured that since I have a DPanelList, I wouldn't have to set the position for the picture. Also, my HTML object was basically just a copy paste of how dynamic adverts create their HTML objects which do exactly what I want: Take a picture from the internets, then display it in-game.

    Example:

    [​IMG]

    Here is how the dynamic advert creates its HTML picture objects, which is what I tried to put into my derma panel's DPanelList.

    Code:
    -- A function to create a HTML panel.
    function cwDynamicAdverts:CreateHTMLPanel(dynamicAdvert)
    	dynamicAdvert.panel = vgui.Create("HTML");
    	dynamicAdvert.panel:SetPaintedManually(true);
    	dynamicAdvert.panel:SetSize(dynamicAdvert.width, dynamicAdvert.height);
    	dynamicAdvert.panel:SetPos(0, 0);
    	dynamicAdvert.panel:SetHTML([[
    		<head>
    			<style type="text/css">
    				body, html {
    					vertical-align: 50%;
    					overflow: hidden;
    					text-align: center;
    					padding: 0;
    					margin: 0;
    					height: 100%;
    				}
    				img {
    					position: relative;
    					margin-top: -]]..(dynamicAdvert.height / 2)..[[px;
    					heigth: ]]..dynamicAdvert.height..[[;
    					width: ]]..dynamicAdvert.width..[[;
    					top: 50%;
    				}
    			</style>
    		</head>
    		<body scroll="no" scrolling="no">
    			<img src="]]..dynamicAdvert.url..[["/>
    		</body>
    	]]);
    end;
    The dynamicAdvert.height and .width are set when you create the dynamic advert like so..

    [​IMG]

    And here's my code for creating the picture object.

    Code:
    self.picture = vgui.Create("HTML");
    	self.picture:SetPaintedManually(true);
    	self.picture:SetSize(400, 400);
    	self.picturesize = 400
    	self.picture:SetHTML([[
    	<head>
    		<style type="text/css">
    		body, html {
    		 vertical-align: 50%;
    		 overflow: hidden;
    		 text-align: center;
    		 padding: 0;
    		 margin: 0;
    		 height: 100%;
    		}
    		img {
    		 position: relative;
    		 margin-top: -]]..(self.picturesize / 2)..[[px;
    		 heigth: ]]..self.picturesize..[[;
    		 width: ]]..self.picturesize..[[;
    		 top: 50%;
    		}
    	   </style>
    	  </head>
    	 <body scroll="no" scrolling="no">
    	   <img src="]]..tostring(link)..[[/>
    	 </body>
    	 ]]);
    When I do use this code, it just creates a blank space between the text of the description, and the button that brings up the picture in the overlay. So, since I have no HTML or Derma experience, I'm lost. The thing I hate about it, is that console-Senpai isn't spitting out any errors to guide me towards making it work, it just doesn't work. ;-;
     
  18. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Got it all working, BIG thanks to Sheeplie for pointing me in the right direction. <3

    http://youtu.be/xLj5pKyWyXA
     
  19. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    Here's a little preview of my new plugin. :p

    [​IMG]
     
  20. NightAngel

    NightAngel Fuck off Lev

    Re: NightAngel's Development Thead

    I uh.. maaaaybe.. :p
     

Previous Readers (Total: 0)