generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What do you use to make ur code efficient ?

Previous Thread :: Next Thread 
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
25 Jun 2015 04:44 PM
Just wondering what other people are doing.
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
25 Jun 2015 04:45 PM
a toaster
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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 is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
25 Jun 2015 04:47 PM
function doSomething(input)
return"No."
end
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
25 Jun 2015 04:47 PM
potatoes
smegm butter
Report Abuse
Dynerov is not online. 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
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
25 Jun 2015 04:47 PM
I use fried bacon
Report Abuse
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
25 Jun 2015 04:47 PM
Ohh nice to hear i have hatsune miku picture hanging at my wardrobe
Report Abuse
BigThunderBoy is not online. BigThunderBoy
Joined: 23 Jun 2012
Total Posts: 125
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 is not online. 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 is not online. 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
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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 is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
25 Jun 2015 04:51 PM
print("H".."e".."l".."l".."o")
print("Hello")
Report Abuse
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
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
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
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 is not online. 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
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
25 Jun 2015 09:56 PM
I rent a VPS from eLunate and I use logic.

-Ticker of da Tocks
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
25 Jun 2015 10:06 PM
a brain
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
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 is not online. 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
TeamonIsBack is not online. TeamonIsBack
Joined: 16 Aug 2013
Total Posts: 1496
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
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
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
TeamonIsBack is not online. TeamonIsBack
Joined: 16 Aug 2013
Total Posts: 1496
25 Jun 2015 11:52 PM
@joeyjoeyjoey

Could you comment please?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image