Add animation id if

This commit is contained in:
dginovker
2019-10-07 10:52:30 -04:00
parent 521a4f8a8b
commit 218267e28b
5 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<groupId>src</groupId> <groupId>src</groupId>
<artifactId>script-factory</artifactId> <artifactId>script-factory</artifactId>
<version>1.5</version> <version>1.9</version>
<properties> <properties>
<jdk.version>1.7</jdk.version> <jdk.version>1.7</jdk.version>
@@ -55,7 +55,6 @@ public class Action {
array[i] = Integer.parseInt(params.get(i)); array[i] = Integer.parseInt(params.get(i));
} }
return array; return array;
//return params.stream().mapToInt(Integer::parseInt).toArray();
} }
public Action(String action, ArrayList<JTextArea> inputs) { public Action(String action, ArrayList<JTextArea> inputs) {
@@ -1,6 +1,8 @@
package scriptfactory.Actions.Logic; package scriptfactory.Actions.Logic;
import org.parabot.core.reflect.RefClass;
import org.parabot.environment.api.utils.Filter; import org.parabot.environment.api.utils.Filter;
import org.parabot.environment.api.utils.Time;
import org.rev317.min.api.wrappers.GroundItem; import org.rev317.min.api.wrappers.GroundItem;
import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.Tile;
import scriptfactory.Actions.Action; import scriptfactory.Actions.Action;
@@ -38,6 +40,22 @@ public class LogicHandler {
return Players.getMyPlayer().isInCombat(); return Players.getMyPlayer().isInCombat();
case "Within x Tiles of Coords": case "Within x Tiles of Coords":
return new Tile(a.getParam(1), a.getParam(2)).distanceTo() < a.getParam(0); return new Tile(a.getParam(1), a.getParam(2)).distanceTo() < a.getParam(0);
case "Player Animation ID":
for (int i = 0; i <= a.getParam(1); i+=5) //Allow multiple checks for when the animation is happening
{
Time.sleep(5);
if (a.getParam(2) == 1){
if (Players.getMyPlayer().getAnimation() != a.getParam(0)) //"Inverse"
return true;
}
else
{
if (Players.getMyPlayer().getAnimation() == a.getParam(0))
return true;
}
}
return false;
default: default:
log("Error: Unimplemented conditional: " + a.getAction()); log("Error: Unimplemented conditional: " + a.getAction());
} }
+1 -1
View File
@@ -20,7 +20,7 @@ import static scriptfactory.VarsMethods.log;
* Welcome to AIO AIO - ScriptFactory. Make your own scripts! * Welcome to AIO AIO - ScriptFactory. Make your own scripts!
*/ */
@ScriptManifest(author = "Before", name = "Script Factory 1.8", category = Category.OTHER, version = 1.8, description = "Create your own scripts!", servers = "All") @ScriptManifest(author = "Before", name = "Script Factory 1.9", category = Category.OTHER, version = 1.9, description = "Create your own scripts!", servers = "All")
public class Core extends Script implements Paintable { public class Core extends Script implements Paintable {
private ArrayList<Action> actions = new ArrayList<>(); private ArrayList<Action> actions = new ArrayList<>();
@@ -11,7 +11,7 @@ import java.util.ArrayList;
*/ */
public class ConditionGuiInfo extends NewStatementGUI { public class ConditionGuiInfo extends NewStatementGUI {
public ConditionGuiInfo(ArrayList<Action> actionList, Consumer<Integer> updateTextfield) { public ConditionGuiInfo(ArrayList<Action> actionList, Consumer<Integer> updateTextfield) {
String[] actionTypes = new String[]{"Item is in Inventory", "Inventory slots used", "Item is on Ground", "Entity is around", "Hitpoints is below", "In Combat", "Within x Tiles of Coords"}; String[] actionTypes = new String[]{"Item is in Inventory", "Inventory slots used", "Item is on Ground", "Entity is around", "Hitpoints is below", "In Combat", "Within x Tiles of Coords", "Detect Animation ID"};
Descriptions[] setDescs = { Descriptions[] setDescs = {
new Descriptions("Item to detect (eg. 4296 = bones)", "Number of them to detect (blank = 1)"), new Descriptions("Item to detect (eg. 4296 = bones)", "Number of them to detect (blank = 1)"),
new Descriptions("Inventory slots greater than or equal to (eg. \"28\" detects a full inventory)"), new Descriptions("Inventory slots greater than or equal to (eg. \"28\" detects a full inventory)"),
@@ -20,6 +20,7 @@ public class ConditionGuiInfo extends NewStatementGUI {
new Descriptions("Below health # (eg. 10)"), new Descriptions("Below health # (eg. 10)"),
new Descriptions(), new Descriptions(),
new Descriptions("Tiles to be within (i.e. 6)", "x Coordinate", "y Coordinate"), new Descriptions("Tiles to be within (i.e. 6)", "x Coordinate", "y Coordinate"),
new Descriptions("Animation ID to detect", "ms to look for animation (recommended 600+)", "\"1\" to look for any ID other than the one specified (use this with anim ID -1 to detect any animation)"),
}; };
initGui("Add new condition", actionList, updateTextfield, actionTypes, setDescs); initGui("Add new condition", actionList, updateTextfield, actionTypes, setDescs);