mirror of
https://github.com/2006-Scape/Script-Factory.git
synced 2026-07-02 16:49:10 +00:00
Add walk-efficient
This commit is contained in:
@@ -4,6 +4,7 @@ import org.parabot.environment.api.utils.Filter;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.input.Keyboard;
|
||||
import org.parabot.environment.input.Mouse;
|
||||
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||
import org.rev317.min.api.methods.*;
|
||||
import org.rev317.min.api.wrappers.*;
|
||||
import scriptfactory.VarsMethods;
|
||||
@@ -97,6 +98,18 @@ public class ActionHandler {
|
||||
Time.sleep(a.getParam(2));
|
||||
}
|
||||
|
||||
public void walkEfficient(Action a) {
|
||||
final Tile destinationTile = new Tile(a.getParam(0), a.getParam(1));
|
||||
final int withinDistance = a.getParam(2);
|
||||
Walking.walkTo(destinationTile);
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return destinationTile.distanceTo() < withinDistance;
|
||||
}
|
||||
}, 50000);
|
||||
}
|
||||
|
||||
public void handleGroundItemInteract(final Action a) {
|
||||
try {
|
||||
GroundItem item = GroundItems.getNearest(new Filter<GroundItem>() {
|
||||
|
||||
@@ -21,7 +21,7 @@ import static scriptfactory.VarsMethods.log;
|
||||
* Welcome to AIO AIO - ScriptFactory. Make your own scripts!
|
||||
*/
|
||||
|
||||
@ScriptManifest(author = "Before", name = "Script Factory 1.14", category = Category.OTHER, version = 1.14, description = "Create your own scripts!", servers = "All")
|
||||
@ScriptManifest(author = "Before", name = "Script Factory 1.15", category = Category.OTHER, version = 1.15, description = "Create your own scripts!", servers = "All")
|
||||
public class Core extends Script implements Paintable {
|
||||
|
||||
private ArrayList<Action> actions = new ArrayList<>();
|
||||
|
||||
@@ -8,12 +8,13 @@ import java.util.ArrayList;
|
||||
public class UncommonActionGuiInfo extends NewStatementGUI {
|
||||
public UncommonActionGuiInfo(ArrayList<Action> actionList, Consumer<Integer> updateTextField)
|
||||
{
|
||||
String[] actionTypes = new String[]{"Comment", "Run subscript", "Bank all except IDs", "Change Tick Speed"};
|
||||
String[] actionTypes = new String[]{"Comment", "Run subscript", "Bank all except IDs", "Change Tick Speed", "Walk Efficient"};
|
||||
NewStatementGUI.Descriptions[] setDescs = {
|
||||
new Descriptions("Enter any text to be your comment."),
|
||||
new Descriptions("Enter the file name of the subscript (cAsE sEnSiTiVe)"),
|
||||
new Descriptions("Enter the IDs to keep (comma separated) (i.e. \"995,150,356\") (can be blank)"),
|
||||
new Descriptions("Enter the new Tick Speed (in ms), which is time delayed between each line (default 1200)"),
|
||||
new Descriptions("X-tile coordinate", "Y-tile coordinate", "Distance to get within (times out after 50secs)"),
|
||||
};
|
||||
initGui("Add new uncommon action", actionList, updateTextField, actionTypes, setDescs);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,9 @@ public class ActionExecutor {
|
||||
case "Walk to":
|
||||
actionHandler.walkTo(action);
|
||||
break;
|
||||
case "Walk Efficient":
|
||||
actionHandler.walkEfficient(action);
|
||||
break;
|
||||
case "Run subscript":
|
||||
insertSubscript(action, actions, action.getParamAsString(0));
|
||||
lineIndex = --lineIndex == -1 ? actions.size()-1 : lineIndex; //Rerun the last line, which now contains start of subscript
|
||||
|
||||
Reference in New Issue
Block a user