Expose methods to execute scripts
This commit is contained in:
@@ -352,4 +352,6 @@ public interface Client extends GameEngine
|
|||||||
World createWorld();
|
World createWorld();
|
||||||
|
|
||||||
SpritePixels drawInstanceMap(int z);
|
SpritePixels drawInstanceMap(int z);
|
||||||
|
|
||||||
|
void runScript(int id, Object... args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,4 +91,17 @@ public abstract class ScriptVMMixin implements RSClient
|
|||||||
currentScript = null;
|
currentScript = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void runScript(int id, Object... args)
|
||||||
|
{
|
||||||
|
assert isClientThread();
|
||||||
|
Object[] cargs = new Object[args.length + 1];
|
||||||
|
cargs[0] = id;
|
||||||
|
System.arraycopy(args, 0, cargs, 1, args.length);
|
||||||
|
RSScriptEvent se = createScriptEvent();
|
||||||
|
se.setArguments(cargs);
|
||||||
|
runScript(se, 200000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -550,4 +550,10 @@ public interface RSClient extends RSGameEngine, Client
|
|||||||
|
|
||||||
@Import("drawObject")
|
@Import("drawObject")
|
||||||
void drawObject(int z, int x, int y, int randomColor1, int randomColor2);
|
void drawObject(int z, int x, int y, int randomColor1, int randomColor2);
|
||||||
|
|
||||||
|
@Construct
|
||||||
|
RSScriptEvent createScriptEvent();
|
||||||
|
|
||||||
|
@Import("runScript")
|
||||||
|
void runScript(RSScriptEvent ev, int ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,13 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.rs.api;
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
public interface RSScriptEvent
|
public interface RSScriptEvent
|
||||||
{
|
{
|
||||||
|
@Import("objs")
|
||||||
|
Object[] getArguments();
|
||||||
|
|
||||||
|
@Import("objs")
|
||||||
|
void setArguments(Object[] args);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user