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: How do I use coroutine.create()??

Previous Thread :: Next Thread 
bikerking200 is not online. bikerking200
Joined: 11 Mar 2010
Total Posts: 5047
10 Jan 2012 05:27 PM
Title.

http://www.roblox.com/Script-maker-Plugin-item?id=69451350
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
10 Jan 2012 05:28 PM
local mycoroutine = coroutine.create(function() blah blah blah end)
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
10 Jan 2012 05:28 PM
http://wiki.roblox.com/index.php/Beginners_Guide_to_Coroutines
Report Abuse
bikerking200 is not online. bikerking200
Joined: 11 Mar 2010
Total Posts: 5047
10 Jan 2012 05:32 PM
Ty.

http://www.roblox.com/Script-maker-Plugin-item?id=69451350
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
10 Jan 2012 06:15 PM
I suggest using anonymous coroutines,
unless completely necessary.
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
10 Jan 2012 06:16 PM
Wait,
don't use coroutines;
use Spawn() instead.

It's more easy to work with,
especially debugging.
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
10 Jan 2012 06:22 PM
@SDuke
Lol, they have an error on that page.

    function core(a,b,c)
        print(a*b+c
    end
    
    new_thread=coroutine.wrap(core)
    
    new_thread(8,2,1)

@YourNeverSafe
Can it get any errors that happen within a connect line? The Spawn() function.

×TNS×
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
10 Jan 2012 06:24 PM
@TNS No, but it doesn't require as many characters as writing either coroutine.resume(coroutine.create(function() end)) or coroutine.wrap(function() end)
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
10 Jan 2012 06:24 PM
@YourNeverSafe
Btw, Wiki doesn't say it is an error handler, leading me to believe that it isn't...

×TNS×
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
10 Jan 2012 06:27 PM
AH EM GEE!!! Render!!! I thought you quit a while ago! So glad you are back, I have seen too many people using your scripts at my Script Builder :/

×TNS×
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
10 Jan 2012 06:27 PM
Coroutines,
get buggy more often.

Using spawn is much more easy;
though it lacks many capabilities.
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
10 Jan 2012 06:29 PM
"Wait,
don't use coroutines;
use Spawn() instead.
"


I'm sure coroutines have much more uses than the Spawn function even with the little documentation Roblox provides for it(Spawn). They both have there benifits though.

"It's more easy to work with,
especially debugging."

print(
coroutine.resume(corutine.create(function()
???
end))
)
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
10 Jan 2012 06:30 PM
*their
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
10 Jan 2012 06:32 PM
"I'm sure coroutines have much more uses than the Spawn function even with the little documentation Roblox provides for it(Spawn). They both have there benifits though."

I'm guessing that was a late post. :3

The only reason I "switched",
was because I couldn't use a simple wait().

I could use coroutine.yield(),
but some were working.

I've been told there are other problems,
but haven't done the research.

I'm guessing all my statements are false :D (besides the wait()).
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
10 Jan 2012 06:35 PM
"The only reason I "switched" was because I couldn't use a simple wait()."

You can use wait() in a coroutine...

"I WILL GIVE YOU BACON." - Deadmau5
~Scarfacial
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
10 Jan 2012 06:36 PM
"I'm guessing all my statements are false :D (besides the wait())."

Yup. As far as I've heard you only get problems with wait() when using coroutines but thats just about it.

"I could use coroutine.yield(),
but some were working."

Probably an error in your script. Again 'print()'

My last post was late btw
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
10 Jan 2012 06:37 PM
@Scar i havent been getting the problem but i heard about some peoples coroutines not working right when they used wait?
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
10 Jan 2012 06:38 PM
I've used wait() just fine in coroutines.
The only time I've had issues with wait() is within a pcall.

"I WILL GIVE YOU BACON." - Deadmau5
~Scarfacial
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
10 Jan 2012 06:41 PM
http://www.roblox.com/Forum/ShowPost.aspx?PostID=60902660
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
10 Jan 2012 06:46 PM
@thenew

I checked every script before putting it in that article. It must have been one of those idiot writers that would break everything trying to make changes that shouldn't be made.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
10 Jan 2012 06:49 PM
@TNS I did quit. Just dropping in. As for my scripts, I released my Archive under my alt TheKingOfIce if you want to take it.
Pertaining to the error handling:It does. bool,er = coroutine.resume(coroutine.resume(function() error("Hi!") end)) print(bool and er or "Nope") should work. I think it will only throw compile-time errors though.
Report Abuse
Jaccob is not online. Jaccob
Joined: 19 Oct 2008
Total Posts: 986
10 Jan 2012 06:52 PM
Reason why wait doesn't work with coroutines is because they pass on any arguments given to them such as coroutine.yield which if a wait was there, would pass it on and resume it's duty. I believe delay() should work, not sure you can try that if you want.

Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
10 Jan 2012 06:54 PM
@thenew
I fixed the change you asked for and also added code lua tags, just waiting for them to be aproved.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
10 Jan 2012 06:56 PM
@Jaccob
Wait DOES work with coroutines. That is how nearly all errorchecking SBs work without breaking with wait on a pcall.
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
10 Jan 2012 06:56 PM
@ Jaccob

Not a bad idea,
but I never knew of Spawn() before I had trouble;
and as of now Spawn() is the best of use in my code.
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