View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003825 | The Dark Mod | Script/Def | public | 22.08.2014 15:49 | 22.08.2014 15:49 |
Reporter | tels | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | new | Resolution | open | ||
Summary | 0003825: callFunctionWithEntity(), callFunctionWithFloat(), callFunctionWithString() | ||||
Description | Often one wants to call a method on an entity's scriptobject, and there is indeed callFunction() (which should be actually named callMethod(), though). However, it is not possible to pass arguments this way. While it is possible to workaround that with: if (ent.hasFunction( methodName )) { ent.setKey( "x_arg_call", someent.getName() ); ent.callFunction( methodName ); ent.removeKey( "x_arg_call" ); } and then one could retrieve the entity with: entity e = sys.getEntity( getKey("x_arg_call") ); But this is quite cumbersome and a lot slower than a native call with the entity as the argument. Plus, it is only possible to pass strings, but not native floats or booleans or entities. So it would be nice to have callMethodWithEntity() and callMethodWithEntity(): if (ent.hasFunction( methodName )) { ent.callFunctionWithEntity( methodName, someent ); } if (ent.hasFunction( methodName )) { ent.callFunctionWithFloat( methodName, 1.1 ); } if (ent.hasFunction( methodName )) { ent.callFunctionWithString( methodName, "some string" ); } and the scripting interface would check if there is a function on the script object with that name and matching parameter set and call it. | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
22.08.2014 15:49 | tels | New Issue |