|
| 25 Jun 2015 04:44 PM |
| Just wondering what other people are doing. |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
| |
|
|
| 25 Jun 2015 04:46 PM |
If people stop updating a game, or don't want to touch the code ever again, they sometimes use Stravants Lua Minifier, which you can use to make the code more compact, and slightly, slightly more efficient (says on the description).
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Jun 2015 04:47 PM |
function doSomething(input) return"No." end |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
Dynerov
|
  |
| Joined: 21 Jul 2014 |
| Total Posts: 14682 |
|
|
| 25 Jun 2015 04:47 PM |
| I don't really make that efficient of code. I'm sorry, but I'm not the best scripter, but I know what I'm doing most of the time. |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Jun 2015 04:47 PM |
| Ohh nice to hear i have hatsune miku picture hanging at my wardrobe |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 04:47 PM |
| Think outside of the box about how to make the code smaller. Smaller code is better code, it is easier to read and doesn't take as long to script. |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Jun 2015 04:48 PM |
function doSomething(input) return"No." end
doSomething("Think outside the box") |
|
|
| Report Abuse |
|
|
tbnj123
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 443 |
|
|
| 25 Jun 2015 04:49 PM |
| i sit in an awkward position in my chair. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 04:49 PM |
^
Err not really. It's more efficient. BUT WHERE YOU GOT IT EXTREMELY WRONG. Is it becoming 'easier' to read...
Smaller Code = Harder to read.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Jun 2015 04:51 PM |
print("H".."e".."l".."l".."o") print("Hello") |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 04:51 PM |
| smaller code ha ? I prefer people with simpler code i hate who is mixing his code alot. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 04:56 PM |
I've just learned various techniques over the years to write good Lua code. Trial and error. If one thing doesn't work very well, rewrite it and think intuitively as to why it works differently one way versus another.
I try to think about the performance of the code. For instance, if it's code that is being ran every frame, then I want to make sure that the code is optimized and I'm running as little code as possible. If it's being ran every 10 seconds, I don't need to worry about that as much. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 25 Jun 2015 05:09 PM |
| I use my brain. I happen to be in possession of one of those, but it shuts down and the developers limit the affinity of it to 6 cores when it's past 9pm to save power. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 09:56 PM |
I rent a VPS from eLunate and I use logic.
-Ticker of da Tocks |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
| |
|
|
| 25 Jun 2015 10:08 PM |
To make it easier to edit I leave little comments to say which line does what and where something begins and ends and etc.
u sicko! |
|
|
| Report Abuse |
|
|
vacha
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 1993 |
|
|
| 25 Jun 2015 10:20 PM |
I rent my brain from eLunate (she has some good deals)
while true do the do |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 11:42 PM |
| Make sure you comment. Comment comment comment. Say what each section does. If you don't, and someone else looks at it, or even yourself a couple days later, you'd say "Well, I hardly have a clue what this does." If you comment, when finished with your code, you can condense it. Also, if someone already coded something and put it out there for you to use, use it. Real programmers do this all the time. Why would you rewrite the code to save some strings as a text file when you can download a library and simply follow the instructions given. Obviously, it isn't as simple with the environment that roblox gives you, as far as I know you can't call a library, but you won't even have to touch some of the code once you adapted it for your purpose. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 11:44 PM |
Dont do this!
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false) local maxspeed = 35 local uis = game:GetService("UserInputService") local toolstats = require(game.ReplicatedStorage.Stats) repeat wait() until game.Players.LocalPlayer local player = game.Players.LocalPlayer local mouse = player:GetMouse() local camera = workspace.CurrentCamera local currenttool = player.CurrentTool local character = player.Character local hrp = character:WaitForChild("HumanoidRootPart") local humanoid = character:WaitForChild("Humanoid") local head = character:WaitForChild("Head") camera.CameraType = "Scriptable" humanoid.WalkSpeed = maxspeed character:WaitForChild("Health").Disabled = true for _,v in pairs(character:GetChildren())do if v:IsA("BasePart") then if not string.find(v.Name,"Leg") then v.Friction = 0 else v.Friction = 2 end end end game["Run Service"]:BindToRenderStep("Camera",1,function() camera.CoordinateFrame = CFrame.new(0,30,0) * CFrame.Angles(math.rad(-89.9),0,0) + hrp.Position hrp.CFrame = CFrame.new(hrp.Position,Vector3.new(mouse.X-(mouse.ViewSizeX/2),hrp.Position.Y,mouse.Y-(mouse.ViewSizeY/2))) hrp.Velocity = Vector3.new(math.min(maxspeed,hrp.Velocity.X),math.min(1,hrp.Velocity.Y),math.min(maxspeed,hrp.Velocity.Z)) end) humanoid.Changed:connect(function() humanoid.Jump = false end) local anim1 = nil local anim2 = nil local shootanim = nil local holdanim = nil local stats = nil local rpm,type,ammo local punchanim = humanoid:LoadAnimation(script.Punch) currenttool.Changed:connect(function() local val = currenttool.Value if val then if val.ClassName == "Tool" then stats = toolstats[val.Name] rpm = stats[5] type = stats[1] ammo = val.Ammo anim1 = val.Shoot anim2 = val.Hold shootanim = humanoid:LoadAnimation(anim1) holdanim = humanoid:LoadAnimation(anim2) holdanim:Play() end else holdanim:Stop() end end) local clicking = false local shooting = false uis.InputBegan:connect(function(input,g) if not g then if input.UserInputType == Enum.UserInputType.MouseButton1 then clicking = true if currenttool.Value then while currenttool.Value and not shooting and clicking and ammo.Value > 0 do shooting = true if type ~="Hand" then ammo.Value = ammo.Value-1 end game.ReplicatedStorage.Fire:FireServer(unpack(stats)) shootanim:Play() wait(60/rpm) shooting = false if type ~= "Auto" then break end end else shooting = true game.ReplicatedStorage.Punch:FireServer() punchanim:Play() wait(.1) shooting = false end elseif input.UserInputType == Enum.UserInputType.MouseButton2 then end end end) uis.InputEnded:connect(function(input,g) if not g then if input.UserInputType == Enum.UserInputType.MouseButton1 then clicking = false end end end) mouse.KeyDown:connect(function(k) if k == "q" then if not currenttool.Value then currenttool.Value = player.Backpack.Handgun else currenttool.Value = nil end end end) |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2015 11:52 PM |
@joeyjoeyjoey
Could you comment please? |
|
|
| Report Abuse |
|
|