Community Forum

SpecializationUtil.callSpecializationsFunction

Forum Overview >> Scripting

CategoryScripting
Created27.10.2016 02:33


Tykonket (Unknown) 27.10.2016 02:46
What is the differences between doing these:
self.setFuelFillLevel = SpecializationUtil.callSpecializationsFunction("setFuelFillLevel");

and this:
self.setFuelFillLevel = Motorized.setFuelFillLevel;

Seems that they both, do the same!

Emil Drefers (Unknown) 27.10.2016 09:55
Hi,

by using the first method, the named function will be called on all specializations of that vehicle.

Cheers,
Emil

Tykonket (Unknown) 27.10.2016 11:09
Nice, so if in my spec i create a method (i.e. MySpecialization:setFuelFillLevel) it will be called?

Emil Drefers (Unknown) 28.10.2016 08:03
Hi,

yes that should be the case - just test it :)

Plenty of debug print()s might help.

Cheers,
Emil

Tykonket (Unknown) 28.10.2016 12:32
Yes yes, you are right, I was totally forgetting that Specialization scripts when added to a Vehicle become part of it xD


Note: Log in to post. Create a new account here.