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 » Scripting Helpers
Home Search
 

Re: Easiest scripting assistance you'll ever give.

Previous Thread :: Next Thread 
Splecki is not online. Splecki
Joined: 31 Dec 2009
Total Posts: 5487
09 Aug 2012 08:18 PM
Mhmm, yes, Lua is as foreign to me as Korean. Yes, I may go to the wiki and learn it these days but I have a clan to lead, so in the following script, how and where could I add the "IsInGroup" ID thing so that only players of a certain group could obtain the badge?:

BadgeId = 1337

game.Players.PlayerAdded:connect(function(p)
wait(7200)
b = game:GetService("BadgeService")
b:AwardBadge(p.userId,BadgeId)
end)

Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:18 PM
game.Players.PlayerAdded:connect(function(p)
if not p:IsInGroup(Group id) then return end
wait(7200)
b = game:GetService("BadgeService")
b:AwardBadge(p.userId,BadgeId)
end)
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:18 PM
BadgeId = 1337

game.Players.PlayerAdded:connect(function(p)
wait(7200)
if p:IsInGroup(INSERT_YER_GROUP_ID_HERE_LOLOLOL) then
b = game:GetService("BadgeService")
b:AwardBadge(p.userId,BadgeId)
end
end)
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:20 PM
ewww swmanic uses "return end" hax but made me realize that i could make mine better:
BadgeId = 1337

game.Players.PlayerAdded:connect(function(p)
if p:IsInGroup(INSERT_YER_GROUP_ID_HERE_LOLOLOL) then
wait(7200)
b = game:GetService("BadgeService")
b:AwardBadge(p.userId,BadgeId)
end
end)



mine is ugly than sw's
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:21 PM
@DrAgonmoray

What's wrong with return end hax?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:23 PM
it's just so ugly :(


plus it probably makes the script leik 1 ms laggier
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:24 PM
Wait

10 lines of

if not Condition1 then return end
if not Condition2 then return end
...
if not Condition10 then return end

Is less ugly than?

if Condition1 and Condition2 and Condition3 and Condition4 and Condition5... then

...
end
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:26 PM
if not Condition1 then return end
if not Condition2 then return end
...
if not Condition10 then return end


= ugly


if Condition1 and Condition2 and Condition3 and Condition4 and Condition5... then

...
end


= pretty
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:27 PM
In what universe?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:30 PM
:(

i think this should go to Scripters to see what the popular opinion is
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:31 PM
...because Scripters needs EVEN MORE SPAM! :D


Can we compromise and say

if not Condition then return end

Is a necessary evil when there are 10 and to be avoided when there are less than 3?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:37 PM
No, we can't, because I believe the opposite o_o
I think it becomes less necessary the more you have. Why have 10 if's when you can have one, with short-circuit evaluation? like srs, you're developing bad habits
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:42 PM
Can I point out that

if not Condition then return end

Is also short circuited by virtue of the return statement?

Why have 10 ifs when you can have one?
Because it's easier to read?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:45 PM
Now I'm confused.

What point are you arguing? O_O
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:47 PM
I mean I guess you could have

if Condition1
and Condition2
and Condition3
and Condition4
...
then

And have it not be illegible but then you get issues with something like this:

if Conditon1
and Condition2
and Condition3
or Condition4

And it's perfectly possible to skip over the or because you assume: Ok, I know this amount of every line is going to be and so I can start reading here... wait why's this not working?
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:48 PM
...I think this conversation has passed the point of being a useful discussion.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:49 PM
I believe that a single if-statement is prettier than "return end" in any scenario.


also, i just figured out what you were talking about with the return end short circuiting the others lol
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:51 PM
I think it depends on the scenario.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:52 PM
Try me
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:54 PM
When using 10 different conditionals.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
09 Aug 2012 08:57 PM
I'd like to point out we've been arguing for half an hour about which of two programming constructs that accomplish the same task is better.
Report Abuse
Splecki is not online. Splecki
Joined: 31 Dec 2009
Total Posts: 5487
09 Aug 2012 09:32 PM
o.o maybe you should join Valor Legion and call it a draw
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
09 Aug 2012 09:43 PM
^^

Get out

~repeat wait() until script.Parent:HasALife()
Report Abuse
Splecki is not online. Splecki
Joined: 31 Dec 2009
Total Posts: 5487
09 Aug 2012 09:45 PM
@thedeath, :(
you are confirming the snobby scripter stereotype btw
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 09:56 PM
I joined :3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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