[QUOTE=code_gs;52014228][URL]https://glua.team/[/URL][/QUOTE]
we have a dedicated events channel now, and we just cleaned up the announcements channel
[t]http://i.imgur.com/euKU7Lg.png[/t]
[t]http://i.imgur.com/QlIxNKw.png[/t]
we track the garry's mod github repo, the facepunch twitter bot, and some facepunch threads (like the gmod waywo, next update, and this thread)
also neatnit, yes, we have a channel dedicated to complaining and asking lua questions about garry's mod too (#coding)
[t]http://i.imgur.com/692ipTC.png[/t]
My for k,v in pairs(table) loop only takes half of the entries in account.
Is there a reason for this?
If I count it in the very same function, it returns the right amount.
[QUOTE=mcNuggets1;52014490]My for k,v in pairs(table) loop only takes half of the entries in account.
Is there are reason for this?
If I count it in the very same function, it returns the right amount.[/QUOTE]
If you use table.remove within the loop you're just asking for trouble. Post the code.
[lua]for key,death in pairs(DeathKey) do
if death ["sid"] == p:SteamID() then
table.remove(DeathKey, key)
end
end[/lua]
When I should not use table.remove, what should I use instead to remove a table value?
Can you somehow physically push around props created with ents.CreateClientProp on the client? I managed to spawn one and it falls down, but i can't seem to get PhysObj:ComputeShadowControl to work on it - is that even possible?
Edit:
i want to try to use this to predict source engine physics on the client, is that a super dumb idea? Does anyone have a better one?
[QUOTE=mcNuggets1;52014765]
for key,death in pairs(DeathKey) do if death ["sid"] == p:SteamID() then table.remove(DeathKey, key) endend
When I should not use table.remove, what should I use instead to remove a key?[/QUOTE]
If this table is an array (indexes are all numbers, starting with 1 and ending with #DeathKey) then you can loop through backwards like this.
[lua]for i = #Deathkey, 1, -1 do
if DeathKey[i].sid == p:SteamID() then
table.remove(DeathKey, i)
end
end[/lua]
If you want to loop forwards through the table out of curiosity, then you could just do this:
[lua]for i = 1, #Deathkey do
if DeathKey[i].sid == p:SteamID() then
table.remove(DeathKey, i)
i = i - 1
end
end[/lua]
Written from my phone so apologies for anything weird in advance.
[QUOTE=YourStalker;52014787]If this table is an array (indexes are all numbers, starting with 1 and ending with #DeathKey) then you can loop through backwards like this.
[lua]for i = #Deathkey, 1, -1 do
if DeathKey[i].sid == p:SteamID() then
table.remove(DeathKey, i)
end
end[/lua]
If you want to loop forwards through the table out of curiosity, then you could just do this:
[lua]for i = 1, #Deathkey do
if DeathKey[i].sid == p:SteamID() then
table.remove(DeathKey, i)
i = i - 1
end
end[/lua]
Written from my phone so apologies for anything weird in advance.[/QUOTE]
Thanks for your reply.
You helped me alot.
[QUOTE=YourStalker;52014787]
If you want to loop forwards through the table out of curiosity, then you could just do this:
[lua]for i = 1, #Deathkey do
if DeathKey[i].sid == p:SteamID() then
table.remove(DeathKey, i)
i = i - 1
end
end[/lua]
[/QUOTE]
This wouldn't work as changing `i` won't affect the next iteration. This would work
[code]
local offset = 0
for i = 1, #DeathKey do
i = i - offset
if DeathKey[i].sid == p:SteamID() then
table.remove(DeathKey, i)
offset = offset + 1
end
end
[/code]
Is there anything I can do against shit comments on the workshop? [url=http://i.imgur.com/gyeFku7.png]NSFW[/url]
:snip:
Has anyone tried to make timelapse before? I want to do it but can't think of any way to get around render.Capture freezing the game for too long.
render.RenderView: 0.00083132495205973
file.Open: 0.00059617530155265
render.Capture: [b]0.32436675617851[/b]
f:Write: 0.0016137484362844
f:Close: 0.00010685876281968
total time: 0.32751486363122
That's for PNG at my resolution of 1920x1200. Jpeg (quality 90) is faster, but still not good enough, clocking in at 0.13661651348229.
Is there any other way to capture a screenshot from Lua? Pressing F5 for a jpeg screenshot has similar lag to the jpeg above, but pressing F12 for a Steam Overlay screenshot seems to produce far less lag, so something is apparently different with it. Or I'm just seeing a difference when it isn't there, I dunno.
ANYWAY, any way to capture screenshots other than render.Capture? FWIW I am comfortable working with custom render targets and the like.
[QUOTE=NeatNit;52015210]Has anyone tried to make timelapse before? I want to do it but can't think of any way to get around render.Capture freezing the game for too long.
render.RenderView: 0.00083132495205973
file.Open: 0.00059617530155265
render.Capture: [b]0.32436675617851[/b]
f:Write: 0.0016137484362844
f:Close: 0.00010685876281968
total time: 0.32751486363122
That's for PNG at my resolution of 1920x1200. Jpeg (quality 90) is faster, but still not good enough, clocking in at 0.13661651348229.
Is there any other way to capture a screenshot from Lua? Pressing F5 for a jpeg screenshot has similar lag to the jpeg above, but pressing F12 for a Steam Overlay screenshot seems to produce far less lag, so something is apparently different with it. Or I'm just seeing a difference when it isn't there, I dunno.
ANYWAY, any way to capture screenshots other than render.Capture? FWIW I am comfortable working with custom render targets and the like.[/QUOTE]
How exactly do you want to make a time-lapse, and of how much time?
You could always use startmovie/endmovie to get .tga files as output
I need to do it from Lua. But you made me find [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/video/Record]video.Record[/url] which is certainly a step in the right direction! :)
[QUOTE=NeatNit;52015254]I need to do it from Lua[/QUOTE]
You can (I think, I'm still not sure I get you)
RunConsoleCommand( "startmovie", "timelapse_folder/timelapse_image_" )
I also need to capture it from a different perspective than the gameplay one. I'm pretty sure IVideoWriter is what I need. Thanks for your help regardless!
Is there a way to block certain areas of a map, sort of like a clipbrush?
I want to stop people from falling into a death pit on ttt_subway_ag.
At the same time, I dont want to modify the mapfile and instead do it through LUA.
There has to be nothing visible, even neglecting prediction should be fine.
I tried using func_brush entities, but after some reading it seems like the wrong aproach.
How could I accomplish this?
Expecting hate, but what are a few different ways of obfuscating code? Just for experimentation on my end, I like the concept of stuff like this and trying to break it in different ways.
[QUOTE=VeXan;52016140]Expecting hate, but what are a few different ways of obfuscating code? Just for experimentation on my end, I like the concept of stuff like this and trying to break it in different ways.[/QUOTE]
Using a minifier is probably the easiest way to obfuscate code.
:snip:
[QUOTE=VeXan;52016140]Expecting hate, but what are a few different ways of obfuscating code? Just for experimentation on my end, I like the concept of stuff like this and trying to break it in different ways.[/QUOTE]
Check out [URL="http://code.matthewwild.co.uk/squish/"]Squish[/URL]
It's not great due to limitations (or lack thereof) of lua, and it's not really meant for obfuscation, but it's probably the best lua obfusticator that exists right now.
[QUOTE=YourStalker;52017625]The online Lua demo says otherwise!
:snip:[/QUOTE]
That is because it's removing element 3, then checking if element 4 is equal to "not", which it isn't because element 4 is nil because removing element 3 shifted it down into element 3's position.
You could've seen this if you tried to remove 2 elements that were right after one another
[t]http://i.imgur.com/lvNZ2Un.png[/t]
Also could've just tested if changing the variable actually affected the loop,
[t]http://i.imgur.com/XcWPV3t.png[/t]
[QUOTE=bigdogmat;52017659]That is because it's removing element 3, then checking if element 4 is equal to "not", which it isn't because element 4 is nil because removing element 3 shifted it down into element 3's position.
You could've seen this if you tried to remove 2 elements that were right after one another
[t]http://i.imgur.com/lvNZ2Un.png[/t]
Also could've just tested if changing the variable actually affected the loop,
[t]http://i.imgur.com/XcWPV3t.png[/t][/QUOTE]
Holy shit, didn't even see your post and we have the same example.
[t]https://i.gyazo.com/66ca4f43d5c44e83fd7d608639724aed.png[/t]
If this were to work we'd have an infinite loop, as i would increment by the default amount which is 1 and then decrement by the set amount, which is also 1.
But yes, you are correct. Any change you make to i will not effect the loop.
I have been defeated.
[QUOTE=NeatNit;52015254]I need to do it from Lua[/QUOTE]
Are you sure? Have you tried ShadowPlay before? It's really fantastic
[QUOTE=MPan1;52017791]Are you sure? Have you tried ShadowPlay before? It's really fantastic[/QUOTE]
Yes I'm sure, I don't want to record a timelapse of gameplay, I want to record a timelapse from a camera.
I got distracted last night and didn't get a chance to test IVideoWriter yet but it seems perfect for my needs. You can write frames whenever and control everything. However I get a bit lost when I need to choose between webm and ogg, or vp8 and theora. I've found no comparisons or pros/cons of each online, so if anyone has a good source or explanation that would be great. I'll probably end up exposing it all to the user, but I want to have good defaults.
[QUOTE=NeatNit;52017806]I've found no comparisons or pros/cons of each online, so if anyone has a good source or explanation that would be great.[/QUOTE]
[URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/menu/video.lua#L26-L28"]I'd probably just use the ones Garry decided to use[/URL]
[editline]27th March 2017[/editline]
[URL="https://github.com/garrynewman/garrysmod/blob/784cd57576d85712fa13a7cea3a9523b4df966b0/garrysmod/lua/menu/demo_to_video.lua"]Also, here's a big thing that is probably as useless as what I've already said[/URL]
Does anyone understand render.OverrideBlendFunc?
[QUOTE=VeXan;52016140]Expecting hate, but what are a few different ways of obfuscating code? Just for experimentation on my end, I like the concept of stuff like this and trying to break it in different ways.[/QUOTE]
[url]https://github.com/jkusner/LuaObfuscator[/url]
Uses characters only visible in ASCII text encoding.
Uses a similar technique as Caesar shift to encrypt strings.
Puts all the code on a single line.
If you really wanted to stop people understanding your code without having to try you could use offsets to get functions but that only works with builtin functions from what I tested and can vary in different versions and OSs
More of a Source thing than a Garry's Mod thing, does anyone know if I can get an [url=https://developer.valvesoftware.com/wiki/Env_projectedtexture]env_projectedtexture[/url] to project orthographically? The clientside version has [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ProjectedTexture/SetOrthographic]ProjectedTexture:SetOrthographic[/url], but I already implemented my thing serverside with env_projectedtexture and for now prefer it to be serverside so it shows up for all players.
Basically I suspect that env_projectedtexture might have this feature but not have it documented on the wiki, how would I dig deeper?
Edit: I always forget that the Source source code is available on github at [url]https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/server/env_projectedtexture.cpp[/url] but sadly I can't find anything :(
But based on this (and the client file) I have no idea how the clientside version does it either I've actually never tried it I think, maybe it doesn't even work...?
[QUOTE=NeatNit;52017806]Yes I'm sure, I don't want to record a timelapse of gameplay, I want to record a timelapse from a camera.
I got distracted last night and didn't get a chance to test IVideoWriter yet but it seems perfect for my needs. You can write frames whenever and control everything. However I get a bit lost when I need to choose between webm and ogg, or vp8 and theora. I've found no comparisons or pros/cons of each online, so if anyone has a good source or explanation that would be great. I'll probably end up exposing it all to the user, but I want to have good defaults.[/QUOTE]
Bleh. Just tested it, it freezes the game just as much as render.Capture does. I guess it's impossible to make a timelapse in-game. :cry:
Sorry, you need to Log In to post a reply to this thread.