Created
April 9, 2012 07:16
-
-
Save CalebWhiting/2342084 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.powerbot.concurrent.Task; | |
import org.powerbot.concurrent.strategy.Condition; | |
import org.powerbot.concurrent.strategy.Strategy; | |
import org.powerbot.game.api.ActiveScript; | |
import org.powerbot.game.api.Manifest; | |
import org.powerbot.game.api.methods.Settings; | |
import org.powerbot.game.api.util.Time; | |
import javax.swing.*; | |
@Manifest ( | |
name = "Settings explorer", | |
authors = "Dang", | |
description = "A script to help script developers to gather settings data", | |
premium = false, | |
version = 1.1, | |
website = "UltraScripting.com") | |
public class SettingsExplorer extends ActiveScript implements Task, Condition { | |
public int[] last_settings; | |
final GUI gui = new GUI(); | |
final DefaultListModel<String> list_model = new DefaultListModel<String>(); | |
@Override | |
protected void setup() { | |
gui.setVisible(true); | |
last_settings = Settings.get(); | |
provide(new Strategy(this, this)); | |
} | |
@Override | |
public void run() { | |
if (gui.RUN_TOGGLE.isSelected()) { | |
final int[] current_settings = Settings.get(); | |
for (int count = 0; count < current_settings.length; count++) { | |
if (last_settings[count] != current_settings[count]) { | |
list_model.addElement("Setting: " + count + " [ Changed from: " + last_settings[count] + " to " + current_settings[count] + " ]"); | |
gui.SETTINGS_LIST.setModel(list_model); | |
last_settings = current_settings; | |
gui.SCROLL_PANE.getVerticalScrollBar().setValue(gui.SCROLL_PANE.getVerticalScrollBar().getMaximum()); | |
} | |
} | |
return; | |
} | |
Time.sleep(100); | |
} | |
@Override | |
public boolean validate() { | |
return true; | |
} | |
public class GUI extends JFrame { | |
public GUI() { | |
initComponents(); | |
} | |
public final JToggleButton RUN_TOGGLE = new JToggleButton(); | |
public final JScrollPane SCROLL_PANE = new JScrollPane(); | |
public final JList SETTINGS_LIST = new JList(); | |
public void initComponents() { | |
setTitle("Settings Explorer"); | |
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); | |
RUN_TOGGLE.setSelected(true); | |
RUN_TOGGLE.setText("Run"); | |
SETTINGS_LIST.setModel(new AbstractListModel() { | |
String[] strings = { "Settings explorer [1.1]" }; | |
public int getSize() { | |
return strings.length; | |
} | |
public Object getElementAt(int i) { | |
return strings[i]; | |
} | |
}); | |
SCROLL_PANE.setViewportView(SETTINGS_LIST); | |
GroupLayout layout = new GroupLayout(getContentPane()); | |
getContentPane().setLayout(layout); | |
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(SCROLL_PANE, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 170, Short.MAX_VALUE).addComponent(RUN_TOGGLE, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE))).addContainerGap())); | |
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(RUN_TOGGLE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(SCROLL_PANE, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE).addContainerGap())); | |
pack(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment