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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 09 Aug 2012 08:21 PM |
@DrAgonmoray
What's wrong with return end hax? |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2012 08:23 PM |
it's just so ugly :(
plus it probably makes the script leik 1 ms laggier |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
| |
|
|
| 09 Aug 2012 08:30 PM |
:(
i think this should go to Scripters to see what the popular opinion is |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 09 Aug 2012 08:45 PM |
Now I'm confused.
What point are you arguing? O_O |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 09 Aug 2012 08:51 PM |
| I think it depends on the scenario. |
|
|
| Report Abuse |
|
|
| |
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 09 Aug 2012 08:54 PM |
| When using 10 different conditionals. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 09 Aug 2012 09:43 PM |
^^
Get out
~repeat wait() until script.Parent:HasALife() |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|