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: Alright, checking if I am using this right...

Previous Thread :: Next Thread 
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:13 PM
Since "someone" doesn't like this sort of a post on the Scripter's Forum... -_-

I'll need to retype it.

function Gather()
print "Yes or No"
end

function Start()
ypcall(Gather)
end

script.Parent.Activated:connect(Start)

I am not sure if this is the correct way to use ypcall() in a script. Is it possible to do:


script.Parent.Activated:connect(ypcall(Gather))

If you have any methods of using this, please offer suggestions. The wiki shows what it does rather well, but it doesn't give an example of a real application to model off of.

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
12 Jan 2013 04:17 PM
ypcall(function()
Game.Workspace.Building:Destroy()
end))

This would destroy something, and if it's not there, continue on with the script without breaking.

It's basically used to catch errors.

-- A fry without salt is like a world without hate.
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:18 PM
I know what it does, and I know I can do it like that... But I wanted to connect an event to a functioning that is run inside of ypcall.

I don't want to run a function when a script is initialized.

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
12 Jan 2013 04:22 PM
Coroutines are useful.

-- A fry without salt is like a world without hate.
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:25 PM
Never used them before.

... :/

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
12 Jan 2013 04:29 PM
http://wiki.roblox.com/index.php/Coroutine

-- A fry without salt is like a world without hate.
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:31 PM
Coroutines don't accomplish what I need to accomplish.

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:32 PM
Yeah, I do know how to use the wiki, :/

Those are for running multiple things at once, which is not useful for me, since I haven't need to go beyond Delay(time,function).

ypcall does something completely different, unless I missed something. :/

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
12 Jan 2013 04:32 PM
You can resume it with such said event...

-- A fry without salt is like a world without hate.
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:36 PM
...

So, you want me to run the ypcall(function) with a coroutine...

That'd require another function to call a coroutine method when the event runs. It seems to add a step... I guess I'll test the idea of putting it right on the event listener creator, or event connection, and see how it works.

I don't like nesting it in a pointless function to get it to work how I want it to.

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
8SunTzu8 is not online. 8SunTzu8
Joined: 30 Sep 2011
Total Posts: 8199
12 Jan 2013 04:45 PM
:/

Doesn't seem like anyone uses ypcall. (Heck, I was talking to the person the moment he found it and updated the wiki, while on the forums). Seems unknown.

"If you want to become a Developer or Innovator for CSA, contact me."
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
12 Jan 2013 04:52 PM
I'm not entirely sure of what you want it to do. If this is wrong, please explain better.

function Gather()
local workspace = Game.Workspace:GetChildren()
for i,v in pairs(workspace) do
print(v.Name)
end
end

Game.Workspace.ChildAdded:connect(function(child)
ypcall(Gather())
end)

-- A fry without salt is like a world without hate.
Report Abuse
Saltless is not online. Saltless
Joined: 24 Dec 2012
Total Posts: 107
12 Jan 2013 04:53 PM
But really, there's not much uses to it if you know what's inside your game.

-- A fry without salt is like a world without hate.
Report Abuse
CSARepresentative is not online. CSARepresentative
Joined: 30 Sep 2012
Total Posts: 1
12 Jan 2013 05:07 PM
In this case, it's a mining tool of sorts, and I don't want it to break, in case anything funny happens.

Places are very dynamic, and this will be no exception.

Anyway, I guess there's no simpler way to do it besides an ambiguous function then. I don't really like those... :/

"If you want to become a Developer or Innovator for CSA, contact me."
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