Scripting functions:
Code:
as stated
Thing[] getNpcArray()
as stated
Thing[] getPlayerArray()
Returns 0-4 with how many items are adjacent to you
int getSurroundingItemCount()
returns an int array of IIRC 14, index 0 being amount of gold, the rest is Item ID's of your worn equipment, I haven't worked it out for what corresponds to which worn slot yet
int[] getWornEquipment()
returns an int[200][2] of your inventory, ex: getInventory()[4][0] is item index 4 item ID, and getInventory()[4][1] is item index 4 quantity
int[][] getInventory()
as stated
boolean hasHealthPotions()
weather or not you have item ID in your inventory
boolean hasItem(int item)
Used only for ground item ID's, doesn't work with inventory items... I wouldn't try using this tbh
Thing getItemInfo(int id)
no longer needed, getNpcArray() uses this and returns correct info
Thing getNpcInfo(int id)
returns the ID of what your currently interacting with, 0 means nothing
int getInteractingID()
was used only for testing, i think it currently dumps your HP
void dumpthings()
as stated
boolean inCombat()
distance between coords
int dist(int x1,int y1,int x2,int y2)
returns your current HP
int getHP()
returns your max HP
int getMaxHP()
walks to coords
walk(short x,short y)
uses mana or health potion, ID's for mana are 2,110,111, and health potion ID's are 1,104,105
ManaOrHeal(int item)
attack NPC
void attack(int NPCID)
takes an adjacent item
void takeNearItem()
returns your X coordinant
int getX()
returns your Y coordinant
int getY()
returns your Z coordiant(0 = top world, 1 is 1 floor down, etc)
int getZ()
weather or not your moving, however if your 'stuck' this could still return true
boolean isMoving()
is something on screen, could be an item, NPC, or player
boolean isThingOnScreen(Thing t)
are coordinants on screen
boolean coordOnScreen(int tx,int ty)
as stated
int random(int min,int max)
returns the closest NPC, does not account for walking around objects
Thing getClosestNPC(int[] types)
Uses A* path finding algorithm to find actual distance, int Map is the Z coordinant(maps are not complete, this will only work in supported areas
AStar.findPath(int x, int y, int x2, int y2, int Map)
^It appears I never added a sleep function, and did this inside of the scripts that I created... So implement this in your scripts yourself
Thing class(can be NPC/Player/Item)
Code:
Short xcoord = -1;
Short ycoord = -1;
int ThingID = -1;
String name = "";
int npcid = -1;
int type = -1;
int level = -1;
int HP = -1;
int levelxp = -1;
int meleexp = -1;//not used
int distancexp = -1;//not used
int magicxp = -1;//not used
int defensexp = -1;//not used
int distance = -1;//only used in the Assassin Fighter script
example of the above^ getNpcArray()[0].xcoord is the first NPC's x coordinant.
script layout:
Code:
package lesroberts.bridge;
import de.robv.android.xposed.XposedBridge;
public class YourScript extends ScriptEngine implements Runnable {
boolean running = true;
public YourScript() {
}
public void stop() {
running = false;
}
public void run() {
while(running) {
//do your script stuff...
}
}
}
dynamic script loading has not been implemented, you will need to go in and manually add an instance of your script to ScriptEngine, including adding it to startScript/stopScript