From 573a66abf1dc1c0486ff5e3a5b0541a31defe7dc Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 16 May 2022 18:05:53 -0400 Subject: [PATCH] devtools: allow pgup/down to cycle through previous commands Co-authored-by: Max Weber --- .../client/plugins/devtools/DevToolsPlugin.java | 10 ++++++++++ runelite-client/src/main/scripts/CommandScript.rs2asm | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index 0fc56b8f50..52151e61ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -48,6 +48,7 @@ import net.runelite.api.VarbitComposition; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.CommandExecuted; import net.runelite.api.events.MenuEntryAdded; +import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.StatChanged; import net.runelite.api.events.VarbitChanged; import net.runelite.api.kit.KitType; @@ -488,4 +489,13 @@ public class DevToolsPlugin extends Plugin entry.setTarget(entry.getTarget() + " " + ColorUtil.prependColorTag("(" + info + ")", JagexColors.MENU_TARGET)); } } + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent ev) + { + if ("devtoolsEnabled".equals(ev.getEventName())) + { + client.getIntStack()[client.getIntStackSize() - 1] = 1; + } + } } diff --git a/runelite-client/src/main/scripts/CommandScript.rs2asm b/runelite-client/src/main/scripts/CommandScript.rs2asm index 0cb44b4ee8..073d229c35 100644 --- a/runelite-client/src/main/scripts/CommandScript.rs2asm +++ b/runelite-client/src/main/scripts/CommandScript.rs2asm @@ -870,6 +870,9 @@ LABEL724: if_icmpgt LABEL728 jump LABEL791 LABEL728: + ; move chatout_add under if ($length2 > 2) to only add for :: commands + get_varc_string 335 + invoke 77 ; chatout_add get_varc_string 335 sconst "::toggleroof" iconst 0 @@ -962,8 +965,11 @@ LABEL798: iload 9 invoke 5517 LABEL804: + ; see comment above + jump AFTER_CHATOUT_ADD get_varc_string 335 invoke 77 +AFTER_CHATOUT_ADD: sconst "" set_varc_string 335 LABEL808: @@ -975,6 +981,8 @@ LABEL809: jump LABEL819 LABEL813: iload 3 + sconst "devtoolsEnabled" + runelite_callback iconst 1 if_icmpeq LABEL817 jump LABEL818 @@ -989,6 +997,8 @@ LABEL819: jump LABEL829 LABEL823: iload 3 + sconst "devtoolsEnabled" + runelite_callback iconst 1 if_icmpeq LABEL827 jump LABEL828