• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
What happen to chat.GetChatBoxSize? It's on the wiki, but does not work in the game.
[QUOTE=Author.;47277679]What happen to chat.GetChatBoxSize? It's on the wiki, but does not work in the game.[/QUOTE] Dev branch only until the next update.
Is there another way to get the chatbox size until then other than hacking the chatbox?
Is there a way to change the volume of a DHTML panel element? I have ads on my server on join, and people complain that it's too loud.
[QUOTE=Neat-Nit;47277388]GoldTrigger just misunderstood a link I gave him in another thread (it's partly my fault - I just posted a link with no explanation). GoldTrigger, the answer you're looking for is just a few posts above, in Post #4503 and #4505.[/QUOTE] Oh woops my apologies as well I should've looked thanks though :)
[code] local data = file.Read( "resource/ui/BaseChat.res", "GAME" ) data = util.KeyValuesToTable( data ).HudChat local x, y, w, h, aw, ah aw = ScrW( ) / 640 ah = ScrH( ) / 480 x = data.xpos * aw y = data.ypos * ah w = data.wide * aw h = data.tall * ah[/code] HudChat might need changed to hudchat
I tried using SetKeyboardInputEnabled and SetMouseInputEnabled (which is what MakePopup does according to the wiki), but I was still able to walk around and look around. Is these two functions something else than what I think they are? And how can I reproduce MakePopup in a behavior where I can disable MakePopup if ya understand what I mean. I know about gui.EnableScreenClicker, but what about the keyboard? [editline]n[/editline] I'm doing this on an EditablePanel, by the way.
How can I set a color for a specific bone?
If by bone you mean specific subset of a model, not easily since they are just a point in the data and aren't related to the actual mesh beyond the movement. If you really want to do it, you'd first render the model, and then for each section you want to colorize, you'd have to scale all the other bones to 0 and re-render the model as the desired color. Otherwise, you'll need to clarify what you mean.
[QUOTE=Tenrys;47277826]Is there a way to change the volume of a DHTML panel element? I have ads on my server on join, and people complain that it's too loud.[/QUOTE] I doubt this can be done; DHTML uses Awesomium and I don't think the audio for this can be isolated. You can modify the volume of <audio> and <video> elements within the page using JS, and jQuery offers [i].prop("muted", true)[/i], but you generally can't do this for flash ads, as the applications aren't designed to allow volume control externally.
Does anyone know how to get bumpmaps working on IMeshes? The wiki says that the [URL="http://wiki.garrysmod.com/page/Structures/MeshVertex"]mesh table structure[/URL] has two more values you can add called 'tangent' and 'binormal', and after some research, it looks like those are supposed to be [URL="http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-13-normal-mapping/#Tangent_and_Bitangent"]two more vectors running parallel to the normal[/URL] that are used for normal mapping/bumpmapping. Problem is, adding them doesn't seem to actually do anything. [t]http://cloud-4.steamusercontent.com/ugc/45372788812052131/47A1B30090935020A193C4EFE31906777E4C196A/[/t] That's a prop on the left, and an IMesh with the same texture on the right. I even threw together a debug thing to show the normal/binormal/tangent of each triangle, and it looks like everything's where it's supposed to be, but the bumpmap still won't show up. Is there something different I have to do here? There isn't exactly any documentation on the wiki, and I couldn't find any addons that actually got it working, so maybe the wiki's wrong and IMeshes just can't have normal mapping? I don't know. Here's the code I'm using to generate them, it's basically just the stuff from the link back there rewritten in Lua: [code] //Tangents and binormals again! This still doesn't work! local triangle = {} for num, vertex in pairs (meshtable) do //meshtable is a table of MeshVertex structures with pos, normal, u, and v already generated for each vertex //every three vertices in the meshtable is a triangle table.insert(triangle, {vertnum = num, pos = vertex.pos, texvec = Vector(vertex.u, vertex.v)}) if table.Count(triangle) == 3 then local deltaPos1 = triangle[2].pos - triangle[1].pos local deltaPos2 = triangle[3].pos - triangle[1].pos local deltaUV1 = triangle[2].texvec - triangle[1].texvec local deltaUV2 = triangle[3].texvec - triangle[1].texvec local r = 1 / (deltaUV1.x * deltaUV2.y - deltaUV1.y * deltaUV2.x) local tangent = (deltaPos1 * deltaUV2.y - deltaPos2 * deltaUV1.y)*r local binormal = (deltaPos2 * deltaUV1.x - deltaPos1 * deltaUV2.x)*r //i've tried normalizing these two vectors, but nothing changed so i don't think that's the problem //tangent:Normalize() //binormal:Normalize() meshtable[ triangle[1].vertnum ].tangent = tangent meshtable[ triangle[2].vertnum ].tangent = tangent meshtable[ triangle[3].vertnum ].tangent = tangent meshtable[ triangle[1].vertnum ].binormal = binormal //i've also tried replacing .binormal with .bitangent just in case the wiki was wrong, that didn't do anything either meshtable[ triangle[2].vertnum ].binormal = binormal meshtable[ triangle[3].vertnum ].binormal = binormal table.Empty(triangle) end end[/code]
[QUOTE=Kogitsune;47278642]If by bone you mean specific subset of a model, not easily since they are just a point in the data and aren't related to the actual mesh beyond the movement. If you really want to do it, you'd first render the model, and then for each section you want to colorize, you'd have to scale all the other bones to 0 and re-render the model as the desired color. Otherwise, you'll need to clarify what you mean.[/QUOTE] Yeah. Just trying to make it so that I can color/highlight limbs. So render the model with the non-colored parts scaled to 0 and use something like a clientside model on top of that, right? Or something similar to that, I think I understand the concept, but I'm probably confusing the steps. I'll try some stuff out and see how it goes.
I figured out the parenting part, however I got another question regarding RichText. Currently, RichText adds text starting at the top, how would I go about making the text start from bottom? I'm still just messing around with it trying to find a solution. Any ideas meanwhile?
[QUOTE=Author.;47278914]I figured out the parenting part, however I got another question regarding RichText. Currently, RichText adds text starting at the top, how would I go about making the text start from bottom? I'm still just messing around with it trying to find a solution. Any ideas meanwhile?[/QUOTE] Are you trying to recreate CS:GO's chatbox?
Nope, I'm just trying to create a normal chatbox.
Can I store tables in PData? It says "any" value on the wiki and when I print the results of GetPData it claims it's a table, but when I actually print the contents it's just a single letter, "t"
No, pdata is string only. [code]function meta:SetPData( name, value ) name = Format( "%s[%s]", self:UniqueID(), name ) sql.Query( "REPLACE INTO playerpdata ( infoid, value ) VALUES ( "..SQLStr(name)..", "..SQLStr(value).." )" ) end[/code]
[QUOTE=BFG9000;47279090]Can I store tables in PData? It says "any" value on the wiki and when I print the results of GetPData it claims it's a table, but when I actually print the contents it's just a single letter, "t"[/QUOTE] No, but you could probably use util.TableToJSON (it converts tables to a json string) and use util.JSONToTable to convert it back into a table.
[QUOTE=Sm63;47279460]No, but you could probably use util.TableToJSON (it converts tables to a json string) and use util.JSONToTable to convert it back into a table.[/QUOTE] Might as well store it in a text file if you're going to do that, storing data like that in SQL risks the integrity of it. ( storing multiple values in one column )
Any way to make rounded boxes display if a player has a certain swep such as a physgun or camera? Doing this for hud ammo counter :P
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/DrawHUD]WEAPON/DrawHUD[/url]
[t]http://cloud-4.steamusercontent.com/ugc/528383848397099310/E87D0139268570C1D655D91B6A807AAD6138C5E3/[/t] env_fire seems to always want to go on to the ground whenever I spawn it. Here's the code I'm using: [lua] function CreateFire( pos ) local fire = ents.Create( "env_fire" ) fire:SetPos( pos ) fire:SetKeyValue( "duration", "9999999" ) fire:SetKeyValue( "size", 100 ) fire:Fire( "startfire" ) fire:Spawn() end [/lua]
[QUOTE=meharryp;47281535][t]http://cloud-4.steamusercontent.com/ugc/528383848397099310/E87D0139268570C1D655D91B6A807AAD6138C5E3/[/t] env_fire seems to always want to go on to the ground whenever I spawn it. Here's the code I'm using: [lua] function CreateFire( pos ) local fire = ents.Create( "env_fire" ) fire:SetPos( pos ) fire:SetKeyValue( "duration", "9999999" ) fire:SetKeyValue( "size", 100 ) fire:Fire( "startfire" ) fire:Spawn() end [/lua][/QUOTE] [img]http://i.imgur.com/aKbGrGb.png[/img] Pls.
How do you set a flag on an entity?
ent:SetKeyValue("spawnflags", flags)
What happens if I precache a model or sound that has already been precached?
[QUOTE=G4MB!T;47283264]What happens if I precache a model or sound that has already been precached?[/QUOTE] Nothing at all?
Ok thanks. I was just wondering if it would cause the model or sound to be precached again or cause problems.
Anyone know how to scale fonts according to screen size? ._. Left this out of my hud woops
if you're using the default fonts, you'll have to remake them (you can find the source for most of them [url=https://github.com/garrynewman/garrysmod/search?utf8=%E2%9C%93&q=createfont&type=Code]here[/url])
Sorry, you need to Log In to post a reply to this thread.