Problems That Don't Need Their Own Thread -- 2019 Edition
18 replies, posted
Welcome to PTDNT, 2019 Edition!
Need help with a small problem you're having, but don't want to start a new thread for it? Post it here!
Some Basic Guidelines
Post your problem
Post your code (make sure to use code tags)
Post any error messages you're getting
Post some in-game pictures to illustrate your problem
Etiquette Reminder:
Don't ask for help with code you stole, please only post code you wrote yourself / is open source.
Is it possible to convert a serverside or clientside variable to shared?
I set a variable clientside and I network it serverside and then save it in a table, but what I really need to do is set a variable clientside and then network it shared and save it to a table.
It's not an entity though. It's just a variable that's created clientside that needs to be shared.
Net Library Usage
or use Entity(0) as entity.
I tried using net messages. But then I have to do a double net message. One to ask the server that I want the table clientside, and then another one to send it over. Which seems a bit inefficient and it doesn't usually load right away properly. I have to refresh the panel two or three times before it works.
Just wait for their initializing. you can set global variables like this:
_G["VarName"] = net.ReadString()
print(VarName)
Hm, what's the best way to check if a net message is done initializing?
For your particular case of updating a panel, I would make use of callbacks and have the panel automatically update itself with the correct information. Something like this:
AddonCache = AddonCache or {}
net.Receive("Some_NetMessage", function()
AddonCache = net.ReadTable();
if IsValid(AddonPnl) then AddonPnl.UpdatePanel() end
end)
function MakePanel()
AddonPnl = vgui.Create("DFrame")
AddonPnl:SetSize(500, 500)
AddonPnl.UpdatePanel = function()
AddonPnl:SetTitle(AddonPnl.title or "No title found!");
end
end
Side note, don't make global variables using what was said above... To create a global variable you simply just don't declare it as local (like in my example with AddonCache and AddonPnl).
Is it possible to make a button clickable outside of its' parent panel? (except some crappy workarounds like making a second invisible panel, etc.)
https://i.imgur.com/Au0SN3z.png
gui.EnableScreenClicker
Panel/MakePopup
Nope, gui.EnableScreenClicker is completely not it and popping the button up makes ZPos behave... weird?
Als, MakePopup makes the button's position be not relative to it's parent.
http://vaati.net/Gachi/shared/JmPqk9A3RQ.mp4
A similar strategy ended up working.
_____
Has anyone gotten ortho view to work in CalcView? I can't seem to find any working example on Facepunch/Google and I couldn't even find it in the CamData structure in garrysmod's github.
CamData Structure
I couldn't find it in the CamData Structure, including looking for a working example in garrysmod's github*
I didn't know you meant the GMod Wiki by garrysmod's github, sorry. And yeah, it still lacks any proper documentation.
This could help:
Source Engine Github
else if (::input->CAM_IsOrthographic())
{
pSetup->m_bOrtho = true;
float w, h;
::input->CAM_OrthographicSize( w, h );
w *= 0.5f;
h *= 0.5f;
pSetup->m_OrthoLeft = -w;
pSetup->m_OrthoTop = -h;
pSetup->m_OrthoRight = w;
pSetup->m_OrthoBottom = h;
}
I actually just don't think ortho works on Garrysmod, or was never added.
If you look at the CamData Structure you can see the ortho table which allows you to set all the properties.
Sorry, you need to Log In to post a reply to this thread.