NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 06:40 PM |
I want to be able to easily refer to triggered events in one script. Currently if I want to change a property of an object I have to create a function telling the property to change and create an event connector like this;
script.Parent.X.Y:connect(Z)
But I want to be able to use it like this.
if script.Parent.X.Y=true then etc...
if there is a way I could do this or something similar then it would be much appreciated. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Sep 2013 06:40 PM |
| script.Parent.Blah.Changed? |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 06:42 PM |
object.Changed:connect(function(p) -- Ask if p is the correct property end) |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 06:44 PM |
| What I'm asking is if I could directly affect properties with an event. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Sep 2013 06:44 PM |
You could use an anonymous function:
x.y:connect(fuction(z) -- stuff; end);
or, you can use a loop:
while true do x.y:wait(); -- stuff; end; |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 06:49 PM |
| Ooh. rather brilliant. Let me try it out. thanks! |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:06 PM |
| This is promising but it would be ideal if I was able to do an if x.y=true then etc... ordeal. I could manage without it but it would be helpful. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Sep 2013 07:06 PM |
What the heck is x.y = true? Is x an object and y a boolean value and don't you mean "==" ?? |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 10 Sep 2013 07:08 PM |
no idea if this would work but object.Event:connect(object.Transparency=1) |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:08 PM |
| x=object, y=trigger and sorry, I did mean == |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 10 Sep 2013 07:11 PM |
| Events are userdata, not functions. They are C-sided classes; you can't write a function that does the same thing as an event. |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
| |
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:13 PM |
| Then is there a way I can use those events to directly affect the properties of an object? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Sep 2013 07:13 PM |
| So you want to check if an event is true, or if it's just not false/nil? |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:16 PM |
| Both. for instance; the Event Jumping doesn't have a counter Event. therefore if I wanted a light to turn on when you are jumping that is simple enough. But turning it off again when you stop jumping is a different matter. I want to find out how I could do that. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Sep 2013 07:17 PM |
Humanoid: does have a jumped event. http://wiki.roblox.com/index.php/Jumping_(Event) |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:19 PM |
| I know but it doesn't have a counter event like MouseHoverEnter has MouseHoverLeave. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 10 Sep 2013 07:20 PM |
| Events don't have "counter events." An event is triggered when something happens. When it "stops happening" isn't relevant. |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:23 PM |
| I am not communicating this well apparently. I want something to change once an Event stops happening! Once I stop Jumping I want a light to turn off. |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:24 PM |
| So yes. It is very relevant. |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 10 Sep 2013 07:32 PM |
| If you click a clickdetector then an event is fired. There is no event for when you "stop clicking it," that doesn't make any sense. Humanoid.Idle should suffice for you. |
|
|
| Report Abuse |
|
|
NastyDax
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 71 |
|
|
| 10 Sep 2013 07:39 PM |
| Not for what I'm planning. I am not completely void of intelligence and I would appreciate it if you would treat people as such. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 07:47 PM |
Humanoid.Jump.Changed:connect(function(value) if (value) then -- stuff; else -- stuff; end; end); |
|
|
| Report Abuse |
|
|