• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=Robotboy655;48778862]The user agent is fabricated by GMod, it does not come from Awesomium. I can put put everything there to 1337.[/QUOTE] It's Chromium 18.0.1003.1 then. Could the useragent be changed to reflect Awesomium's actual information? This looks like the default for Awesomium 1.7.2.2 on Windows: [code]Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1003.1 Safari/535.19 Awesomium/1.7.1[/code] On Mac: [code]Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1003.1 Safari/535.19 Awesomium/1.7.1[/code] That's right, they are the same and don't even spout out the right Awesomium version. I think I've changed my mind.
God can we please get an update to that shit.
[QUOTE=HDG_MrDeeJayy;48779058]God can we please get an update to that shit.[/QUOTE] The newest version of Awesomium is also on v18
[QUOTE=Willox;48779072]The newest version of Awesomium is also on v18[/QUOTE] This is not good news. :goodjob::mindblown:
[QUOTE=DarthTealc;48779104]That's why it should be [url=https://github.com/Facepunch/garrysmod-requests/issues/531]replaced[/url] by something recent such as the "Chromium Embedded Framework"[/QUOTE] It will take forever to replace it with anything, especially since I don't even have OS X or Linux machine to develop with.
[QUOTE=Robotboy655;48779119]It will take forever to replace it with anything, especially since I don't even have OS X or Linux machine to develop with.[/QUOTE] Guh I hate mac users, so hard to get fonts to look right for them. [t]http://i.imgur.com/1isjyqz.jpg[/t] Edit: compare the W in "Waiting" on the hud. Also, look at the "TRAITORS WIN" text.
[QUOTE=HDG_MrDeeJayy;48779187]Guh I hate mac users, so hard to get fonts to look right for them. [t]http://i.imgur.com/1isjyqz.jpg[/t] Edit: compare the W in "Waiting" on the hud. Also, look at the "TRAITORS WIN" text.[/QUOTE] It has nothing to do with Awesomium at all, fonts on OSX and Linux are fucked in GMod.
elapsed = CurTime() - start_time Before it's put through a loop this displays (fine and accurately) as 4.085850, which is fine. After it goes to this [CODE] for k, v in pairs(PanelTable) do if v[2] and isnumber(v[2]) then TextToWrite = TextToWrite .. v[2] .. "The button " .. v[1] .. " was pressed\n"[/CODE] It comes back as 12/1969... what is going on?
Anybody know how to target the player who arrested somebody (DarkRP)
[QUOTE=Robotboy655;48779249]It has nothing to do with Awesomium at all, fonts on OSX and Linux are fucked in GMod.[/QUOTE] I'm sorry, I didn't realise I was in the "Problems with Awesomium Thread v3.0". I thought I was in a thread for generic problems that don't need a new thread for each one. Speaking of problems, anyone else notice that sometimes in TTT, if you have Garry's Mod minimized when a round ends, the "X Wins" popup seems to move your mouse to 0,0 on your monitor? I mean, if Garry's Mod isn't the active window, it shouldn't be allowed to do anything to my mouse...
[QUOTE=HDG_MrDeeJayy;48783411]I'm sorry, I didn't realise I was in the "Problems with Awesomium Thread v3.0". I thought I was in a thread for generic problems that don't need a new thread for each one. Speaking of problems, anyone else notice that sometimes in TTT, if you have Garry's Mod minimized when a round ends, the "X Wins" popup seems to move your mouse to 0,0 on your monitor? I mean, if Garry's Mod isn't the active window, it shouldn't be allowed to do anything to my mouse...[/QUOTE] being passive aggressive is a great way to not receive help regardless of what your problem is. as for the mouse thing, the way games work is that they usually lock the mouse in the center or top left, and then hide it, so it makes sense that if the game isn't able to set the mouse's position when a dialogue pops up (because the game isn't allowed to control the mouse when not active, i think), it stays at the default resting place — be that 0,0 or centered
[QUOTE=Sweepyoface;48770814]1) I don't think so. Why do you need to do this?[/QUOTE] I'm trying to make it so when you right-click my SWEP, it will play a sound depending on if you have an item from the Pointshop. I have the delay set to a small number so that it fits perfectly with shorter sounds, but if I have longer sounds then they will start to play on top of each other. I need this so I can set the a delay according to the sound time, for eg (soundtotaltime + 0.5)
How can I take a normally animated material and tell it to play its animation? [code] Material("cable/physbeam") [/code]
[QUOTE=Z0mb1n3;48785802]How can I take a normally animated material and tell it to play its animation? [code] Material("cable/physbeam") [/code][/QUOTE] Those materials are simply animated by changing the texture coordinates on the quads they are applied on. DrawBeam has texture coordinates as parameters.
[QUOTE=Z0mb1n3;48783670]being passive aggressive is a great way to not receive help regardless of what your problem is. as for the mouse thing, the way games work is that they usually lock the mouse in the center or top left, and then hide it, so it makes sense that if the game isn't able to set the mouse's position when a dialogue pops up (because the game isn't allowed to control the mouse when not active, i think), it stays at the default resting place — be that 0,0 or centered[/QUOTE] That's what I'm saying, it shouldn't reset the mouse position at any time at all if it is not the active window. If I'm alt tabbed doing shit, I don't expect my mouse to jerk away from me just because some 12 year old fell off a ladder.
I've been trying to get this magneto stick to attach to props, but when I do the prop and ragdoll go in weird directions and the rope is really long and like goes in 10 directions Here's the code, I have no idea how to fix it [code]function SWEP:PinRagdoll() if not pin_rag:GetBool() then return end if (not self.Owner:IsTraitor()) and (not pin_rag_inno:GetBool()) then return end local rag = self.EntHolding local ply = self.Owner local tr = util.TraceLine({start = ply:EyePos(), endpos = ply:EyePos() + (ply:GetAimVector() * PIN_RAG_RANGE), filter = {ply, self, rag, self.CarryHack}, mask = MASK_SOLID}) if tr.HitWorld then -- find bone we're holding the ragdoll by local bone = self.Constr.Bone2 -- only allow one rope per bone for _, c in pairs(constraint.FindConstraints(rag, CONSTRAINT_TYPE)) do if c.Bone1 == bone then c.Constraint:Remove() end end local bonephys = rag:GetPhysicsObjectNum(bone) if not IsValid(bonephys) then return end local bonepos = bonephys:GetPos() local attachpos = tr.HitPos local length = (bonepos - attachpos):Length() * 0.85 -- we need to convert using this particular physobj to get the right -- coordinates bonepos = bonephys:WorldToLocal(bonepos) constraint.Rope(rag, tr.Entity, bone, 0, bonepos, attachpos, length, length * 0.15, 0, (length / 125), "cable/rope.vtf", false) rag.is_pinned = true rag.OnPinnedDamage = RagdollPinnedTakeDamage -- lets EntityTakeDamage run for the ragdoll rag:SetHealth(99999) self:Reset(true) end end [/code]
[QUOTE=343N;48786084]I've been trying to get this magneto stick to attach to props, but when I do the prop and ragdoll go in weird directions and the rope is really long and like goes in 10 directions Here's the code, I have no idea how to fix it [/QUOTE] [code] local bonephys = rag:GetPhysicsObjectNum(bone) if not IsValid(bonephys) then return end local bonepos = bonephys:GetPos() local attachpos = tr.HitPos local length = (bonepos - attachpos):Length() * 0.85 -- we need to convert using this particular physobj to get the right -- coordinates bonepos = bonephys:WorldToLocal(bonepos) -- we need to convert using this particular physobj to get the right -- coordinates bonepos = bonephys:WorldToLocal(bonepos) constraint.Rope(rag, tr.Entity, bone, 0, bonepos, attachpos, length, length * 0.15, 0, (length / 125), "cable/rope.vtf", false) [/code] do the same thing that's done at the top lines there for the attachpos if the entity is anything except the world. an IsValid check should work fine, i'm pretty sure IsValid returns false when used on the world.
but then what should it return? im confused
IsValid(tr.Entity) should return false if hitting the world. instead of doing that though, just use tr.HitWorld
[QUOTE=Blakestr;48781107]elapsed = CurTime() - start_time Before it's put through a loop this displays (fine and accurately) as 4.085850, which is fine. After it goes to this [CODE] for k, v in pairs(PanelTable) do if v[2] and isnumber(v[2]) then TextToWrite = TextToWrite .. v[2] .. "The button " .. v[1] .. " was pressed\n"[/CODE] It comes back as 12/1969... what is going on?[/QUOTE] You sure there's no 'e' in your number?
so i'm making a swep and I want an ent to be removed when it touches something using [code]function prop:Touch(data) prop:Remove() end [/code] doesn't work.. Swep code is below.[code]if SERVER then AddCSLuaFile() resource.AddFile("materials/VGUI/ttt/icon_destroyer_launchcannon.vmt") end if CLIENT then SWEP.PrintName = "Launch Cannon" SWEP.Slot = 4 -- add 1 to get the slot number key SWEP.ViewModelFOV = 54 SWEP.ViewModelFlip = false end -- Always derive from weapon_tttbase. --- Standard GMod values SWEP.Base = "weapon_tttbase" SWEP.Primary.Automatic = false SWEP.Primary.Damage = 0 SWEP.Primary.Ammo = "HelicopterGun" SWEP.Primary.NumShots = 0 SWEP.Primary.Delay = 1 SWEP.Primary.ClipSize = 1 SWEP.Primary.ClipMax = 1 SWEP.Primary.DefaultClip = 1 SWEP.ViewModel = "models/weapons/c_rpg.mdl" SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" function SWEP:Initialize() self:SetHoldType("rpg") canShoot = 1 end --- TTT config values -- Kind specifies the category this weapon is in. Players can only carry one of -- each. Can be: WEAPON_... MELEE, PISTOL, HEAVY, NADE, CARRY, EQUIP1, EQUIP2 or ROLE. -- Matching SWEP.Slot values: 0 1 2 3 4 6 7 8 SWEP.Kind = WEAPON_EQUIP2 -- If AutoSpawnable is true and SWEP.Kind is not WEAPON_EQUIP1/2, then this gun can -- be spawned as a random weapon. Of course this AK is special equipment so it won't, -- but for the sake of example this is explicitly set to false anyway. SWEP.AutoSpawnable = false -- The AmmoEnt is the ammo entity that can be picked up when carrying this gun. -- CanBuy is a table of ROLE_* entries like ROLE_TRAITOR and ROLE_DETECTIVE. If -- a role is in this table, those players can buy this. SWEP.CanBuy = { ROLE_TRAITOR, ROLE_DETECTIVE } -- InLoadoutFor is a table of ROLE_* entries that specifies which roles should -- receive this weapon as soon as the round starts. In this case, none. SWEP.InLoadoutFor = nil -- If LimitedStock is true, you can only buy one per round. SWEP.LimitedStock = false -- If NoSights is true, the weapon won't have ironsights SWEP.NoSights = true -- Equipment menu information is only needed on the client if CLIENT then -- Path to the icon material SWEP.Icon = "VGUI/ttt/icon_destroyer_launchcannon.vmt" -- Text shown in the equip menu SWEP.EquipMenuData = { type = "Launch Cannon", desc = "Aim at the ground to launch yourself!" }; end function SWEP:shootEnt() local tr = self.Owner:GetEyeTrace() self:EmitSound(Sound("weapons/grenade_launcher1.wav")) if (!SERVER) then return end prop = ents.Create("prop_physics") prop:SetModel("models/weapons/w_missile_closed.mdl") prop:SetPos(self.Owner:EyePos() + (self.Owner:GetAimVector()* 16)) prop:SetAngles(self.Owner:EyeAngles()) prop:Spawn() color = Color( math.random(0,255),math.random(0,255),math.random(0,255),math.random(100,255)) prop:SetColor(color) prop:SetRenderMode( RENDERMODE_TRANSALPHA ) -- this is the prop i want to remove on touch local phys = prop:GetPhysicsObject() if !(phys && IsValid(phys)) then prop:Remove() return end phys:ApplyForceCenter(self.Owner:GetAimVector():GetNormalized()* math.pow(tr.HitPos:Length(), 3)) end function SWEP:PrimaryAttack() if canShoot == 1 then canShoot = 0 self.Owner:MuzzleFlash() self:shootEnt() self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) timer.Simple(1, (function() canShoot = 1 end)) end end function SWEP:Think() end function SWEP:Reload() end [/code] [editline]30th September 2015[/editline] [del]also slight issue, Primary.Delay does nothing to delay the primary fire[/del] [B]edit:[/B] added my own code for delay, updated post [B]edit 2: [/b]i somehow broke the delay and i dont even know how [B]edit 3: [/b]got rid of a redundant if statement and it's fixed now. still have no idea to execute code on physics touch
[QUOTE=Metamist;48785998]Those materials are simply animated by changing the texture coordinates on the quads they are applied on. DrawBeam has texture coordinates as parameters.[/QUOTE] Well actually, I noticed if I do [code] local mat = Material("cable/physbeam") mat:SetString("$frame", "5") -- 5 can be anywhere from I think 1 to 10 [/code] The actual material changes and looks different. I successfully used random numbers to make it animate that way, and it looked nice, but the problem is, I don't know how many frames it has. Setting it to a frame it doesn't have crashes my game. And setting texture coordinates just seems like it would be bad, unless the coordinates can go infinitely high? [editline]29th September 2015[/editline] [QUOTE=343N;48787681]so i'm making a swep and I want an ent to be removed when it touches something using [code]function prop:Touch(data) prop:Remove() end [/code] doesn't work.. Swep code is below.[code]if SERVER then AddCSLuaFile() resource.AddFile("materials/VGUI/ttt/icon_destroyer_launchcannon.vmt") end if CLIENT then SWEP.PrintName = "Launch Cannon" SWEP.Slot = 4 -- add 1 to get the slot number key SWEP.ViewModelFOV = 54 SWEP.ViewModelFlip = false end -- Always derive from weapon_tttbase. --- Standard GMod values SWEP.Base = "weapon_tttbase" SWEP.Primary.Automatic = false SWEP.Primary.Damage = 0 SWEP.Primary.Ammo = "HelicopterGun" SWEP.Primary.NumShots = 0 SWEP.Primary.Delay = 1 SWEP.Primary.ClipSize = 1 SWEP.Primary.ClipMax = 1 SWEP.Primary.DefaultClip = 1 SWEP.ViewModel = "models/weapons/c_rpg.mdl" SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" function SWEP:Initialize() self:SetHoldType("rpg") canShoot = 1 end --- TTT config values -- Kind specifies the category this weapon is in. Players can only carry one of -- each. Can be: WEAPON_... MELEE, PISTOL, HEAVY, NADE, CARRY, EQUIP1, EQUIP2 or ROLE. -- Matching SWEP.Slot values: 0 1 2 3 4 6 7 8 SWEP.Kind = WEAPON_EQUIP2 -- If AutoSpawnable is true and SWEP.Kind is not WEAPON_EQUIP1/2, then this gun can -- be spawned as a random weapon. Of course this AK is special equipment so it won't, -- but for the sake of example this is explicitly set to false anyway. SWEP.AutoSpawnable = false -- The AmmoEnt is the ammo entity that can be picked up when carrying this gun. -- CanBuy is a table of ROLE_* entries like ROLE_TRAITOR and ROLE_DETECTIVE. If -- a role is in this table, those players can buy this. SWEP.CanBuy = { ROLE_TRAITOR, ROLE_DETECTIVE } -- InLoadoutFor is a table of ROLE_* entries that specifies which roles should -- receive this weapon as soon as the round starts. In this case, none. SWEP.InLoadoutFor = nil -- If LimitedStock is true, you can only buy one per round. SWEP.LimitedStock = false -- If NoSights is true, the weapon won't have ironsights SWEP.NoSights = true -- Equipment menu information is only needed on the client if CLIENT then -- Path to the icon material SWEP.Icon = "VGUI/ttt/icon_destroyer_launchcannon.vmt" -- Text shown in the equip menu SWEP.EquipMenuData = { type = "Launch Cannon", desc = "Aim at the ground to launch yourself!" }; end function SWEP:shootEnt() local tr = self.Owner:GetEyeTrace() self:EmitSound(Sound("weapons/grenade_launcher1.wav")) if (!SERVER) then return end prop = ents.Create("prop_physics") prop:SetModel("models/weapons/w_missile_closed.mdl") prop:SetPos(self.Owner:EyePos() + (self.Owner:GetAimVector()* 16)) prop:SetAngles(self.Owner:EyeAngles()) prop:Spawn() color = Color( math.random(0,255),math.random(0,255),math.random(0,255),math.random(100,255)) prop:SetColor(color) prop:SetRenderMode( RENDERMODE_TRANSALPHA ) -- this is the prop i want to remove on touch local phys = prop:GetPhysicsObject() if !(phys && IsValid(phys)) then prop:Remove() return end phys:ApplyForceCenter(self.Owner:GetAimVector():GetNormalized()* math.pow(tr.HitPos:Length(), 3)) end function SWEP:PrimaryAttack() if canShoot == 1 then canShoot = 0 self.Owner:MuzzleFlash() self:shootEnt() self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) timer.Simple(1, (function() canShoot = 1 end)) end end function SWEP:Think() end function SWEP:Reload() end [/code] [editline]30th September 2015[/editline] [del]also slight issue, Primary.Delay does nothing to delay the primary fire[/del] [B]edit:[/B] added my own code for delay, updated post [B]edit 2: [/b]i somehow broke the delay and i dont even know how [B]edit 3: [/b]got rid of a redundant if statement and it's fixed now. still have no idea to execute code on physics touch[/QUOTE] Do this: [code] prop:AddCallback("PhysicsCollide", functio(self, data) local ent = data.HitEntity if IsValid(ent) then -- check for whatever you want here, really self:Remove() end end) [/code] [editline]29th September 2015[/editline] Ok automerge broke my post-editing, but I missed the "n" in function. sorry
[QUOTE=Z0mb1n3;48789159]Well actually, I noticed if I do [code] local mat = Material("cable/physbeam") mat:SetString("$frame", "5") -- 5 can be anywhere from I think 1 to 10 [/code] The actual material changes and looks different. I successfully used random numbers to make it animate that way, and it looked nice, but the problem is, I don't know how many frames it has. Setting it to a frame it doesn't have crashes my game. And setting texture coordinates just seems like it would be bad, unless the coordinates can go infinitely high?[/QUOTE] I did not know about the $frame parameter, maybe some textures do use that. As for your other question; Yes, texture coordinates wrap around to the other side of the texture (unless it's set to clamp, which most 3D loop textures aren't) so having a number higher than the width or height of the texture will just make it loop around, which is why it is ideal to animate the texture coordinates.
[QUOTE=Metamist;48789233]I did not know about the $frame parameter, maybe some textures do use that. As for your other question; Yes, texture coordinates wrap around to the other side of the texture (unless it's set to clamp, which most 3D loop textures aren't) so having a number higher than the width or height of the texture will just make it loop around, which is why it is ideal to animate the texture coordinates.[/QUOTE] Okay, well maybe I'll either find out how many frames the texture has, or just use your suggestion. Thanks.
I don't think there's a variable for the number of frames in a texture - everything that interacts with it appears to be tied into the engine deep enough that searches don't show anything. It's incredibly filthy ( and could be problematic as it is stored as a ushort ), but the header for a vtf contains the number of frames in the texture, as well as the first frame - keep in mind that a texture with N frames is controlled by setting $frame to 0->N-1. [code]local r = debug.getregistry( ).IMaterial --https://developer.valvesoftware.com/wiki/Valve_Texture_Format --signature, version, headersize, width, height, flags local magic = 4 + 8 + 4 + 2 + 2 + 4 function r:GetFrameCount( ) if self:IsError( ) then return 0, 1 end local p = "materials/" .. self:GetTexture( "$basetexture" ):GetName( ) .. ".vtf" if not file.Exists( p, "GAME" ) then return 0, 1 end local handle = file.Open( p, "rb", "GAME" ) if handle then local first, count handle:Seek( magic ) --Signature count = handle:ReadShort( ) first = handle:ReadShort( ) handle:Close( ) return first, count else return 0, 1 end end print( Material( "cable/physbeam" ):GetFrameCount( ) ) print( Material( "models/props_c17/display_cooler01a" ):GetFrameCount( ) )[/code] [code]0 20 0 1[/code] It won't work on textures that aren't VTF, or ones that are rely on being multiple levels of $basetexture deep.
Is there a way to offset a vector relative to an angle? I'm trying to draw a cube, and I'm using two different positions to use as the origins for the 3d2d environments. I get the first position, and then I add the size to the x, y, and x values of the first position to get the second position. This works fine when the angle is 0, 0, 0, but for any other angle the two "halves" don't line up. I'm pretty sure this is because, when adding the vectors, the angle is not respected and the second position is put where it would be if the angle were 0, 0, 0. Here is a picture of the cube with angle 0, 0, 0: [IMG]http://i.imgur.com/Jw7cOGD.jpg[/IMG] and here are two picture of the cube with angle 90, 0, 0: [IMG]http://i.imgur.com/Ugqd5rv.jpg[/IMG] [IMG]http://i.imgur.com/JNaGPAL.jpg[/IMG] (red is where the second position is, green is where I want it) Basically I want to offset the vector by the size, but in the correct direction (if that makes any sense).
pos = origin + ang:Up( ) * up + ang:Right( ) * right + ang:Forward( ) * forward
[QUOTE=Kogitsune;48790134]pos = origin + ang:Up( ) * up + ang:Right( ) * right + ang:Forward( ) * forward[/QUOTE] I'm not sure if I'm doing this correctly. I'm assuming "up", "right", and "forward" are the x, y, and z values of the origin vector. However this makes the second position the same as the first position when the angles are 0, so I must be missing something. Could you explain?
I am looking for a clientside hook. This hook should run constantly, similar to the [B][U]Think Hook.[/U][/B] Except, the hook needs to be constant. (Think hook varies depending on CurTime( ), AKA, FPS drops will drain it's run time). Can anyone think of a hook that is clientside that doesn't drop speed regardless of FPS drop? This a tough request, I don't think anything like this exists in gmod. I need the hook to run constantly, and without fail.
[QUOTE=EthanTheGreat;48791781]I am looking for a clientside hook. This hook should run constantly, similar to the [B][U]Think Hook.[/U][/B] Except, the hook needs to be constant. (Think hook varies depending on CurTime( ), AKA, FPS drops will drain it's run time). Can anyone think of a hook that is clientside that doesn't drop speed regardless of FPS drop? This a tough request, I don't think anything like this exists in gmod. I need the hook to run constantly, and without fail.[/QUOTE] I could be wrong and frames may only be graphical, but I'm pretty sure everything has to run on a frame. If you could magically run something "constantly", that doesn't drop speed with FPS drop, you would have eliminated FPS drop itself.
Sorry, you need to Log In to post a reply to this thread.