about:
Blizzard Warcraft III [furthermore abbreviated as WC3]
related version: WC3: The Frozen Throne 1.26.0.6401 (german Patch 1.26a)
MindWorX Sharpcraft [furthermore abbreviated as SC]
related version: 1.2.4.0
issue:
I'm trying to use the native "TimerStart" from the WC3 "common.j" package inside a SC plugin written in C#. what gives me problems is the last argument from the native ("code handlerFunc"). as there is no native for creating functions, I dont know how to use it properly, can you give an example? for reference of the "code"-argument (it isnt even declared in the "common.j") i used Vexorians thread on wc3c.net, part: "I. The code type". here is the native like declared in "common.j":
native TimerStart takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing
in the SC plugin I initialized the native like this:
private delegate void TimerStartPrototype(JassTimer whichTimer, JassRealArg timeout, JassBoolean periodic, JassCode handlerFunc);
private static TimerStartPrototype TimerStart = WarcraftIII.Jass.GetNative("TimerStart").ToDelegate<TimerStartPrototype>();
//native TimerStart takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing
additionally in SC plugin, I created a void to pass to the last argument of the native: (note that "StopCamera" is another native from "common.j" i also initialized in the SC plugin but not showing here, because it is done in the same way "TimerStart" was.)
private delegate void StopCameraFuncPrototype();
private void StopCameraFunc() {
StopCamera();
}
usage of the native "TimerStart" in SC plugin: (note that the variable "jTim_mouseWheel" is a "JassTimer" created somewhere else in the SC plugin.)
TimerStart(jTim_mouseWheel, (JassRealArg)0.01, false, (JassCode)StopCameraFunc());
when im trying to run WC3 with SC, the SC console window prints that it couldnt compile the appropriate plugin *.cs-file due to not being able to convert void to JassCode. by simply renaming "void" into "JassCode" I get the error, that not all code paths return a value...