Team Spartan Cookies & Milk Forums
Does that e2 function exist in starfall? - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Does that e2 function exist in starfall? (/thread-1495.html)



Does that e2 function exist in starfall? - esitee - 22-12-2015

Hi, I already asked certain people, if theire is something like e2's
Code:
changed()
in starfall. I could imagine some situations where it would be pretty usefull.

If it ( or something that equals it ) doesn't already exists, could you please add it?

Thank you


RE: Does that e2 function exist in starfall? - SuperPlayer - 22-12-2015

This function does not exist in Starfall because of how starfall works. If you need to check if some value has changed you will have to write your own function with if statements.
As an example( I know formatting is ugly, i am writing from my phone)

function changeState(Arg)
local NewState = Arg
-- Do stuff you want to do here
end

This function can be modified for any needs. If you have questions feel free to ask.


SuperPlayer


RE: Does that e2 function exist in starfall? - esitee - 22-12-2015

Thank you Big Grin


RE: Does that e2 function exist in starfall? - Person8880 - 22-12-2015

You shouldn't really be working like this in Starfall. You have events which tell you when "things" happen, and that's your point of change. If you find yourself constantly checking if values are changed you're usually doing something wrong.

For example, for wire inputs, you use the "input" event:
hook( "input", "OnInputChanged", function( Key, Value )
-- The input with name stored under Key now has the value stored under Value.
end )

There's plenty of events to get most changes you'd be interested in. Of course, there's a few cases where there's not an explicit event, but then we'd need to know what you're trying to accomplish to help more.


RE: Does that e2 function exist in starfall? - esitee - 23-12-2015

Ok, thank you Person. This helps me a lot.