2DWorlds Forums
Could I get some examples of selected & deslected connections? - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13)
+--- Thread: Could I get some examples of selected & deslected connections? (/showthread.php?tid=1097)



Could I get some examples of selected & deslected connections? - Intile - 10-17-2010

I just started trying to mess with them a while ago but I can't figure out how to use them for the life of me. Here's what I have:

Code:
link(script.Parent.selected,
cam.FollowObject = car
cam.ScaleFactor = 50
end)

link(script.Parent.deselected,
cam.FollowObject = p.Parent.Body
end)

Yet I keep getting this error: (the portion of code I gave you begins at line 10)

Code:
[2010-10-17 17:43:24] Game.StarterInventory.Car.Drive: [string "Game.StarterInventory.Car.Drive"]:10: ')' expected near `=`

Any help would be greatly appreciated because I'm kind of getting frustrated with this.



RE: Could I get some examples of selected & deslected connections? - Jacob__mybb_import1 - 10-18-2010

It should be:
Code:
link(script.Parent.selected,
function()
cam.FollowObject = car
cam.ScaleFactor = 50
end)

or

Code:
function onSelected()
cam.FollowObject = car
cam.ScaleFactor = 50
end
link(script.Parent.selected, onSelected)

The second argument is a function, not just a piece of code.


RE: Could I get some examples of selected & deslected connections? - Intile - 10-18-2010

Oh wow I'm stupid. ahahaha
Thanks.