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: gg

Previous Thread :: Next Thread 
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 04:34 PM
Myth:

The name of the function (onTouched, onClicked) determines when it is triggered.

Fact:

The event the function is connected to determines when its triggered.

function onClicked()
print("This will work")
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
--
function Clicked()
print("This will work too.")
end

script.Parent.ClickDetector.MouseClick:connect(Clicked)
--
function onTouched()
print("You can even lie to it.")
end
script.Parent.ClickDetector.MouseClick:connect(onTouched)
--
function cookies()
print("See?")
end

script.Parent.ClickDetector.MouseClick:connect(cookies)
--
script.Parent.ClickDetector.MouseClick:connect(function()
print("There can even be no name at all!")
end)

Seriously, functions are just variables.
Just like

a = 4
print(a)
four = 4
print(four)
And print(4)

All print 4, those scripts will all connect correctly to a click detector..
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 05:15 PM
._.
Bump?
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
05 Sep 2011 05:19 PM
OMG really?! [/dripping with sarcasm/]
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
05 Sep 2011 05:20 PM
The wiki has poisioned the minds of our children. :(
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 05:22 PM
@city

As Point-Out-The-Obvious as it sounds, some people do believe this.
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
05 Sep 2011 05:22 PM
That is why the wiki is untrustable.
Report Abuse
stuntkid257 is not online. stuntkid257
Joined: 12 Jul 2010
Total Posts: 1394
05 Sep 2011 05:22 PM
Yeah, ok. :D
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
05 Sep 2011 05:23 PM
swamniac, pleast get your butt over to my forum thread :) Thank you.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 07:11 PM
lolbump?
Report Abuse
alexnewtron is online. alexnewtron
Joined: 15 Dec 2007
Total Posts: 1066
05 Sep 2011 07:21 PM
Haha, I know so many people who think you HAVE to type 'onTouched', when you can type 'poop' aswell.
Report Abuse
billwiw is not online. billwiw
Joined: 03 Sep 2008
Total Posts: 2765
05 Sep 2011 08:14 PM
Ikr
Report Abuse
braydenmiller123 is not online. braydenmiller123
Joined: 10 Apr 2011
Total Posts: 88
05 Sep 2011 08:24 PM



h





























































































































































































































































































































































































Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
05 Sep 2011 08:25 PM
^kthnxbai


-Like an __AWESOME__ boss
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
05 Sep 2011 08:51 PM
The wiki is still trustable. The only reason those terms are used is because it follows the lua style guidlines. I actually got in a bit of trouble for not following these rules because it can look fairly improfessional.

http://wiki.roblox.com/index.php/User_talk:Sduke524
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 08:54 PM
So perpetuating a myth about scripting that is ultimately bad for people's scripting ability < Style?
Report Abuse
BobGeorgenworn909 is not online. BobGeorgenworn909
Joined: 03 Apr 2008
Total Posts: 1161
05 Sep 2011 08:56 PM
Nice thread, swmaniac! I hope people will read it & learn
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 09:00 PM
I mean, seriously this myth exists and it gets in the way of people's understanding of scripting. For instance, one can't connect the same function to multiple events if it would mean naming the same function multiple things (suppose you could do function a() print("a") end function b() a() end but that's really... bad).

Also, what is more telling of a gun's functionality:
onButton1Down() or Fire()
ChangeMode() or KeyDown()

You can look at the connection line to see when these events fire, it's much harder to see what they actually do.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
05 Sep 2011 09:05 PM
The fact that you can use a name for any function or variable has been shown in the wiki many times. For example, how do you know about this? Whenever someone is just starting to learn to script, they'll first copy the scripts and test them out, then later edit it to do what they want. Only after feeling comfortable with this will they attempt to make their own from scratch, which includes individual names.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
05 Sep 2011 09:05 PM
I used to think that a long time ago, but then I realized you can name the function anything. This will be a very useful thread for inexperienced scripters.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 09:12 PM
"The fact that you can use a name for any function or variable has been shown in the wiki many times."

Evidently not visibly enough, the myth still exists.

The wiki needs restructuring. I don't know exactly how much or what would be the correct way, but from the number of people that say "The wiki doesn't help me" or words to that effect implies it needs work.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
05 Sep 2011 09:14 PM
And how exactly would you explain it better? The fact of the matter is if people say that it's because they aren't trying and want it handed to them on a silver platter.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 09:18 PM
Functions in particular, or scripting in general?

I'd explain variables as teaching the computer a word (and functions as teaching the computer a verb). That word can be anything and mean anything that you want it to.

function Verb(Information the Verb needs)
-- Definition of the word, what does it mean to do Word?

end

And for the connection line, I'd explain it as telling the computer that when something happens, it should perform the Verb.

And I'd do that in a somewhat less grammatically awkward way.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
05 Sep 2011 09:24 PM
And how would you fit in everything else about functions? You can only put so much into a tutorial before it gets too long, extraneous, and the reader losses interest and/or forgets the information. These points are brought up in every tutorial on the wiki about creating variables and/or creating functions.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 09:29 PM
I'm not sure what you mean about everything else.

Like anonymous functions?

Give the script a set of instructions rather than defining a word.

Recursive functions?

The verb needs to be done more than once, and is self continuing, like running:

function Run()
wait(.1)
TakeStep()
if not AtDestination() then
Run()
end
end

Separate different topics about functions into different tutorials branching off the one about their basic use.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
05 Sep 2011 09:33 PM
And on that note I think we've somewhat derailed the thread. If you'd like to continue this discussion can we do it over PMs rather than going off topic?
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