maimonides Posted March 25, 2013 Share Posted March 25, 2013 Simply put, how do I call world function from system function and vice versa via get_function? get_function seems only to work locally, which is a shame. Link to comment
Cristianwolf712 Posted March 25, 2013 Share Posted March 25, 2013 You can call a system function in every world class with engine.system.call(string function,variable arg0,variable arg01....). Same with world-function engine.world.call(string function,variable arg0,...). But be careful, the world function can only be called if a world is loaded, and the function exists in their .cpp-file. You can find more information at the documentation (Unigine-Script -> Engine Library -> Engine Functions -> engine.system or engine.world) Link to comment
maimonides Posted March 25, 2013 Author Share Posted March 25, 2013 Hi Cristian, Thanks for your answer. I am familiar with engine.*.call function and use it as you describe, but you misunderstood my query I think. I want to use get_function and then call call my functions via integer reference, as they are repetetive calls, that happen very often and i want to do some optimization there. To put it in code //world code.. int x=engine.system.get_function("samplesystemfunction"); ... ... ... engine.system.call(x, arg1, arg2); and vice versa. Link to comment
maimonides Posted March 30, 2013 Author Share Posted March 30, 2013 Bump. Anybody can help me with this? Link to comment
manguste Posted April 1, 2013 Share Posted April 1, 2013 get_function() returns an ID that can ONLY be used for call(), just like noted in the docs. engine.system.call() (as well as engine.world.call() and engine.editor.call()) take a function name for an argument. So no, this won't work. Link to comment
frustum Posted April 1, 2013 Share Posted April 1, 2013 engine.system.call|callv(), engine.world.call|callv() and engine.editor.call|callv() functions will work with identifiers as well. Link to comment
Recommended Posts