mirror of
https://github.com/2006-Scape/Script-Factory.git
synced 2026-07-02 16:49:10 +00:00
Add logger to initialize + fix silent crash
This commit is contained in:
@@ -19,10 +19,15 @@ public class ActionHandler {
|
||||
|
||||
private static String debugString = "";
|
||||
|
||||
public void handleInteractWith(Action a)
|
||||
public void handleInteractWithEntityByID(Action a)
|
||||
{
|
||||
if (a.getParamCount() == 0)
|
||||
{
|
||||
log("ERROR: " + a.getAction() + " does not have the required parameters!");
|
||||
return;
|
||||
}
|
||||
int[] ids = new int[a.getParamCount() -1];
|
||||
for (int i = 0; i < a.getParamCount() - 1; i++) {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
ids[i] = a.getParam(i);
|
||||
}
|
||||
interactWithEntity(ids, a.getParamAsString(a.getParamCount() - 1));
|
||||
|
||||
@@ -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.15", category = Category.OTHER, version = 1.15, description = "Create your own scripts!", servers = "All")
|
||||
@ScriptManifest(author = "Before", name = "Script Factory 1.16", category = Category.OTHER, version = 1.16, description = "Create your own scripts!", servers = "All")
|
||||
public class Core extends Script implements Paintable {
|
||||
|
||||
private ArrayList<Action> actions = new ArrayList<>();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ActionExecutor {
|
||||
switch (action.getMethod().replace("-", " ").trim())
|
||||
{
|
||||
case "Interact with entity by ID":
|
||||
actionHandler.handleInteractWith(action);
|
||||
actionHandler.handleInteractWithEntityByID(action);
|
||||
break;
|
||||
case "Interact with entity by location":
|
||||
actionHandler.handleInteractWithByLoc(action);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package scriptfactory;
|
||||
|
||||
import org.parabot.core.Core;
|
||||
import org.parabot.core.ui.BotUI;
|
||||
import org.parabot.core.ui.Logger;
|
||||
import org.rev317.min.accessors.Client;
|
||||
import org.rev317.min.api.methods.*;
|
||||
import scriptfactory.Actions.Action;
|
||||
import scriptfactory.Actions.Logic.Endif;
|
||||
@@ -27,11 +30,11 @@ public class VarsMethods {
|
||||
|
||||
public static void log(String str)
|
||||
{
|
||||
if (str.toLowerCase().contains("error"))
|
||||
if (str.toLowerCase().contains("error") || str.toLowerCase().contains("warn"))
|
||||
{
|
||||
//TODO: Open the logger
|
||||
Logger.getInstance().setVisible(true);
|
||||
//Put it in the paint as well
|
||||
currentAction = "ERROR (See Logger)";
|
||||
currentAction = "ERR/WARN (See log)";
|
||||
}
|
||||
Logger.addMessage(str, false);
|
||||
System.out.println(str);
|
||||
|
||||
Reference in New Issue
Block a user