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: Best Practices??

Previous Thread :: Next Thread 
InfectionCreator is not online. InfectionCreator
Joined: 23 Apr 2010
Total Posts: 25
24 Mar 2015 09:06 AM
Hey guys! I've been scripting for about a month now and have gotten pretty good. (Currently making an Admin GUI Console kinda like a terminal...) I just wanted to see what you all thought were some best practices so I can not get into any bad habits lol Thanks in advance guys!
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
24 Mar 2015 09:09 AM
Best Practices:

1. Practice
2. Stumped? come here and learn.

that's what I do!
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Mar 2015 09:12 AM
These are just a few of my opinions, only the ones that come to mind, and most of them are based on things I see done quite often on the forums.

Concatenating blank strings:
local h = "" .. str .. num .. ""

Unnecessary and ugly comparisons:
if firstchild ~= nil then
if bool == true then

Using "elseif" where an "else" should be used:
if bool == true then
elseif bool == false then

I will tell you more if I think of any more, but for now have some links.
http://wiki.roblox.com/index.php?title=Writing_Clean_Code
http://blog.roblox.com/2012/05/using-wait-wisely/
Report Abuse
Scripterity is not online. Scripterity
Joined: 30 Mar 2014
Total Posts: 677
24 Mar 2015 09:13 AM
Well ^ + Wiki, learn to use the wiki it's a valuable place of knowledge. You learn a lot from here and the wiki. Always check old posts before you post one on figuring out something.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Mar 2015 09:13 AM
Oh, I thought you said "Bad practices".
My bad.

Avoiding those are good practices.
Report Abuse
InfectionCreator is not online. InfectionCreator
Joined: 23 Apr 2010
Total Posts: 25
24 Mar 2015 09:20 AM
Lol thanks guys! and I will definitely check out them links JarodOfOrbiter!
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
24 Mar 2015 09:31 AM
Do you also SSH into your Admin Terminal too?


Total Posts: 404 ---------- Not Found
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
24 Mar 2015 09:37 AM
use filtering

filteirng is luv
filtering is life
filtering is bae

⬡
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
24 Mar 2015 09:58 AM
why would you tell him to use fe
he cant script so ur only making it harder for him
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
24 Mar 2015 10:06 AM
if he's 'pretty good,' he should be able to use it

⬡
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
24 Mar 2015 10:08 AM
@above not unless filtering breaks your game after you have spent 1000 lines of code in it. You can't just change it after that to suit the needs of FE.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
24 Mar 2015 10:09 AM
My bad habit is defining the wrong variables or none at all. Do not do that, it will ruin your life and time.
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
24 Mar 2015 10:11 AM
ofc, so start using filtering early and you'll never have to worry about that.

⬡
Report Abuse
InfectionCreator is not online. InfectionCreator
Joined: 23 Apr 2010
Total Posts: 25
24 Mar 2015 10:32 AM
I would just like to say I can script (cough BothAngels cough) some advanced things are still out of reach but only been at this for like a month... I will take a look at filtering on the wiki and probably learn it pretty quick!
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
24 Mar 2015 10:40 AM
Start using FIltering enabled. (It's much easier than it looks)

Seperate your code into
>Variables
>Functions
>Code


Report Abuse
InfectionCreator is not online. InfectionCreator
Joined: 23 Apr 2010
Total Posts: 25
24 Mar 2015 10:42 AM
Oh well I already do that lol
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Mar 2015 10:45 AM
"Seperate your code into
>Variables
>Functions
>Code"
Functions ARE variables.

Also, using local variables is a good practice.
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
24 Mar 2015 10:47 AM
You know what i meant.
but you don't want to put functions then some variables then functions.
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
24 Mar 2015 10:48 AM
Oh yea use local variables whenever you can. When I was new i never did and it took some time getting use to it.
Report Abuse
InfectionCreator is not online. InfectionCreator
Joined: 23 Apr 2010
Total Posts: 25
24 Mar 2015 10:50 AM
Well I do that too lol the only thing I was doing 'badly' was this:

if (someVar == true) then
--stuff
end

So i'll change that

@JarodOfOrbiter > That link on wait() was really useful!
Report Abuse
notfruit is not online. notfruit
Joined: 21 Sep 2012
Total Posts: 1386
24 Mar 2015 11:03 AM
< sarcasm >
brotip: make sure to always use OOP somehow, even if you don't need it. Remember, code like:

printer = new Printer()
printer:print("Hello World!")
printer:newLine()

is always better than:

print("Hello World!")

< /sarcasm >

I honestly don't know where this infatuation with OOP comes from.

If you want to *git gud* at programming, watch the SICP Lectures from MIT OpenCourseWare, and maybe read the book for free on the internet. Be careful, it has some heavy maths.
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
24 Mar 2015 11:21 AM
"printer = new Printer()
printer:print("Hello World!")
printer:newLine()

is always better than:

print("Hello World!")"

How is that better.. just doing print() is 1 line and easier because it just executes print() then instead of other uselessness


Total Posts: 404 ---------- Not Found
Report Abuse
notfruit is not online. notfruit
Joined: 21 Sep 2012
Total Posts: 1386
24 Mar 2015 11:50 AM
@NovusTheory

did u not see my failed attempt at using html elements called "sarcasm"?
Did u not see what was below?
do u evn kno how 2 read
omg i cant

It was sarcasm.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
24 Mar 2015 11:52 AM
Thanks. Oh by the way, if you read the comments there, you might facepalm or find it amusing or both. For me it was both.
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