SRL Archive - The Bashing Club / BBQ Pit

RuneDev - The bot ripped from other bots


TRiLeZ

2010-09-29 20:29:52

Ok, so I found out about this bot a while ago and today I finally downloaded it.

I noticed that there was a script editor that came with the bot. So, I looked at it and it looked exactly like my bot's script editor. I also when through the GUI and scripts of the bot and I noticed that it looked exactly like RSBot. So, I extracted the bot's main jar file only to find the org.rsbot package. So, this bot is clearly a rip of other bots. I checked out their script editor code and this is what I found:


package org.rsbot.gui;

import info.runedev.Lexer.JavaLexer;
import info.runedev.Lexer.Lexer;
import info.runedev.Lexer.Token;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu.Separator;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.Position;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import org.rsbot.util.GlobalConfiguration;
import org.rsbot.util.GlobalConfiguration.OperatingSystem;
import org.rsbot.util.GlobalConfiguration.Paths;

public class ScriptEditor extends JInternalFrame
{
private static final long serialVersionUID = 8326421682467537173L;
public static File file = new File("");
private JPopupMenu.Separator jSeparator1;
protected JTextPane textPane;
protected HighLightedDocument document;
protected DocumentReader documentReader;
protected Lexer syntaxLexer;
protected Colorer colorer;
private Object doclock = new Object();
public static String defaultLayout = "import java.awt.Graphics; \nimport java.util.Map; \n\nimport org.rsbot.event.listeners.PaintListener; \nimport org.rsbot.script.Script; \nimport org.rsbot.script.ScriptManifest; \n\n@ScriptManifest(authors = { \"Your Name Here\" }, name = \"Script Name Here\",\n category = \"\", version = 1.00, description = \"\") \n public class YourScriptNameHere extends Script implements PaintListener { \n\n public int loop() {\n return (5);\n }\n\n public void onRepaint(final Graphics render) {\n }\n\n public boolean onStart(final Map<String, String> args) {\n return true;\n }\n\n public void onFinish() {\n }\n}";

private Hashtable styles = new Hashtable();

public ScriptEditor()
{
try
{
setFrameIcon(new ImageIcon((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/script_edit.png") : new File(GlobalConfiguration.Paths.SCRIPT_EDIT).toURI().toURL()));
} catch (MalformedURLException localMalformedURLException) {
}
setTitle("Runedev Script Editor");
setVisible(true);
setBackground(new Color(245, 245, 245));
setResizable(false);

this.document = new HighLightedDocument(null);
this.jSeparator1 = new JPopupMenu.Separator();

this.textPane = new JTextPane(this.document);
this.textPane.setCaretPosition(0);
this.textPane.setMargin(new Insets(5, 5, 5, 5));
JScrollPane localJScrollPane = new JScrollPane(this.textPane);

JPanel localJPanel = new JPanel(new BorderLayout());
localJPanel.add(localJScrollPane, "Center");
setContentPane(localJPanel);

JMenuBar localJMenuBar = new JMenuBar();

JMenu localJMenu1 = new JMenu("File");
JMenuItem localJMenuItem1 = new JMenuItem("New");
localJMenuItem1.setAccelerator(KeyStroke.getKeyStroke(78, 2));
try {
Image localImage1 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/pencil.png") : new File(GlobalConfiguration.Paths.PENCIL).toURI().toURL());

localJMenuItem1.setIcon(new ImageIcon(localImage1));
} catch (Exception localException1) {
}
localJMenu1.add(localJMenuItem1);

JMenuItem localJMenuItem2 = new JMenuItem("Open");
localJMenuItem2.setAccelerator(KeyStroke.getKeyStroke(79, 2));
try {
Image localImage2 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/control_play_blue.png") : new File(GlobalConfiguration.Paths.ICON_PLAY).toURI().toURL());

localJMenuItem2.setIcon(new ImageIcon(localImage2));
} catch (Exception localException2) {
}
localJMenu1.add(localJMenuItem2);

JMenuItem localJMenuItem3 = new JMenuItem("Save");
localJMenuItem3.setAccelerator(KeyStroke.getKeyStroke(83, 2));
try {
Image localImage3 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/save.png") : new File(GlobalConfiguration.Paths.SAVE).toURI().toURL());

localJMenuItem3.setIcon(new ImageIcon(localImage3));
} catch (Exception localException3) {
}
localJMenu1.add(localJMenuItem3);
localJMenuBar.add(localJMenu1);

JMenu localJMenu2 = new JMenu("Edit");
JMenuItem localJMenuItem4 = new JMenuItem("Cut");
localJMenuItem4.setAccelerator(KeyStroke.getKeyStroke(88, 2));
try {
Image localImage4 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/cut.png") : new File(GlobalConfiguration.Paths.CUT).toURI().toURL());

localJMenuItem4.setIcon(new ImageIcon(localImage4));
} catch (Exception localException4) {
}
localJMenu2.add(localJMenuItem4);

JMenuItem localJMenuItem5 = new JMenuItem("Copy");
localJMenuItem5.setAccelerator(KeyStroke.getKeyStroke(67, 2));
try {
Image localImage5 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/copy.png") : new File(GlobalConfiguration.Paths.COPY).toURI().toURL());

localJMenuItem5.setIcon(new ImageIcon(localImage5));
} catch (Exception localException5) {
}
localJMenu2.add(localJMenuItem5);

JMenuItem localJMenuItem6 = new JMenuItem("Paste");
localJMenuItem6.setAccelerator(KeyStroke.getKeyStroke(86, 2));
try {
Image localImage6 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/paste.png") : new File(GlobalConfiguration.Paths.PASTE).toURI().toURL());

localJMenuItem6.setIcon(new ImageIcon(localImage6));
} catch (Exception localException6) {
}
localJMenu2.add(localJMenuItem6);
localJMenu2.add(this.jSeparator1);

JMenuItem localJMenuItem7 = new JMenuItem("Select All");
localJMenuItem7.setAccelerator(KeyStroke.getKeyStroke(65, 2));
localJMenu2.add(localJMenuItem7);
localJMenuBar.add(localJMenu2);

JMenu localJMenu3 = new JMenu("Info");
JMenuItem localJMenuItem8 = new JMenuItem("Troubleshooting");
localJMenuItem8.setAccelerator(KeyStroke.getKeyStroke(84, 2));
try {
Image localImage7 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/web_small.png") : new File(GlobalConfiguration.Paths.WEB_SMALL).toURI().toURL());

localJMenuItem8.setIcon(new ImageIcon(localImage7));
} catch (Exception localException7) {
}
localJMenu3.add(localJMenuItem8);

JMenuItem localJMenuItem9 = new JMenuItem("about");
localJMenuItem9.setAccelerator(KeyStroke.getKeyStroke(112, 2));
try {
Image localImage8 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/gui_button.png") : new File(GlobalConfiguration.Paths.GUI_BUTTON).toURI().toURL());

localJMenuItem9.setIcon(new ImageIcon(localImage8));
} catch (Exception localException8) {
}
localJMenu3.add(localJMenuItem9);
localJMenuBar.add(localJMenu3);

localJMenuItem1.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
if (JOptionPane.showConfirmDialog(this.val$contentPane, "You really want to start a new script? \nAll un-saved work on this script will be lost.") != 0)
return;
try
{
this.this$0.document.remove(0, this.this$0.document.getLength());
this.this$0.document.insertString(this.this$0.document.getLength(), ScriptEditor.defaultLayout, this.this$0.getStyle("text"));
}
catch (BadLocationException localBadLocationException)
{
}

}

});
localJMenuItem2.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
JFileChooser localJFileChooser = new JFileChooser(ScriptEditor.file);
localJFileChooser.setCurrentDirectory(new File("./scripts/"));
localJFileChooser.addChoosableFileFilter(new ScriptEditor.JavaFilter(this.this$0));
if (localJFileChooser.showOpenDialog(this.val$contentPane) == 0) {
ScriptEditor.file = localJFileChooser.getSelectedFile();
try {
this.this$0.document.remove(0, this.this$0.document.getLength());
BufferedReader localBufferedReader = new BufferedReader(new FileReader(ScriptEditor.file));

String str = null;
while ((str = localBufferedReader.readLine()) != null) {
if (this.this$0.document.getLength() != 0) {
this.this$0.document.insertString(this.this$0.document.getLength(), "\n", this.this$0.getStyle("text"));
}

this.this$0.document.insertString(this.this$0.document.getLength(), str, this.this$0.getStyle("text"));
}

}
catch (Exception localException)
{
}

}

}

});
localJMenuItem3.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
JFileChooser localJFileChooser = new JFileChooser(ScriptEditor.file);
localJFileChooser.setCurrentDirectory(new File("./scripts/"));
localJFileChooser.addChoosableFileFilter(new ScriptEditor.JavaFilter(this.this$0));
if (localJFileChooser.showSaveDialog(this.val$contentPane) != 0) return;
try {
ScriptEditor.file = localJFileChooser.getSelectedFile();
BufferedWriter localBufferedWriter = new BufferedWriter(new FileWriter(ScriptEditor.file));

localBufferedWriter.write(this.this$0.document.getText(0, this.this$0.document.getLength()));

localBufferedWriter.close();
}
catch (Exception localException)
{
}

}

});
localJMenuItem4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.cut();
}

});
localJMenuItem5.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.copy();
}

});
localJMenuItem6.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.paste();
}

});
localJMenuItem7.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.selectAll();
}

});
localJMenuItem8.addActionListener(new ActionListener()
{
public void openURL(String paramString)
{
GlobalConfiguration.OperatingSystem localOperatingSystem = GlobalConfiguration.getCurrentOperatingSystem();
try {
Object localObject;
Method localMethod;
if (localOperatingSystem == GlobalConfiguration.OperatingSystem.MAC) {
localObject = Class.forName("com.apple.eio.FileManager");
localMethod = ((Class)localObject).getDeclaredMethod("openURL", new Class[] { String.class });

localMethod.invoke(null, new Object[] { paramString });
} else if (localOperatingSystem == GlobalConfiguration.OperatingSystem.WINDOWS) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + paramString);
} else {
localObject = new String[] { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
localMethod = null;
for (int i = 0; (i < localObject.length) && (localMethod == null); ++i) {
if (Runtime.getRuntime().exec(new String[] { "which", localObject[i] }).waitFor() == 0) {
localMethod = localObject[i];
}
}
if (localMethod == null) {
throw new Exception("Could not find web browser");
}
Runtime.getRuntime().exec(new String[] { localMethod, paramString });
}
}
catch (Exception localException) {
}
}

public void actionPerformed(ActionEvent paramActionEvent) {
openURL("http://forum.runedev.info/viewtopic.php?f=40&t=2629");
}

});
localJMenuItem9.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
JOptionPane.showMessageDialog(this.val$contentPane, new String[] { "A Script Editor Made for RuneDev.", "\nThis Editor was designed by Sorcermus\nfor the RuneDev gaming client\nFor more information, \nvisit; http://runedev.info/" }, "\nAbout this editor, and the game client", 1);
}

});
setJMenuBar(localJMenuBar);

JTextArea localJTextArea = new JTextArea("");
localJTextArea.setSelectionEnd(this.document.getLength());
localJTextArea.setFont(new Font("Monospaced", 0, 12));
localJTextArea.setBackground(new Color(210, 210, 210));
localJTextArea.setEditable(false);
localJTextArea.setMargin(new Insets(5, 2, 5, 2));

this.document.addDocumentListener(new DocumentListener(localJTextArea)
{
public String getText() {
int i = ScriptEditor.this.document.getEndPosition().getOffset();
Element localElement = ScriptEditor.this.document.getDefaultRootElement();
String str = "1" + System.getProperty("line.separator");
for (int j = 2; j < localElement.getElementIndex(i) + 2; ++j) {
str = str + j + System.getProperty("line.separator");
}
return str;
}

public void changedUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

public void insertUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

public void removeUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

});
localJScrollPane.setRowHeaderView(localJTextArea);

this.colorer = new Colorer(null);
this.colorer.start();

initStyles(12);

this.documentReader = new DocumentReader(this.document);

initDocument();

pack();
setVisible(true);
}

public void colorAll()
{
color(0, this.document.getLength());
}

public void color(int paramInt1, int paramInt2) {
this.colorer.color(paramInt1, paramInt2);
}

private void initDocument()
{
this.syntaxLexer = new JavaLexer(this.documentReader);
try
{
this.document.insertString(this.document.getLength(), defaultLayout, getStyle("text"));
}
catch (BadLocationException localBadLocationException) {
System.err.println("Couldn't insert initial text.");
}
}

private SimpleAttributeSet getStyle(String paramString)
{
return ((SimpleAttributeSet)this.styles.get(paramString));
}

private void initStyles(int paramInt)
{
SimpleAttributeSet localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("body", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.blue);
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("tag", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.blue);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("endtag", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("reference", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(11546720));
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("name", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(11546720));
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, true);
this.styles.put("value", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("text", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.blue);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("reservedWord", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("identifier", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(11546720));
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("literal", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(128));
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("separator", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("operator", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.green.darker());
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("comment", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(10494192).darker());
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("preprocessor", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("whitespace", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.red);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("error", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.orange);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("unknown", localSimpleAttributeSet);
}

private class HighLightedDocument extends DefaultStyledDocument
{
public void insertString(int paramInt, String paramString, AttributeSet paramAttributeSet)
throws BadLocationException
{
synchronized (ScriptEditor.this.doclock) {
super.insertString(paramInt, paramString, paramAttributeSet);
ScriptEditor.this.color(paramInt, paramString.length());
ScriptEditor.this.documentReader.update(paramInt, paramString.length());
}
}

public void remove(int paramInt1, int paramInt2) throws BadLocationException
{
synchronized (ScriptEditor.this.doclock) {
super.remove(paramInt1, paramInt2);
ScriptEditor.this.color(paramInt1, -paramInt2);
ScriptEditor.this.documentReader.update(paramInt1, -paramInt2);
}
}
}

private class Colorer extends Thread
{
private TreeSet iniPositions;
private HashSet newPositions;
private volatile Vector v;
private volatile int change;
private volatile int lastPosition;
private volatile boolean asleep;
private Object lock;

private Colorer()
{
this.iniPositions = new TreeSet(new DocPositionComparator());

this.newPositions = new HashSet();

this.v = new Vector();

this.change = 0;
this.lastPosition = -1;
this.asleep = false;
this.lock = new Object();
}

public void color(int paramInt1, int paramInt2) {
if (paramInt1 < this.lastPosition) {
if (this.lastPosition < paramInt1 - paramInt2)
this.change -= this.lastPosition - paramInt1;
else {
this.change += paramInt2;
}
}
synchronized (this.lock) {
this.v.add(new RecolorEvent(paramInt1, paramInt2));
if (this.asleep)
interrupt();
}
}

public void run()
{
int i = -1;
int j = 0;
int k = 0;
while (true)
{
Object localObject1;
synchronized (this.lock) {
if (this.v.size() > 0) {
localObject1 = (RecolorEvent)(RecolorEvent)this.v.elementAt(0);
this.v.removeElementAt(0);
i = ((RecolorEvent)localObject1).position;
j = ((RecolorEvent)localObject1).adjustment;
} else {
k = 0;
i = -1;
j = 0;
}
}
if (i != -1)
{
DocPosition localDocPosition1 = new DocPosition(i);
DocPosition localDocPosition2 = new DocPosition(i + ((j >= 0) ? j : -j));

DocPosition localDocPosition4 = null;
DocPosition localDocPosition5 = null;
try
{
??? = this.iniPositions.headSet(localDocPosition1);
localDocPosition4 = (DocPosition)((SortedSet)???).last();
} catch (NoSuchElementException localNoSuchElementException) {
localDocPosition4 = new DocPosition(0);
}

if (j < 0) {
??? = this.iniPositions.subSet(localDocPosition1, localDocPosition2);

localObject1 = ((SortedSet)???).iterator();
while (((Iterator)localObject1).hasNext()) {
((Iterator)localObject1).next();
((Iterator)localObject1).remove();
}
}

??? = this.iniPositions.tailSet(localDocPosition1);
localObject1 = ((SortedSet)???).iterator();
while (((Iterator)localObject1).hasNext()) {
((DocPosition)((Iterator)localObject1).next()).adjustPosition(j);
}

??? = this.iniPositions.tailSet(localDocPosition4);
localObject1 = ((SortedSet)???).iterator();
DocPosition localDocPosition3 = null;
if (((Iterator)localObject1).hasNext()) {
localDocPosition3 = (DocPosition)((Iterator)localObject1).next();
}

try
{
Token localToken;
int l = 0;
localDocPosition5 = localDocPosition4;
synchronized (ScriptEditor.this.doclock) {
ScriptEditor.this.syntaxLexer.reset(ScriptEditor.this.documentReader, 0, localDocPosition4.getPosition(), 0);
ScriptEditor.this.documentReader.seek(localDocPosition4.getPosition());
localToken = ScriptEditor.this.syntaxLexer.getNextToken();
}
this.newPositions.add(localDocPosition4);
while ((l == 0) && (localToken != null)) {
synchronized (ScriptEditor.this.doclock) {
if (localToken.getCharEnd() <= ScriptEditor.this.document.getLength()) {
ScriptEditor.this.document.setCharacterAttributes(localToken.getCharBegin() + this.change, localToken.getCharEnd() - localToken.getCharBegin(), ScriptEditor.this.getStyle(localToken.getDescription()), true);

localDocPosition5 = new DocPosition(localToken.getCharEnd());
}
this.lastPosition = (localToken.getCharEnd() + this.change);
}
if (localToken.getState() == 0)
{
while ((localDocPosition3 != null) && (localDocPosition3.getPosition() <= localToken.getCharEnd())) {
if ((localDocPosition3.getPosition() == localToken.getCharEnd()) && (localDocPosition3.getPosition() >= localDocPosition2.getPosition()))
{
l = 1;
localDocPosition3 = null; }
if (((Iterator)localObject1).hasNext()) {
localDocPosition3 = (DocPosition)((Iterator)localObject1).next();
}
localDocPosition3 = null;
}

this.newPositions.add(localDocPosition5);
}
synchronized (ScriptEditor.this.doclock) {
localToken = ScriptEditor.this.syntaxLexer.getNextToken();
}
}

localObject1 = this.iniPositions.subSet(localDocPosition4, localDocPosition5).iterator();
while (((Iterator)localObject1).hasNext()) {
((Iterator)localObject1).next();
((Iterator)localObject1).remove();
}

localObject1 = this.iniPositions.tailSet(new DocPosition(ScriptEditor.this.document.getLength())).iterator();

while (((Iterator)localObject1).hasNext()) {
((Iterator)localObject1).next();
((Iterator)localObject1).remove();
}

this.iniPositions.addAll(this.newPositions);
this.newPositions.clear();
} catch (IOException localIOException) {
}
synchronized (ScriptEditor.this.doclock) {
this.lastPosition = -1;
this.change = 0;
}
k = 1;
}
this.asleep = true;
if (k == 0)
try {
sleep(16777215L);
}
catch (InterruptedException localInterruptedException)
{
}
this.asleep = false;
}
}

private class RecolorEvent
{
public int position;
public int adjustment;

public RecolorEvent(int paramInt1, int paramInt2)
{
this.position = paramInt1;
this.adjustment = paramInt2;
}
}
}

class JavaFilter extends FileFilter
{
public boolean accept(File paramFile)
{
String str = paramFile.getName();
return str.endsWith(".java");
}

public String getDescription() {
return "*.java";
}
}
}

This is TRiBot's script editor code:

package org.tribot.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Vector;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

import org.tribot.bot.TRiBot;
import org.tribot.loader.Client;

import com.Ostermiller.Syntax.Lexer.JavaLexer;
import com.Ostermiller.Syntax.Lexer.Lexer;
import com.Ostermiller.Syntax.Lexer.Token;

public class ScriptEditor extends JInternalFrame {

private static final long serialVersionUID = 8326421682467537173L;

public static File file = new File("");
protected JTextPane textPane;
protected HighLightedDocument document;
protected DocumentReader documentReader;
protected Lexer syntaxLexer;
protected Colorer colorer;
private Object doclock = new Object();

public String defaultLayout = "package scripts;"
+ "\n"
+ "\nimport java.awt.Graphics;"
+ "\n"
+ "\nimport org.tribot.loader.Client;"
+ "\nimport org.tribot.script.Script;"
+ "\nimport org.tribot.wrappers.RSInterface;"
+ "\nimport org.tribot.script.ScriptManifest;"
+ "\n"
+ "\n@ScriptManifest(authors = { \"TRiLeZ\" }, name = \"Script Skeleton\", category = \"Skeleton\")"
+ "\npublic class ScriptSkeleton extends Script {" + "\n"
+ "\n public ScriptSkeleton(Client bot) {" + "\n super(bot);"
+ "\n }" + "\n" + "\n public void onPause() {" + "\n" + "\n }"
+ "\n" + "\n public void onResume() {" + "\n" + "\n }" + "\n"
+ "\n public void onBreakStart() {" + "\n" + "\n }" + "\n"
+ "\n public void onBreakEnd() {" + "\n" + "\n }" + "\n"
+ "\n public void onEnd() {" + "\n" + "\n }" + "\n"
+ "\n public void onPaint(Graphics g) {" + "\n" + "\n }" + "\n"
+ "\n public void run() {" + "\n" + "\n }" + "\n" + "\n}";

public ScriptEditor() {
this.setTitle("Script Editor");
this.setVisible(true);
this.setBackground(new Color(245, 245, 245));
this.setResizable(false);
this.setFrameIcon(new ImageIcon("images/script icon.png"));

document = new HighLightedDocument();

textPane = new JTextPane(document);
textPane.setCaretPosition(0);
textPane.setMargin(new Insets(5, 5, 5, 5));
JScrollPane scrollPane = new JScrollPane(textPane);
scrollPane
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

final JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(scrollPane, BorderLayout.CENTER);
setContentPane(contentPane);

JMenuBar menuBar = new JMenuBar();

JMenu fileMenu = new JMenu("File");
Icon icon = new ImageIcon("images\\new.png");
JMenuItem newScript = new JMenuItem("New", icon);
fileMenu.add(newScript);
icon = new ImageIcon("images\\open.png");
JMenuItem openScript = new JMenuItem("Open", icon);
fileMenu.add(openScript);
icon = new ImageIcon("images\\save.png");
JMenuItem saveScript = new JMenuItem("Save", icon);
fileMenu.add(saveScript);
menuBar.add(fileMenu);

JMenu editMenu = new JMenu("Edit");
icon = new ImageIcon("images\\cut.png");
JMenuItem cut = new JMenuItem("Cut", icon);
editMenu.add(cut);
icon = new ImageIcon("images\\copy.png");
JMenuItem copy = new JMenuItem("Copy", icon);
editMenu.add(copy);
icon = new ImageIcon("images\\paste.png");
JMenuItem paste = new JMenuItem("Paste", icon);
editMenu.add(paste);
icon = new ImageIcon("images\\select all.png");
JMenuItem selectAll = new JMenuItem("Select All", icon);
editMenu.add(selectAll);
menuBar.add(editMenu);

JMenu scriptMenu = new JMenu("Script");
icon = new ImageIcon("images\\compile.png");
JMenuItem compileScript = new JMenuItem("Compile", icon);
scriptMenu.add(compileScript);
icon = new ImageIcon("images\\terminal.png");
JMenuItem runScript = new JMenuItem("Run", icon);
scriptMenu.add(runScript);
menuBar.add(scriptMenu);

class newClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (JOptionPane
.showConfirmDialog(contentPane,
"You really want to start a new script? All un-saved work will be lost.") == 0)
try {
document.remove(0, document.getLength());
document.insertString(document.getLength(),
defaultLayout, getStyle("text"));
} catch (BadLocationException e1) {
e1.printStackTrace();
}
}
}

class openClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
Frame f = new Frame("Open");
f.setIconImage(Toolkit.getDefaultToolkit().getImage(
"images/open.png"));
final JFileChooser fc = new JFileChooser(file);
fc.setCurrentDirectory(new File("./src/scripts/"));
fc.addChoosableFileFilter(new JavaFilter());
if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
try {
document.remove(0, document.getLength());
BufferedReader in = new BufferedReader(new FileReader(
file));
String line = null;
while ((line = in.readLine()) != null) {
if (document.getLength() != 0)
document.insertString(document.getLength(),
"\n", getStyle("text"));
document.insertString(document.getLength(), line,
getStyle("text"));
}
} catch (Exception ee) {
}
}
}
}

class saveClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
Frame f = new Frame("Open");
f.setIconImage(Toolkit.getDefaultToolkit().getImage(
"images/save.png"));
final JFileChooser fc = new JFileChooser(file);
fc.setCurrentDirectory(new File("./src/scripts/"));
fc.addChoosableFileFilter(new JavaFilter());
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
try {
Boolean b = true;
file = fc.getSelectedFile();
if (file.exists())
if (JOptionPane.showConfirmDialog(contentPane,
"Overwrite file?") != 0)
b = false;
if (b == true) {
BufferedWriter out = new BufferedWriter(
new FileWriter(file));
out.write(document.getText(0, document.getLength()));
out.close();
}
b = false;
} catch (Exception ee) {
ee.printStackTrace();
}
}
}
}

class Cut implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.cut();
}
}

class Copy implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.copy();
}
}

class Paste implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.paste();
}
}

class SelectAll implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.selectAll();
}
}

class compileClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
try {
/* Writes script to temporary file */
File tempFile = new File("data\\temp\\temp.java");
BufferedWriter tempOut = new BufferedWriter(new FileWriter(
tempFile));
tempOut.write(document.getText(0, document.getLength()));
tempOut.close();

String scriptName = "";
try {
BufferedReader in = new BufferedReader(new FileReader(
tempFile));
String line = null;
while ((line = in.readLine()) != null) {
if (line.contains("public class")) {
String data[] = line.split(" ");
scriptName = data[2];
}
}
in.close();
} catch (Exception ee) {
}
tempFile.delete();
if (scriptName == "") {
TRiBot.mainGUI
.println("Script Editor: Script name not found! Compiling failed!");
} else {

/* Writes script to temporary file with proper name */
File tempScriptFile = new File("data\\temp\\"
+ scriptName + ".java");
BufferedWriter scriptOut = new BufferedWriter(
new FileWriter(tempScriptFile));
scriptOut.write(document.getText(0,
document.getLength()));
scriptOut.close();

/* Makes a batch file for tempScriptFile */
File cmdfile = new File("Comile Script.cmd");
BufferedWriter cmdOut = new BufferedWriter(
new FileWriter(cmdfile));
cmdOut.write("@ECHO OFF\njavac -cp \"bin\" data\\temp\\"
+ scriptName + ".java");
cmdOut.close();

try {
Process p = Runtime.getRuntime().exec(
"Comile Script.cmd");
p.waitFor();
cmdfile.delete();
tempScriptFile.delete();

BufferedInputStream bis = new BufferedInputStream(
p.getInputStream());
BufferedReader stdError = new BufferedReader(
new InputStreamReader(p.getErrorStream()));

while (bis.available() > 0) {
TRiBot.mainGUI.println("" + (char) bis.read());
}

String s = null;
Boolean errors = false;

if (((s = stdError.readLine()) != null)) {
TRiBot.mainGUI.println(
"\nCompilation Errors:\n", false);
}

while ((s = stdError.readLine()) != null) {
TRiBot.mainGUI.println(s, false);
errors = true;
}

if (errors == false) {
File outputFile = new File("data\\temp\\"
+ scriptName + ".class");
outputFile.delete();
TRiBot.mainGUI.println(scriptName
+ " compiled successfully! No errors!");
if (JOptionPane
.showConfirmDialog(contentPane,
"Would you like to save this script to the scripts folder?") == 0) {
/* Saves the script source */
File newScriptFile = new File(
"src\\scripts\\" + scriptName
+ ".java");

Boolean b = true;
if (newScriptFile.exists())
if (!(JOptionPane.showConfirmDialog(
contentPane,
"Overwrite script: "
+ scriptName + "?") == 0))
b = false;
if (b == true) {
BufferedWriter newScriptOut = new BufferedWriter(
new FileWriter(newScriptFile));
newScriptOut.write(document.getText(0,
document.getLength()));
newScriptOut.close();

/* Makes a batch file for script */
cmdfile = new File("Comile Script.cmd");
cmdOut = new BufferedWriter(
new FileWriter(cmdfile));
cmdOut.write("@ECHO OFF\njavac -cp \"bin\" -d \"bin\" src\\scripts\\"
+ scriptName + ".java");
cmdOut.close();

p = Runtime.getRuntime().exec(
"Comile Script.cmd");
p.waitFor();
cmdfile.delete();

TRiBot.mainGUI
.println("Script source and code saved!");
}
b = false;
}
}

} catch (Exception ee) {
ee.printStackTrace();
}

}

} catch (Exception ee) {
ee.printStackTrace();
}
}
}

class runClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
compileAndRun();
}
}

newScript.addActionListener(new newClick());
openScript.addActionListener(new openClick());
saveScript.addActionListener(new saveClick());
cut.addActionListener(new Cut());
copy.addActionListener(new Copy());
paste.addActionListener(new Paste());
selectAll.addActionListener(new SelectAll());
compileScript.addActionListener(new compileClick());
runScript.addActionListener(new runClick());

this.setJMenuBar(menuBar);

final JTextArea lines = new JTextArea("");
lines.setSelectionEnd(document.getLength());
lines.setFont(new Font("Monospaced", Font.PLAIN, 12));
lines.setForeground(Color.DARK_GRAY);
lines.setBackground(new Color(210, 210, 210));
lines.setEditable(false);
lines.setMargin(new Insets(5, 2, 5, 2));

document.addDocumentListener(new DocumentListener() {
public String getText() {
int caretPosition = document.getEndPosition().getOffset();
Element root = document.getDefaultRootElement();
String text = "1" + System.getProperty("line.separator");
for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) {
text += i + System.getProperty("line.separator");
}
return text;
}

@Override
public void changedUpdate(DocumentEvent de) {
lines.setText(getText());
}

@Override
public void insertUpdate(DocumentEvent de) {
lines.setText(getText());
}

@Override
public void removeUpdate(DocumentEvent de) {
lines.setText(getText());
}

});

scrollPane.setRowHeaderView(lines);

colorer = new Colorer();
colorer.start();

initStyles(12);

documentReader = new DocumentReader(document);

initDocument();

this.pack();
this.updateUI();
this.setVisible(true);
}

private void compileAndRun() {
try {
/* Writes script to temporary file */
File tempFile = new File("data\\temp\\temp.java");
BufferedWriter tempOut = new BufferedWriter(
new FileWriter(tempFile));
tempOut.write(document.getText(0, document.getLength()));
tempOut.close();

String scriptName = "";
try {
BufferedReader in = new BufferedReader(new FileReader(tempFile));
String line = null;
while ((line = in.readLine()) != null) {
if (line.contains("public class")) {
String data[] = line.split(" ");
scriptName = data[2];
}
}
in.close();
} catch (Exception ee) {
}
tempFile.delete();
if (scriptName == "") {
TRiBot.mainGUI
.println("Script Editor: Script name not found! Compiling failed!");
} else {

/* Writes script to temporary file with proper name */
File tempScriptFile = new File("data\\temp\\" + scriptName
+ ".java");
BufferedWriter scriptOut = new BufferedWriter(new FileWriter(
tempScriptFile));
scriptOut.write(document.getText(0, document.getLength())
.replace("package scripts;", ""));
scriptOut.close();

/* Makes a batch file for tempScriptFile */
File cmdfile = new File("Comile Script.cmd");
BufferedWriter cmdOut = new BufferedWriter(new FileWriter(
cmdfile));
cmdOut.write("@ECHO OFF\njavac -cp \"bin\" data\\temp\\"
+ scriptName + ".java");
cmdOut.close();

try {
Process p = Runtime.getRuntime().exec("Comile Script.cmd");
p.waitFor();
cmdfile.delete();
tempScriptFile.delete();

BufferedInputStream bis = new BufferedInputStream(
p.getInputStream());
BufferedReader stdError = new BufferedReader(
new InputStreamReader(p.getErrorStream()));

while (bis.available() > 0) {
TRiBot.mainGUI.println("" + (char) bis.read());
}

String s = null;
Boolean errors = false;

if (((s = stdError.readLine()) != null)) {
TRiBot.mainGUI
.println("\nCompilation Errors:\n", false);
}

while ((s = stdError.readLine()) != null) {
TRiBot.mainGUI.println(s, false);
errors = true;
}

if (errors == false) {
File outputFile = new File("data\\temp\\" + scriptName
+ ".class");

TRiBot.mainGUI
.println(scriptName
+ " compiled successfully! No errors! Running script...");

File directory = new File("data\\temp");
ClassLoader cL;
try {
cL = new URLClassLoader(new URL[] { directory
.toURI().toURL() });
} catch (MalformedURLException e) {
TRiBot.mainGUI
.println("Error loading the compiled script!");
return;
}
Class<?> script = null;
try {
script = cL.loadClass(scriptName);
} catch (Exception e) {
TRiBot.mainGUI
.println("Error loading the compiled script!");
}

Client bot = TRiBot.mainGUI.getVisibleClient();
if (bot == null) {
TRiBot.mainGUI
.println("Please start a client before trying to run a script.");
} else if (TRiBot.mainGUI.getVisibleClient().scriptHandler.isRunning) {
TRiBot.mainGUI
.println("Another script is already running. Please close that script before you try to run another script.");
} else {
TRiBot.mainGUI.getVisibleClient().scriptHandler
.startScript(script, scriptName, null);
}

outputFile.delete();
}

} catch (Exception ee) {
ee.printStackTrace();
}

}

} catch (Exception ee) {
ee.printStackTrace();
}
}

class JavaFilter extends javax.swing.filechooser.FileFilter {
public boolean accept(File file) {
String filename = file.getName();
return filename.endsWith(".java");
}

public String getDescription() {
return "*.java";
}
}

public class Colorer extends Thread {

@SuppressWarnings("unchecked")
private TreeSet<DocPosition> iniPositions = new TreeSet<DocPosition>(
new DocPositionComparator());

private HashSet<DocPosition> newPositions = new HashSet<DocPosition>();

public class RecolorEvent {
public int position;
public int adjustment;

public RecolorEvent(int position, int adjustment) {
this.position = position;
this.adjustment = adjustment;
}
}

@SuppressWarnings({ "rawtypes" })
private volatile Vector v = new Vector<RecolorEvent>();

private volatile int change = 0;

private volatile int lastPosition = -1;

private volatile boolean asleep = false;

private Object lock = new Object();

@SuppressWarnings("unchecked")
public void color(int position, int adjustment) {
if (position < lastPosition) {
if (lastPosition < position - adjustment) {
change -= lastPosition - position;
} else {
change += adjustment;
}
}
synchronized (lock) {
v.add(new RecolorEvent(position, adjustment));
if (asleep) {
this.interrupt();
}
}
}

public void run() {
int position = -1;
int adjustment = 0;
boolean tryAgain = false;
for (;;) {
synchronized (lock) {
if (v.size() > 0) {
RecolorEvent re = (RecolorEvent) (v.elementAt(0));
v.removeElementAt(0);
position = re.position;
adjustment = re.adjustment;
} else {
tryAgain = false;
position = -1;
adjustment = 0;
}
}
if (position != -1) {
@SuppressWarnings("rawtypes")
SortedSet workingSet;
@SuppressWarnings("rawtypes")
Iterator workingIt;
DocPosition startRequest = new DocPosition(position);
DocPosition endRequest = new DocPosition(position
+ ((adjustment >= 0) ? adjustment : -adjustment));
DocPosition dp;
DocPosition dpStart = null;
DocPosition dpEnd = null;

try {
workingSet = iniPositions.headSet(startRequest);
dpStart = ((DocPosition) workingSet.last());
} catch (NoSuchElementException x) {
dpStart = new DocPosition(0);
}

if (adjustment < 0) {
workingSet = iniPositions.subSet(startRequest,
endRequest);
workingIt = workingSet.iterator();
while (workingIt.hasNext()) {
workingIt.next();
workingIt.remove();
}
}

workingSet = iniPositions.tailSet(startRequest);
workingIt = workingSet.iterator();
while (workingIt.hasNext()) {
((DocPosition) workingIt.next())
.adjustPosition(adjustment);
}

workingSet = iniPositions.tailSet(dpStart);
workingIt = workingSet.iterator();
dp = null;
if (workingIt.hasNext()) {
dp = (DocPosition) workingIt.next();
}
try {
Token t;
boolean done = false;
dpEnd = dpStart;
synchronized (doclock) {
syntaxLexer.reset(documentReader, 0,
dpStart.getPosition(), 0);
documentReader.seek(dpStart.getPosition());
t = syntaxLexer.getNextToken();
}
newPositions.add(dpStart);
while (!done && t != null) {
synchronized (doclock) {
if (t.getCharEnd() <= document.getLength()) {
document.setCharacterAttributes(
t.getCharBegin() + change,
t.getCharEnd() - t.getCharBegin(),
getStyle(t.getDescription()), true);
dpEnd = new DocPosition(t.getCharEnd());
}
lastPosition = (t.getCharEnd() + change);
}
if (t.getState() == Token.INITIAL_STATE) {
while (dp != null
&& dp.getPosition() <= t.getCharEnd()) {
if (dp.getPosition() == t.getCharEnd()
&& dp.getPosition() >= endRequest
.getPosition()) {
done = true;
dp = null;
} else if (workingIt.hasNext()) {
dp = (DocPosition) workingIt.next();
} else {
dp = null;
}
}
newPositions.add(dpEnd);
}
synchronized (doclock) {
t = syntaxLexer.getNextToken();
}
}

workingIt = iniPositions.subSet(dpStart, dpEnd)
.iterator();
while (workingIt.hasNext()) {
workingIt.next();
workingIt.remove();
}

workingIt = iniPositions.tailSet(
new DocPosition(document.getLength()))
.iterator();
while (workingIt.hasNext()) {
workingIt.next();
workingIt.remove();
}

iniPositions.addAll(newPositions);
newPositions.clear();
} catch (IOException x) {
}
synchronized (doclock) {
lastPosition = -1;
change = 0;
}
tryAgain = true;
}
asleep = true;
if (!tryAgain) {
try {
sleep(0xffffff);
} catch (InterruptedException x) {
}

}
asleep = false;
}
}
}

public void colorAll() {
color(0, document.getLength());
}

public void color(int position, int adjustment) {
colorer.color(position, adjustment);
}

private void initDocument() {

syntaxLexer = new JavaLexer(documentReader);

try {
document.insertString(document.getLength(), defaultLayout,
getStyle("text"));
} catch (BadLocationException ble) {
System.err.println("Couldn't insert initial text.");
}
}

@SuppressWarnings({ "rawtypes" })
private Hashtable styles = new Hashtable();

private SimpleAttributeSet getStyle(String styleName) {
return ((SimpleAttributeSet) styles.get(styleName));
}

@SuppressWarnings("unchecked")
private void initStyles(int fontSize) {
SimpleAttributeSet style;

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("body", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.blue);
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("tag", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.blue);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("endtag", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("reference", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(0xB03060));
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("name", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(0xB03060));
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, true);
styles.put("value", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("text", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(220, 0, 94).brighter());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("reservedWord", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("identifier", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(34, 122, 225).brighter());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("literal", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY.darker());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("separator", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY.darker());
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("operator", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.green.darker());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("comment", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(0xA020F0).darker());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("preprocessor", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.black);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("whitespace", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.red);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("error", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.orange);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("unknown", style);
}

@SuppressWarnings("serial")
private class HighLightedDocument extends DefaultStyledDocument {

public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
synchronized (doclock) {
super.insertString(offs, str, a);
color(offs, str.length());
documentReader.update(offs, str.length());
}
}

public void remove(int offs, int len) throws BadLocationException {
synchronized (doclock) {
super.remove(offs, len);
color(offs, -len);
documentReader.update(offs, -len);
}
}
}
}

class DocPosition {

private int position;

int getPosition() {
return position;
}

public DocPosition(int position) {
this.position = position;
}

public DocPosition adjustPosition(int adjustment) {
position += adjustment;
return this;
}

public boolean equals(Object obj) {
if (obj instanceof DocPosition) {
DocPosition d = (DocPosition) (obj);
if (this.position == d.position) {
return true;
} else {
return false;
}
} else {
return false;
}
}

public String toString() {
return "" + position;
}
}

@SuppressWarnings({ "rawtypes" })
class DocPositionComparator implements Comparator {

public boolean equals(Object obj) {
if (obj instanceof DocPositionComparator) {
return true;
} else {
return false;
}
}

public int compare(Object o1, Object o2) {
if (o1 instanceof DocPosition && o2 instanceof DocPosition) {
DocPosition d1 = (DocPosition) (o1);
DocPosition d2 = (DocPosition) (o2);
return (d1.getPosition() - d2.getPosition());
} else if (o1 instanceof DocPosition) {
return -1;
} else if (o2 instanceof DocPosition) {
return 1;
} else if (o1.hashCode() < o2.hashCode()) {
return -1;
} else if (o2.hashCode() > o1.hashCode()) {
return 1;
} else {
return 0;
}
}
}

class DocumentReader extends Reader {

public void update(int position, int adjustment) {
if (position < this.position) {
if (this.position < position - adjustment) {
this.position = position;
} else {
this.position += adjustment;
}
}
}

private long position = 0;

private long mark = -1;

private AbstractDocument document;

public DocumentReader(AbstractDocument document) {
this.document = document;
}

public void close() {
}

public void mark(int readAheadLimit) {
mark = position;
}

public boolean markSupported() {
return true;
}

public int read() {
if (position < document.getLength()) {
try {
char c = document.getText((int) position, 1).charAt(0);
position++;
return c;
} catch (BadLocationException x) {
return -1;
}
} else {
return -1;
}
}

public int read(char[] cbuf) {
return read(cbuf, 0, cbuf.length);
}

public int read(char[] cbuf, int off, int len) {
if (position < document.getLength()) {
int length = len;
if (position + length >= document.getLength()) {
length = document.getLength() - (int) position;
}
if (off + length >= cbuf.length) {
length = cbuf.length - off;
}
try {
String s = document.getText((int) position, length);
position += length;
for (int i = 0; i < length; i++) {
cbuf[off + i] = s.charAt(i);
}
return length;
} catch (BadLocationException x) {
return -1;
}
} else {
return -1;
}
}

public boolean ready() {
return true;
}

public void reset() {
if (mark == -1) {
position = 0;
} else {
position = mark;
}
mark = -1;
}

public long skip(long n) {
if (position + n <= document.getLength()) {
position += n;
return n;
} else {
long oldPos = position;
position = document.getLength();
return (document.getLength() - oldPos);
}
}

public void seek(long n) {
if (n <= document.getLength()) {
position = n;
} else {
position = document.getLength();
}
}
}

So, it's obviously my script editor.

The part that pissed me off the most is this:

public void actionPerformed(ActionEvent paramActionEvent)
{
JOptionPane.showMessageDialog(this.val$contentPane, new String[] { "A Script Editor Made for RuneDev.", "\nThis Editor was designed by Sorcermus\nfor the RuneDev gaming client\nFor more information, \nvisit; http://runedev.info/" }, "\nAbout this editor, and the game client", 1);
}

Which clames that kid made the script editor for RuneDev… he has also made $185 this month from RuneDev, so he is proffiting off of TRiBot / RSBot.

:fiery:

What to do now…

Wanted

2010-09-29 20:42:37

Dam, that sucks. Advertise your free product on his site?

kingarabian

2010-09-29 20:42:58

Contact the host of his site? Contact him? Start warning people against him?

mormonman

2010-09-29 21:12:15

You would have to have a license on your bot in order to really "do" anything.

Cstrike

2010-09-29 21:15:26

From: mormonman
You would have to have a license on your bot in order to really "do" anything.


Isn't it stealing his intellectual property?
Note I don't have a clue about subjects like these ;) So that could be completely wrong ;)

Camaro'

2010-09-29 21:55:46

Find out where he lives and take matters into your own hands :)

NCDS

2010-09-29 22:17:06

I really only see proof he copied RSBot. There are certain lines similar/the same as yours, but it's not a complete copy by any means from what I just looked at.

Even so, like mormonman said, unless you have rights to the code/method I see nothing you can do.

TRiLeZ

2010-09-29 22:25:06

From: NCDS
I really only see proof he copied RSBot. There are certain lines similar/the same as yours, but it's not a complete copy by any means from what I just looked at.

Even so, like mormonman said, unless you have rights to the code/method I see nothing you can do.


Certain lines that are similar? It's my code, which has been modified. Don't you mean there are certain lines that are different?

Anyways, I'm just gonna make a thread about this on RSBot's forums and I'll see how they handle it.

NCDS

2010-09-29 22:30:46

From: TRiLeZ
Certain lines that are similar? It's my code, which has been modified. Don't you mean there are certain lines that are different?

Anyways, I'm just gonna make a thread about this on RSBot's forums and I'll see how they handle it.


I see enough differences that the person could argue it's not your code. Though, I also see plenty that you could argue is yours.

Hard situation to handle I guess :/

moparisthebest

2010-09-29 22:49:04

What license is your bot and rsbot licensed under?

TRiLeZ

2010-09-29 23:08:32

From: moparisthebest
What license is your bot and rsbot licensed under?


RSBot is licensed under GNU GPL. I just licensed my bot under GNU GPL today, but that won't have any effect on this situation. I would have licensed it sooner if I would have known GNU GPL was a free license (which I just found out today that it was).

Alek000

2010-09-29 23:58:39

[QUOTE=Camaro';740040]Find out where he lives and take matters into your own hands :)[/QUOTE]

I can get you a gun permit and a handgun for cheap ;)

Harry

2010-09-30 07:34:29

Is RuneDev free-as-in-beer?
Is RuneDev open-source?
What is RuneDev's license?

Bobzilla69

2010-09-30 09:27:28

encrypt your code?

i luffs yeww

2010-09-30 10:28:20

^ That's a terrible idea.

Wyn

2010-09-30 10:29:13

I bet yours was used has a template.

Atleast people adore your work lol.

Bobzilla69

2010-09-30 10:47:05

From: i luffs yeww
^ That's a terrible idea.


care to elaborate?

is it not possible? does it cause problems?

Nava2

2010-09-30 10:56:53

From: bobzilla69
care to elaborate?

is it not possible? does it cause problems?


His code is GPL, thus its open-source.

What is the liscence of RuneDev, this is important here.

Bobzilla69

2010-09-30 11:02:04

From: Nava2
His code is GPL, thus its open-source.

What is the liscence of RuneDev, this is important here.


ah yes, it is now. could he not have done this before he got the GPL?

moparisthebest

2010-09-30 11:38:20

From: TRiLeZ
RSBot is licensed under GNU GPL. I just licensed my bot under GNU GPL today, but that won't have any effect on this situation. I would have licensed it sooner if I would have known GNU GPL was a free license (which I just found out today that it was).


That is great to hear, now is this RuneDev bot also licensed under the GNU/GPL? If so, then it is perfectly legal and such, if not, you could send them some orders to make it GPL compliant, or get the FSF to sue them if it comes to that.

TRiLeZ

2010-09-30 18:10:20

From: moparisthebest
That is great to hear, now is this RuneDev bot also licensed under the GNU/GPL? If so, then it is perfectly legal and such, if not, you could send them some orders to make it GPL compliant, or get the FSF to sue them if it comes to that.


They are also licensed under GNU/GPL. The lead devloper over at Runedev claims that he knows nothing about me or TRiBot. Oh, well. I guess I can't really do anything then.

pyroryan

2010-09-30 18:11:30

Do they even release their source code?

Becks

2010-09-30 18:24:19

That's messed up. H4x him.. i can help ;) seriously i can.

Cstrike

2010-09-30 20:57:19

From: TRiLeZ
They are also licensed under GNU/GPL. The lead devloper over at Runedev claims that he knows nothing about me or TRiBot. Oh, well. I guess I can't really do anything then.


Can you get screwed over in any way by him saying you stole his stuff now?

i luffs yeww

2010-09-30 22:48:05

Tribot has clients that were uploaded well before RuneDev, obviously. There is more than enough proof to prove that TRiLeZ didn't steal anything.

Nava2

2010-10-01 02:01:14

If his is FOSS, then thats kinda the point isn't it? He really shouldn't be claiming its his though, if you wrote it.

moparisthebest

2010-10-01 02:37:38

From: Nava2
If his is FOSS, then thats kinda the point isn't it? He really shouldn't be claiming its his though, if you wrote it.


Basically. He should give you credit, but he of course has the right to use it as long as he abides by the GPL license (which is basically do whatever you want with the code, as long as you release it under the GNU/GPL as well.)

ruler

2010-10-02 15:08:14

http://en.wikipedia.org/wiki/Clean_room_design

Dyhrkopp

2010-10-19 17:55:33

Nice story, thx for claiming a script editor you didn't write, Runedev's script editor is "modified" from the same open source script editor you "modified" and put in your bot… Why don't ya post that up here?

Thx for publicly mentioning Runedev though, we are getting popular :)

pyroryan

2010-10-19 18:09:50

From: Dyhrkopp
Nice story, thx for claiming a script editor you didn't write, Runedev's script editor is "modified" from the same open source script editor you "modified" and put in your bot… Why don't ya post that up here?


Funny how the serialVersionUID was the same though. Theres very little chance that both of you chose the same value for it. By little I mean like less than 1 in a million (I don't remember the number).
So you clearly modified it from trilez's script editor, which he may or may not have modified someone else's.

Edit:
Less than 1*10^-20 chance that you picked the same value.

DeSnob

2010-10-19 18:28:21

From: pyroryan
Funny how the serialVersionUID was the same though. Theres very little chance that both of you chose the same value for it. By little I mean like less than 1 in a million (I don't remember the number).
So you clearly modified it from trilez's script editor, which he may or may not have modified someone else's.

Edit:
Less than 1*10^-20 chance that you picked the same value.


Bolded key sentence… code stealer. STOP STEALING PEOPLE'S COOKIES!

sorcermus

2010-10-19 18:37:01

Our script editor is a simple one with a standard set math that was established in like 2002 by a guy by the name of Stephen Ostermiller. His web site is located here

http://ostermiller.org/

He made a text highlighter package to use in java that allows the user to set up a file to show more clearly parts as the user would like to see them. Here is the package.

http://ostermiller.org/syntax/

All of his work is free to use he has made no request that anyone should have to pay him for what he has put together, and he offeres the package freely

Now in his source package there is a demo of text file highlighting program. It looks like this.


In his tutorial he explains how to alter this demo to set it up as the user would want for file text highlighting. He also points the reader in the direction of the standard basic java text pane methods.

http://download.oracle.com/javase/tutorial/uiswing/components/generaltext.html

Now all that is left to this math is to add in a standard file open and save protocol located here.

http://download.oracle.com/javase/tutorial/uiswing/components/filechooser.html

tribot is claiming that they "wrote" this. Is the developer of this tribot actually this Ostermiller person? The entire thing is from the demo with no added special math that sets it as a, "I wrote that" standard for anyone to say.

If the fact that the lead developer of Runedev knows all of this and makes no claim to own the rights to the file personally because he admits that he isn’t this Ostermiller person, and has shown exactly how the script editor was made, all of the resources, and places to find the math,

then isn't it likely that no one stole anything.

Isn’t it likely that the text loading highlighter made into this handy “script editor” would be a nice add to any client development that handles scripts, and the developer of tribot would like it to show how their client stands out above the rest by insuring that no one else could use Ostermiller’s work.

Well though I don’t want to say it but it needs to be said; Ostermiller made his work both open source and free to use. That fact alone means you can not own the rights to the file as you used free open source as the main base to make it. As far as calling wolf in the chicken coop and saying that Runedev stole this from you; just because a development hasn’t been around as long as you doesn’t mean they are out to steal or rip off anyone else’s work to make a name for themselves. The fact is Runedev put back up the rsbot client when the rsbot.org site was taken down in March, and have continued the development of that in a different direction adding 100s of features and perks to the source that were never offered in the rsbot client or any other client for that matter.

I believe it is more the fact that the Runedev.info site has now 15,000 members and the Tribot.org site has a little over 125 members, and the developer of the tribot’s client feels that this prized “script editor” will not benefit his cause to improve his status in the macro development communities, or the membership on his site, and that is why this issue has been brought here to these forums to simply boaster an unjust cause of belittling the Runedev development and inflate the tribot site membership.

TRiLeZ

2010-10-19 19:17:25

Main demo class code:

package com.Ostermiller.Syntax;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;

public class ProgrammerEditorDemo extends JFrame
{
private HighlightedDocument document = new HighlightedDocument();
private JTextPane textPane = new JTextPane(this.document);

public ProgrammerEditorDemo()
{
super("Programmer's Editor Demonstration");
setLocation(50, 50);
JScrollPane localJScrollPane = new JScrollPane(this.textPane);
localJScrollPane.setPreferredSize(new Dimension(620, 460));
JPanel localJPanel = new JPanel(new BorderLayout());
localJPanel.add(localJScrollPane, "Center");
setContentPane(localJPanel);
JMenu localJMenu = createStyleMenu();
JMenuBar localJMenuBar = new JMenuBar();
localJMenuBar.add(localJMenu);
setJMenuBar(localJMenuBar);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent paramWindowEvent)
{
System.exit(0);
}

public void windowActivated(WindowEvent paramWindowEvent)
{
ProgrammerEditorDemo.this.textPane.requestFocus();
}
});
initDocument();
pack();
setVisible(true);
}

private JMenu createStyleMenu()
{
JRadioButtonMenuItem[] arrayOfJRadioButtonMenuItem = { new StyleMenuItem("Java", HighlightedDocument.JAVA_STYLE), new StyleMenuItem("C/C++", HighlightedDocument.C_STYLE), new StyleMenuItem("HTML (Simple)", HighlightedDocument.HTML_STYLE), new StyleMenuItem("HTML (Complex)", HighlightedDocument.HTML_KEY_STYLE), new StyleMenuItem("LaTeX", HighlightedDocument.LATEX_STYLE), new StyleMenuItem("SQL", HighlightedDocument.SQL_STYLE), new StyleMenuItem("Java Properties", HighlightedDocument.PROPERTIES_STYLE), new StyleMenuItem("Plain", HighlightedDocument.PLAIN_STYLE), new StyleMenuItem("Grayed Out", HighlightedDocument.GRAYED_OUT_STYLE) };
JMenu localJMenu = new JMenu("Style");
ButtonGroup localButtonGroup = new ButtonGroup();
for (int i = 0; i < arrayOfJRadioButtonMenuItem.length; ++i)
{
localButtonGroup.add(arrayOfJRadioButtonMenuItem[i]);
localJMenu.add(arrayOfJRadioButtonMenuItem[i]);
}
return localJMenu;
}

private void initDocument()
{
String str = "/**\n * Simple common test program.\n */\npublic class HelloWorld {\n public static void main(String[] args) {\n // Display the greeting.\n System.out.println(\"Hello World!\");\n }\n}\n";
this.textPane.setText(str);
}

public static void main(String[] paramArrayOfString)
{
ProgrammerEditorDemo localProgrammerEditorDemo = new ProgrammerEditorDemo();
}

private class StyleMenuItem extends JRadioButtonMenuItem
implements ActionListener
{
Object style;

StyleMenuItem(String paramString, Object paramObject)
{
super(paramString);
this.style = paramObject;
addActionListener(this);
}

public void actionPerformed(ActionEvent paramActionEvent)
{
ProgrammerEditorDemo.this.document.setHighlightStyle(this.style);
}
}
}

Runedev script editor code:

package org.rsbot.gui;

import info.runedev.Lexer.JavaLexer;
import info.runedev.Lexer.Lexer;
import info.runedev.Lexer.Token;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu.Separator;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.Position;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import org.rsbot.util.GlobalConfiguration;
import org.rsbot.util.GlobalConfiguration.OperatingSystem;
import org.rsbot.util.GlobalConfiguration.Paths;

public class ScriptEditor extends JInternalFrame
{
private static final long serialVersionUID = 8326421682467537173L;
public static File file = new File("");
private JPopupMenu.Separator jSeparator1;
protected JTextPane textPane;
protected HighLightedDocument document;
protected DocumentReader documentReader;
protected Lexer syntaxLexer;
protected Colorer colorer;
private Object doclock = new Object();
public static String defaultLayout = "import java.awt.Graphics; \nimport java.util.Map; \n\nimport org.rsbot.event.listeners.PaintListener; \nimport org.rsbot.script.Script; \nimport org.rsbot.script.ScriptManifest; \n\n@ScriptManifest(authors = { \"Your Name Here\" }, name = \"Script Name Here\",\n category = \"\", version = 1.00, description = \"\") \n public class YourScriptNameHere extends Script implements PaintListener { \n\n public int loop() {\n return (5);\n }\n\n public void onRepaint(final Graphics render) {\n }\n\n public boolean onStart(final Map<String, String> args) {\n return true;\n }\n\n public void onFinish() {\n }\n}";

private Hashtable styles = new Hashtable();

public ScriptEditor()
{
try
{
setFrameIcon(new ImageIcon((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/script_edit.png") : new File(GlobalConfiguration.Paths.SCRIPT_EDIT).toURI().toURL()));
} catch (MalformedURLException localMalformedURLException) {
}
setTitle("Runedev Script Editor");
setVisible(true);
setBackground(new Color(245, 245, 245));
setResizable(false);

this.document = new HighLightedDocument(null);
this.jSeparator1 = new JPopupMenu.Separator();

this.textPane = new JTextPane(this.document);
this.textPane.setCaretPosition(0);
this.textPane.setMargin(new Insets(5, 5, 5, 5));
JScrollPane localJScrollPane = new JScrollPane(this.textPane);

JPanel localJPanel = new JPanel(new BorderLayout());
localJPanel.add(localJScrollPane, "Center");
setContentPane(localJPanel);

JMenuBar localJMenuBar = new JMenuBar();

JMenu localJMenu1 = new JMenu("File");
JMenuItem localJMenuItem1 = new JMenuItem("New");
localJMenuItem1.setAccelerator(KeyStroke.getKeyStroke(78, 2));
try {
Image localImage1 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/pencil.png") : new File(GlobalConfiguration.Paths.PENCIL).toURI().toURL());

localJMenuItem1.setIcon(new ImageIcon(localImage1));
} catch (Exception localException1) {
}
localJMenu1.add(localJMenuItem1);

JMenuItem localJMenuItem2 = new JMenuItem("Open");
localJMenuItem2.setAccelerator(KeyStroke.getKeyStroke(79, 2));
try {
Image localImage2 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/control_play_blue.png") : new File(GlobalConfiguration.Paths.ICON_PLAY).toURI().toURL());

localJMenuItem2.setIcon(new ImageIcon(localImage2));
} catch (Exception localException2) {
}
localJMenu1.add(localJMenuItem2);

JMenuItem localJMenuItem3 = new JMenuItem("Save");
localJMenuItem3.setAccelerator(KeyStroke.getKeyStroke(83, 2));
try {
Image localImage3 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/save.png") : new File(GlobalConfiguration.Paths.SAVE).toURI().toURL());

localJMenuItem3.setIcon(new ImageIcon(localImage3));
} catch (Exception localException3) {
}
localJMenu1.add(localJMenuItem3);
localJMenuBar.add(localJMenu1);

JMenu localJMenu2 = new JMenu("Edit");
JMenuItem localJMenuItem4 = new JMenuItem("Cut");
localJMenuItem4.setAccelerator(KeyStroke.getKeyStroke(88, 2));
try {
Image localImage4 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/cut.png") : new File(GlobalConfiguration.Paths.CUT).toURI().toURL());

localJMenuItem4.setIcon(new ImageIcon(localImage4));
} catch (Exception localException4) {
}
localJMenu2.add(localJMenuItem4);

JMenuItem localJMenuItem5 = new JMenuItem("Copy");
localJMenuItem5.setAccelerator(KeyStroke.getKeyStroke(67, 2));
try {
Image localImage5 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/copy.png") : new File(GlobalConfiguration.Paths.COPY).toURI().toURL());

localJMenuItem5.setIcon(new ImageIcon(localImage5));
} catch (Exception localException5) {
}
localJMenu2.add(localJMenuItem5);

JMenuItem localJMenuItem6 = new JMenuItem("Paste");
localJMenuItem6.setAccelerator(KeyStroke.getKeyStroke(86, 2));
try {
Image localImage6 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/paste.png") : new File(GlobalConfiguration.Paths.PASTE).toURI().toURL());

localJMenuItem6.setIcon(new ImageIcon(localImage6));
} catch (Exception localException6) {
}
localJMenu2.add(localJMenuItem6);
localJMenu2.add(this.jSeparator1);

JMenuItem localJMenuItem7 = new JMenuItem("Select All");
localJMenuItem7.setAccelerator(KeyStroke.getKeyStroke(65, 2));
localJMenu2.add(localJMenuItem7);
localJMenuBar.add(localJMenu2);

JMenu localJMenu3 = new JMenu("Info");
JMenuItem localJMenuItem8 = new JMenuItem("Troubleshooting");
localJMenuItem8.setAccelerator(KeyStroke.getKeyStroke(84, 2));
try {
Image localImage7 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/web_small.png") : new File(GlobalConfiguration.Paths.WEB_SMALL).toURI().toURL());

localJMenuItem8.setIcon(new ImageIcon(localImage7));
} catch (Exception localException7) {
}
localJMenu3.add(localJMenuItem8);

JMenuItem localJMenuItem9 = new JMenuItem("about");
localJMenuItem9.setAccelerator(KeyStroke.getKeyStroke(112, 2));
try {
Image localImage8 = Toolkit.getDefaultToolkit().getImage((GlobalConfiguration.RUNNING_FROM_JAR) ? super.getClass().getResource("/resources/images/gui_button.png") : new File(GlobalConfiguration.Paths.GUI_BUTTON).toURI().toURL());

localJMenuItem9.setIcon(new ImageIcon(localImage8));
} catch (Exception localException8) {
}
localJMenu3.add(localJMenuItem9);
localJMenuBar.add(localJMenu3);

localJMenuItem1.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
if (JOptionPane.showConfirmDialog(this.val$contentPane, "You really want to start a new script? \nAll un-saved work on this script will be lost.") != 0)
return;
try
{
this.this$0.document.remove(0, this.this$0.document.getLength());
this.this$0.document.insertString(this.this$0.document.getLength(), ScriptEditor.defaultLayout, this.this$0.getStyle("text"));
}
catch (BadLocationException localBadLocationException)
{
}

}

});
localJMenuItem2.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
JFileChooser localJFileChooser = new JFileChooser(ScriptEditor.file);
localJFileChooser.setCurrentDirectory(new File("./scripts/"));
localJFileChooser.addChoosableFileFilter(new ScriptEditor.JavaFilter(this.this$0));
if (localJFileChooser.showOpenDialog(this.val$contentPane) == 0) {
ScriptEditor.file = localJFileChooser.getSelectedFile();
try {
this.this$0.document.remove(0, this.this$0.document.getLength());
BufferedReader localBufferedReader = new BufferedReader(new FileReader(ScriptEditor.file));

String str = null;
while ((str = localBufferedReader.readLine()) != null) {
if (this.this$0.document.getLength() != 0) {
this.this$0.document.insertString(this.this$0.document.getLength(), "\n", this.this$0.getStyle("text"));
}

this.this$0.document.insertString(this.this$0.document.getLength(), str, this.this$0.getStyle("text"));
}

}
catch (Exception localException)
{
}

}

}

});
localJMenuItem3.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
JFileChooser localJFileChooser = new JFileChooser(ScriptEditor.file);
localJFileChooser.setCurrentDirectory(new File("./scripts/"));
localJFileChooser.addChoosableFileFilter(new ScriptEditor.JavaFilter(this.this$0));
if (localJFileChooser.showSaveDialog(this.val$contentPane) != 0) return;
try {
ScriptEditor.file = localJFileChooser.getSelectedFile();
BufferedWriter localBufferedWriter = new BufferedWriter(new FileWriter(ScriptEditor.file));

localBufferedWriter.write(this.this$0.document.getText(0, this.this$0.document.getLength()));

localBufferedWriter.close();
}
catch (Exception localException)
{
}

}

});
localJMenuItem4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.cut();
}

});
localJMenuItem5.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.copy();
}

});
localJMenuItem6.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.paste();
}

});
localJMenuItem7.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent paramActionEvent)
{
ScriptEditor.this.textPane.selectAll();
}

});
localJMenuItem8.addActionListener(new ActionListener()
{
public void openURL(String paramString)
{
GlobalConfiguration.OperatingSystem localOperatingSystem = GlobalConfiguration.getCurrentOperatingSystem();
try {
Object localObject;
Method localMethod;
if (localOperatingSystem == GlobalConfiguration.OperatingSystem.MAC) {
localObject = Class.forName("com.apple.eio.FileManager");
localMethod = ((Class)localObject).getDeclaredMethod("openURL", new Class[] { String.class });

localMethod.invoke(null, new Object[] { paramString });
} else if (localOperatingSystem == GlobalConfiguration.OperatingSystem.WINDOWS) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + paramString);
} else {
localObject = new String[] { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
localMethod = null;
for (int i = 0; (i < localObject.length) && (localMethod == null); ++i) {
if (Runtime.getRuntime().exec(new String[] { "which", localObject[i] }).waitFor() == 0) {
localMethod = localObject[i];
}
}
if (localMethod == null) {
throw new Exception("Could not find web browser");
}
Runtime.getRuntime().exec(new String[] { localMethod, paramString });
}
}
catch (Exception localException) {
}
}

public void actionPerformed(ActionEvent paramActionEvent) {
openURL("http://forum.runedev.info/viewtopic.php?f=40&t=2629");
}

});
localJMenuItem9.addActionListener(new ActionListener(localJPanel)
{
public void actionPerformed(ActionEvent paramActionEvent)
{
JOptionPane.showMessageDialog(this.val$contentPane, new String[] { "A Script Editor Made for RuneDev.", "\nThis Editor was designed by Sorcermus\nfor the RuneDev gaming client\nFor more information, \nvisit; http://runedev.info/" }, "\nAbout this editor, and the game client", 1);
}

});
setJMenuBar(localJMenuBar);

JTextArea localJTextArea = new JTextArea("");
localJTextArea.setSelectionEnd(this.document.getLength());
localJTextArea.setFont(new Font("Monospaced", 0, 12));
localJTextArea.setBackground(new Color(210, 210, 210));
localJTextArea.setEditable(false);
localJTextArea.setMargin(new Insets(5, 2, 5, 2));

this.document.addDocumentListener(new DocumentListener(localJTextArea)
{
public String getText() {
int i = ScriptEditor.this.document.getEndPosition().getOffset();
Element localElement = ScriptEditor.this.document.getDefaultRootElement();
String str = "1" + System.getProperty("line.separator");
for (int j = 2; j < localElement.getElementIndex(i) + 2; ++j) {
str = str + j + System.getProperty("line.separator");
}
return str;
}

public void changedUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

public void insertUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

public void removeUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

});
localJScrollPane.setRowHeaderView(localJTextArea);

this.colorer = new Colorer(null);
this.colorer.start();

initStyles(12);

this.documentReader = new DocumentReader(this.document);

initDocument();

pack();
setVisible(true);
}

public void colorAll()
{
color(0, this.document.getLength());
}

public void color(int paramInt1, int paramInt2) {
this.colorer.color(paramInt1, paramInt2);
}

private void initDocument()
{
this.syntaxLexer = new JavaLexer(this.documentReader);
try
{
this.document.insertString(this.document.getLength(), defaultLayout, getStyle("text"));
}
catch (BadLocationException localBadLocationException) {
System.err.println("Couldn't insert initial text.");
}
}

private SimpleAttributeSet getStyle(String paramString)
{
return ((SimpleAttributeSet)this.styles.get(paramString));
}

private void initStyles(int paramInt)
{
SimpleAttributeSet localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("body", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.blue);
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("tag", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.blue);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("endtag", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("reference", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(11546720));
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("name", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(11546720));
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, true);
this.styles.put("value", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("text", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.blue);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("reservedWord", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("identifier", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(11546720));
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("literal", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(128));
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("separator", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, true);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("operator", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.green.darker());
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("comment", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, new Color(10494192).darker());
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("preprocessor", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.black);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("whitespace", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.red);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("error", localSimpleAttributeSet);

localSimpleAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(localSimpleAttributeSet, "Monospaced");
StyleConstants.setFontSize(localSimpleAttributeSet, paramInt);
StyleConstants.setBackground(localSimpleAttributeSet, Color.white);
StyleConstants.setForeground(localSimpleAttributeSet, Color.orange);
StyleConstants.setBold(localSimpleAttributeSet, false);
StyleConstants.setItalic(localSimpleAttributeSet, false);
this.styles.put("unknown", localSimpleAttributeSet);
}

private class HighLightedDocument extends DefaultStyledDocument
{
public void insertString(int paramInt, String paramString, AttributeSet paramAttributeSet)
throws BadLocationException
{
synchronized (ScriptEditor.this.doclock) {
super.insertString(paramInt, paramString, paramAttributeSet);
ScriptEditor.this.color(paramInt, paramString.length());
ScriptEditor.this.documentReader.update(paramInt, paramString.length());
}
}

public void remove(int paramInt1, int paramInt2) throws BadLocationException
{
synchronized (ScriptEditor.this.doclock) {
super.remove(paramInt1, paramInt2);
ScriptEditor.this.color(paramInt1, -paramInt2);
ScriptEditor.this.documentReader.update(paramInt1, -paramInt2);
}
}
}

private class Colorer extends Thread
{
private TreeSet iniPositions;
private HashSet newPositions;
private volatile Vector v;
private volatile int change;
private volatile int lastPosition;
private volatile boolean asleep;
private Object lock;

private Colorer()
{
this.iniPositions = new TreeSet(new DocPositionComparator());

this.newPositions = new HashSet();

this.v = new Vector();

this.change = 0;
this.lastPosition = -1;
this.asleep = false;
this.lock = new Object();
}

public void color(int paramInt1, int paramInt2) {
if (paramInt1 < this.lastPosition) {
if (this.lastPosition < paramInt1 - paramInt2)
this.change -= this.lastPosition - paramInt1;
else {
this.change += paramInt2;
}
}
synchronized (this.lock) {
this.v.add(new RecolorEvent(paramInt1, paramInt2));
if (this.asleep)
interrupt();
}
}

public void run()
{
int i = -1;
int j = 0;
int k = 0;
while (true)
{
Object localObject1;
synchronized (this.lock) {
if (this.v.size() > 0) {
localObject1 = (RecolorEvent)(RecolorEvent)this.v.elementAt(0);
this.v.removeElementAt(0);
i = ((RecolorEvent)localObject1).position;
j = ((RecolorEvent)localObject1).adjustment;
} else {
k = 0;
i = -1;
j = 0;
}
}
if (i != -1)
{
DocPosition localDocPosition1 = new DocPosition(i);
DocPosition localDocPosition2 = new DocPosition(i + ((j >= 0) ? j : -j));

DocPosition localDocPosition4 = null;
DocPosition localDocPosition5 = null;
try
{
??? = this.iniPositions.headSet(localDocPosition1);
localDocPosition4 = (DocPosition)((SortedSet)???).last();
} catch (NoSuchElementException localNoSuchElementException) {
localDocPosition4 = new DocPosition(0);
}

if (j < 0) {
??? = this.iniPositions.subSet(localDocPosition1, localDocPosition2);

localObject1 = ((SortedSet)???).iterator();
while (((Iterator)localObject1).hasNext()) {
((Iterator)localObject1).next();
((Iterator)localObject1).remove();
}
}

??? = this.iniPositions.tailSet(localDocPosition1);
localObject1 = ((SortedSet)???).iterator();
while (((Iterator)localObject1).hasNext()) {
((DocPosition)((Iterator)localObject1).next()).adjustPosition(j);
}

??? = this.iniPositions.tailSet(localDocPosition4);
localObject1 = ((SortedSet)???).iterator();
DocPosition localDocPosition3 = null;
if (((Iterator)localObject1).hasNext()) {
localDocPosition3 = (DocPosition)((Iterator)localObject1).next();
}

try
{
Token localToken;
int l = 0;
localDocPosition5 = localDocPosition4;
synchronized (ScriptEditor.this.doclock) {
ScriptEditor.this.syntaxLexer.reset(ScriptEditor.this.documentReader, 0, localDocPosition4.getPosition(), 0);
ScriptEditor.this.documentReader.seek(localDocPosition4.getPosition());
localToken = ScriptEditor.this.syntaxLexer.getNextToken();
}
this.newPositions.add(localDocPosition4);
while ((l == 0) && (localToken != null)) {
synchronized (ScriptEditor.this.doclock) {
if (localToken.getCharEnd() <= ScriptEditor.this.document.getLength()) {
ScriptEditor.this.document.setCharacterAttributes(localToken.getCharBegin() + this.change, localToken.getCharEnd() - localToken.getCharBegin(), ScriptEditor.this.getStyle(localToken.getDescription()), true);

localDocPosition5 = new DocPosition(localToken.getCharEnd());
}
this.lastPosition = (localToken.getCharEnd() + this.change);
}
if (localToken.getState() == 0)
{
while ((localDocPosition3 != null) && (localDocPosition3.getPosition() <= localToken.getCharEnd())) {
if ((localDocPosition3.getPosition() == localToken.getCharEnd()) && (localDocPosition3.getPosition() >= localDocPosition2.getPosition()))
{
l = 1;
localDocPosition3 = null; }
if (((Iterator)localObject1).hasNext()) {
localDocPosition3 = (DocPosition)((Iterator)localObject1).next();
}
localDocPosition3 = null;
}

this.newPositions.add(localDocPosition5);
}
synchronized (ScriptEditor.this.doclock) {
localToken = ScriptEditor.this.syntaxLexer.getNextToken();
}
}

localObject1 = this.iniPositions.subSet(localDocPosition4, localDocPosition5).iterator();
while (((Iterator)localObject1).hasNext()) {
((Iterator)localObject1).next();
((Iterator)localObject1).remove();
}

localObject1 = this.iniPositions.tailSet(new DocPosition(ScriptEditor.this.document.getLength())).iterator();

while (((Iterator)localObject1).hasNext()) {
((Iterator)localObject1).next();
((Iterator)localObject1).remove();
}

this.iniPositions.addAll(this.newPositions);
this.newPositions.clear();
} catch (IOException localIOException) {
}
synchronized (ScriptEditor.this.doclock) {
this.lastPosition = -1;
this.change = 0;
}
k = 1;
}
this.asleep = true;
if (k == 0)
try {
sleep(16777215L);
}
catch (InterruptedException localInterruptedException)
{
}
this.asleep = false;
}
}

private class RecolorEvent
{
public int position;
public int adjustment;

public RecolorEvent(int paramInt1, int paramInt2)
{
this.position = paramInt1;
this.adjustment = paramInt2;
}
}
}

class JavaFilter extends FileFilter
{
public boolean accept(File paramFile)
{
String str = paramFile.getName();
return str.endsWith(".java");
}

public String getDescription() {
return "*.java";
}
}
}

TRiBot script editor code:

package org.tribot.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Vector;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

import org.tribot.bot.TRiBot;
import org.tribot.loader.Client;

import com.Ostermiller.Syntax.Lexer.JavaLexer;
import com.Ostermiller.Syntax.Lexer.Lexer;
import com.Ostermiller.Syntax.Lexer.Token;

public class ScriptEditor extends JInternalFrame {

private static final long serialVersionUID = 8326421682467537173L;

public static File file = new File("");
protected JTextPane textPane;
protected HighLightedDocument document;
protected DocumentReader documentReader;
protected Lexer syntaxLexer;
protected Colorer colorer;
private Object doclock = new Object();

public String defaultLayout = "package scripts;"
+ "\n"
+ "\nimport java.awt.Graphics;"
+ "\n"
+ "\nimport org.tribot.loader.Client;"
+ "\nimport org.tribot.script.Script;"
+ "\nimport org.tribot.wrappers.RSInterface;"
+ "\nimport org.tribot.script.ScriptManifest;"
+ "\n"
+ "\n@ScriptManifest(authors = { \"TRiLeZ\" }, name = \"Script Skeleton\", category = \"Skeleton\")"
+ "\npublic class ScriptSkeleton extends Script {" + "\n"
+ "\n public ScriptSkeleton(Client bot) {" + "\n super(bot);"
+ "\n }" + "\n" + "\n public void onPause() {" + "\n" + "\n }"
+ "\n" + "\n public void onResume() {" + "\n" + "\n }" + "\n"
+ "\n public void onBreakStart() {" + "\n" + "\n }" + "\n"
+ "\n public void onBreakEnd() {" + "\n" + "\n }" + "\n"
+ "\n public void onEnd() {" + "\n" + "\n }" + "\n"
+ "\n public void onPaint(Graphics g) {" + "\n" + "\n }" + "\n"
+ "\n public void run() {" + "\n" + "\n }" + "\n" + "\n}";

public ScriptEditor() {
this.setTitle("Script Editor");
this.setVisible(true);
this.setBackground(new Color(245, 245, 245));
this.setResizable(false);
this.setFrameIcon(new ImageIcon("images/script icon.png"));

document = new HighLightedDocument();

textPane = new JTextPane(document);
textPane.setCaretPosition(0);
textPane.setMargin(new Insets(5, 5, 5, 5));
JScrollPane scrollPane = new JScrollPane(textPane);
scrollPane
.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

final JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(scrollPane, BorderLayout.CENTER);
setContentPane(contentPane);

JMenuBar menuBar = new JMenuBar();

JMenu fileMenu = new JMenu("File");
Icon icon = new ImageIcon("images\\new.png");
JMenuItem newScript = new JMenuItem("New", icon);
fileMenu.add(newScript);
icon = new ImageIcon("images\\open.png");
JMenuItem openScript = new JMenuItem("Open", icon);
fileMenu.add(openScript);
icon = new ImageIcon("images\\save.png");
JMenuItem saveScript = new JMenuItem("Save", icon);
fileMenu.add(saveScript);
menuBar.add(fileMenu);

JMenu editMenu = new JMenu("Edit");
icon = new ImageIcon("images\\cut.png");
JMenuItem cut = new JMenuItem("Cut", icon);
editMenu.add(cut);
icon = new ImageIcon("images\\copy.png");
JMenuItem copy = new JMenuItem("Copy", icon);
editMenu.add(copy);
icon = new ImageIcon("images\\paste.png");
JMenuItem paste = new JMenuItem("Paste", icon);
editMenu.add(paste);
icon = new ImageIcon("images\\select all.png");
JMenuItem selectAll = new JMenuItem("Select All", icon);
editMenu.add(selectAll);
menuBar.add(editMenu);

JMenu scriptMenu = new JMenu("Script");
icon = new ImageIcon("images\\compile.png");
JMenuItem compileScript = new JMenuItem("Compile", icon);
scriptMenu.add(compileScript);
icon = new ImageIcon("images\\terminal.png");
JMenuItem runScript = new JMenuItem("Run", icon);
scriptMenu.add(runScript);
menuBar.add(scriptMenu);

class newClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (JOptionPane
.showConfirmDialog(contentPane,
"You really want to start a new script? All un-saved work will be lost.") == 0)
try {
document.remove(0, document.getLength());
document.insertString(document.getLength(),
defaultLayout, getStyle("text"));
} catch (BadLocationException e1) {
e1.printStackTrace();
}
}
}

class openClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
Frame f = new Frame("Open");
f.setIconImage(Toolkit.getDefaultToolkit().getImage(
"images/open.png"));
final JFileChooser fc = new JFileChooser(file);
fc.setCurrentDirectory(new File("./src/scripts/"));
fc.addChoosableFileFilter(new JavaFilter());
if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
try {
document.remove(0, document.getLength());
BufferedReader in = new BufferedReader(new FileReader(
file));
String line = null;
while ((line = in.readLine()) != null) {
if (document.getLength() != 0)
document.insertString(document.getLength(),
"\n", getStyle("text"));
document.insertString(document.getLength(), line,
getStyle("text"));
}
} catch (Exception ee) {
}
}
}
}

class saveClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
Frame f = new Frame("Open");
f.setIconImage(Toolkit.getDefaultToolkit().getImage(
"images/save.png"));
final JFileChooser fc = new JFileChooser(file);
fc.setCurrentDirectory(new File("./src/scripts/"));
fc.addChoosableFileFilter(new JavaFilter());
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
try {
Boolean b = true;
file = fc.getSelectedFile();
if (file.exists())
if (JOptionPane.showConfirmDialog(contentPane,
"Overwrite file?") != 0)
b = false;
if (b == true) {
BufferedWriter out = new BufferedWriter(
new FileWriter(file));
out.write(document.getText(0, document.getLength()));
out.close();
}
b = false;
} catch (Exception ee) {
ee.printStackTrace();
}
}
}
}

class Cut implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.cut();
}
}

class Copy implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.copy();
}
}

class Paste implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.paste();
}
}

class SelectAll implements ActionListener {
public void actionPerformed(ActionEvent e) {
textPane.selectAll();
}
}

class compileClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
try {
/* Writes script to temporary file */
File tempFile = new File("data\\temp\\temp.java");
BufferedWriter tempOut = new BufferedWriter(new FileWriter(
tempFile));
tempOut.write(document.getText(0, document.getLength()));
tempOut.close();

String scriptName = "";
try {
BufferedReader in = new BufferedReader(new FileReader(
tempFile));
String line = null;
while ((line = in.readLine()) != null) {
if (line.contains("public class")) {
String data[] = line.split(" ");
scriptName = data[2];
}
}
in.close();
} catch (Exception ee) {
}
tempFile.delete();
if (scriptName == "") {
TRiBot.mainGUI
.println("Script Editor: Script name not found! Compiling failed!");
} else {

/* Writes script to temporary file with proper name */
File tempScriptFile = new File("data\\temp\\"
+ scriptName + ".java");
BufferedWriter scriptOut = new BufferedWriter(
new FileWriter(tempScriptFile));
scriptOut.write(document.getText(0,
document.getLength()));
scriptOut.close();

/* Makes a batch file for tempScriptFile */
File cmdfile = new File("Comile Script.cmd");
BufferedWriter cmdOut = new BufferedWriter(
new FileWriter(cmdfile));
cmdOut.write("@ECHO OFF\njavac -cp \"bin\" data\\temp\\"
+ scriptName + ".java");
cmdOut.close();

try {
Process p = Runtime.getRuntime().exec(
"Comile Script.cmd");
p.waitFor();
cmdfile.delete();
tempScriptFile.delete();

BufferedInputStream bis = new BufferedInputStream(
p.getInputStream());
BufferedReader stdError = new BufferedReader(
new InputStreamReader(p.getErrorStream()));

while (bis.available() > 0) {
TRiBot.mainGUI.println("" + (char) bis.read());
}

String s = null;
Boolean errors = false;

if (((s = stdError.readLine()) != null)) {
TRiBot.mainGUI.println(
"\nCompilation Errors:\n", false);
}

while ((s = stdError.readLine()) != null) {
TRiBot.mainGUI.println(s, false);
errors = true;
}

if (errors == false) {
File outputFile = new File("data\\temp\\"
+ scriptName + ".class");
outputFile.delete();
TRiBot.mainGUI.println(scriptName
+ " compiled successfully! No errors!");
if (JOptionPane
.showConfirmDialog(contentPane,
"Would you like to save this script to the scripts folder?") == 0) {
/* Saves the script source */
File newScriptFile = new File(
"src\\scripts\\" + scriptName
+ ".java");

Boolean b = true;
if (newScriptFile.exists())
if (!(JOptionPane.showConfirmDialog(
contentPane,
"Overwrite script: "
+ scriptName + "?") == 0))
b = false;
if (b == true) {
BufferedWriter newScriptOut = new BufferedWriter(
new FileWriter(newScriptFile));
newScriptOut.write(document.getText(0,
document.getLength()));
newScriptOut.close();

/* Makes a batch file for script */
cmdfile = new File("Comile Script.cmd");
cmdOut = new BufferedWriter(
new FileWriter(cmdfile));
cmdOut.write("@ECHO OFF\njavac -cp \"bin\" -d \"bin\" src\\scripts\\"
+ scriptName + ".java");
cmdOut.close();

p = Runtime.getRuntime().exec(
"Comile Script.cmd");
p.waitFor();
cmdfile.delete();

TRiBot.mainGUI
.println("Script source and code saved!");
}
b = false;
}
}

} catch (Exception ee) {
ee.printStackTrace();
}

}

} catch (Exception ee) {
ee.printStackTrace();
}
}
}

class runClick implements ActionListener {
public void actionPerformed(ActionEvent e) {
compileAndRun();
}
}

newScript.addActionListener(new newClick());
openScript.addActionListener(new openClick());
saveScript.addActionListener(new saveClick());
cut.addActionListener(new Cut());
copy.addActionListener(new Copy());
paste.addActionListener(new Paste());
selectAll.addActionListener(new SelectAll());
compileScript.addActionListener(new compileClick());
runScript.addActionListener(new runClick());

this.setJMenuBar(menuBar);

final JTextArea lines = new JTextArea("");
lines.setSelectionEnd(document.getLength());
lines.setFont(new Font("Monospaced", Font.PLAIN, 12));
lines.setForeground(Color.DARK_GRAY);
lines.setBackground(new Color(210, 210, 210));
lines.setEditable(false);
lines.setMargin(new Insets(5, 2, 5, 2));

document.addDocumentListener(new DocumentListener() {
public String getText() {
int caretPosition = document.getEndPosition().getOffset();
Element root = document.getDefaultRootElement();
String text = "1" + System.getProperty("line.separator");
for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) {
text += i + System.getProperty("line.separator");
}
return text;
}

@Override
public void changedUpdate(DocumentEvent de) {
lines.setText(getText());
}

@Override
public void insertUpdate(DocumentEvent de) {
lines.setText(getText());
}

@Override
public void removeUpdate(DocumentEvent de) {
lines.setText(getText());
}

});

scrollPane.setRowHeaderView(lines);

colorer = new Colorer();
colorer.start();

initStyles(12);

documentReader = new DocumentReader(document);

initDocument();

this.pack();
this.updateUI();
this.setVisible(true);
}

private void compileAndRun() {
try {
/* Writes script to temporary file */
File tempFile = new File("data\\temp\\temp.java");
BufferedWriter tempOut = new BufferedWriter(
new FileWriter(tempFile));
tempOut.write(document.getText(0, document.getLength()));
tempOut.close();

String scriptName = "";
try {
BufferedReader in = new BufferedReader(new FileReader(tempFile));
String line = null;
while ((line = in.readLine()) != null) {
if (line.contains("public class")) {
String data[] = line.split(" ");
scriptName = data[2];
}
}
in.close();
} catch (Exception ee) {
}
tempFile.delete();
if (scriptName == "") {
TRiBot.mainGUI
.println("Script Editor: Script name not found! Compiling failed!");
} else {

/* Writes script to temporary file with proper name */
File tempScriptFile = new File("data\\temp\\" + scriptName
+ ".java");
BufferedWriter scriptOut = new BufferedWriter(new FileWriter(
tempScriptFile));
scriptOut.write(document.getText(0, document.getLength())
.replace("package scripts;", ""));
scriptOut.close();

/* Makes a batch file for tempScriptFile */
File cmdfile = new File("Comile Script.cmd");
BufferedWriter cmdOut = new BufferedWriter(new FileWriter(
cmdfile));
cmdOut.write("@ECHO OFF\njavac -cp \"bin\" data\\temp\\"
+ scriptName + ".java");
cmdOut.close();

try {
Process p = Runtime.getRuntime().exec("Comile Script.cmd");
p.waitFor();
cmdfile.delete();
tempScriptFile.delete();

BufferedInputStream bis = new BufferedInputStream(
p.getInputStream());
BufferedReader stdError = new BufferedReader(
new InputStreamReader(p.getErrorStream()));

while (bis.available() > 0) {
TRiBot.mainGUI.println("" + (char) bis.read());
}

String s = null;
Boolean errors = false;

if (((s = stdError.readLine()) != null)) {
TRiBot.mainGUI
.println("\nCompilation Errors:\n", false);
}

while ((s = stdError.readLine()) != null) {
TRiBot.mainGUI.println(s, false);
errors = true;
}

if (errors == false) {
File outputFile = new File("data\\temp\\" + scriptName
+ ".class");

TRiBot.mainGUI
.println(scriptName
+ " compiled successfully! No errors! Running script...");

File directory = new File("data\\temp");
ClassLoader cL;
try {
cL = new URLClassLoader(new URL[] { directory
.toURI().toURL() });
} catch (MalformedURLException e) {
TRiBot.mainGUI
.println("Error loading the compiled script!");
return;
}
Class<?> script = null;
try {
script = cL.loadClass(scriptName);
} catch (Exception e) {
TRiBot.mainGUI
.println("Error loading the compiled script!");
}

Client bot = TRiBot.mainGUI.getVisibleClient();
if (bot == null) {
TRiBot.mainGUI
.println("Please start a client before trying to run a script.");
} else if (TRiBot.mainGUI.getVisibleClient().scriptHandler.isRunning) {
TRiBot.mainGUI
.println("Another script is already running. Please close that script before you try to run another script.");
} else {
TRiBot.mainGUI.getVisibleClient().scriptHandler
.startScript(script, scriptName, null);
}

outputFile.delete();
}

} catch (Exception ee) {
ee.printStackTrace();
}

}

} catch (Exception ee) {
ee.printStackTrace();
}
}

class JavaFilter extends javax.swing.filechooser.FileFilter {
public boolean accept(File file) {
String filename = file.getName();
return filename.endsWith(".java");
}

public String getDescription() {
return "*.java";
}
}

public class Colorer extends Thread {

@SuppressWarnings("unchecked")
private TreeSet<DocPosition> iniPositions = new TreeSet<DocPosition>(
new DocPositionComparator());

private HashSet<DocPosition> newPositions = new HashSet<DocPosition>();

public class RecolorEvent {
public int position;
public int adjustment;

public RecolorEvent(int position, int adjustment) {
this.position = position;
this.adjustment = adjustment;
}
}

@SuppressWarnings({ "rawtypes" })
private volatile Vector v = new Vector<RecolorEvent>();

private volatile int change = 0;

private volatile int lastPosition = -1;

private volatile boolean asleep = false;

private Object lock = new Object();

@SuppressWarnings("unchecked")
public void color(int position, int adjustment) {
if (position < lastPosition) {
if (lastPosition < position - adjustment) {
change -= lastPosition - position;
} else {
change += adjustment;
}
}
synchronized (lock) {
v.add(new RecolorEvent(position, adjustment));
if (asleep) {
this.interrupt();
}
}
}

public void run() {
int position = -1;
int adjustment = 0;
boolean tryAgain = false;
for (;;) {
synchronized (lock) {
if (v.size() > 0) {
RecolorEvent re = (RecolorEvent) (v.elementAt(0));
v.removeElementAt(0);
position = re.position;
adjustment = re.adjustment;
} else {
tryAgain = false;
position = -1;
adjustment = 0;
}
}
if (position != -1) {
@SuppressWarnings("rawtypes")
SortedSet workingSet;
@SuppressWarnings("rawtypes")
Iterator workingIt;
DocPosition startRequest = new DocPosition(position);
DocPosition endRequest = new DocPosition(position
+ ((adjustment >= 0) ? adjustment : -adjustment));
DocPosition dp;
DocPosition dpStart = null;
DocPosition dpEnd = null;

try {
workingSet = iniPositions.headSet(startRequest);
dpStart = ((DocPosition) workingSet.last());
} catch (NoSuchElementException x) {
dpStart = new DocPosition(0);
}

if (adjustment < 0) {
workingSet = iniPositions.subSet(startRequest,
endRequest);
workingIt = workingSet.iterator();
while (workingIt.hasNext()) {
workingIt.next();
workingIt.remove();
}
}

workingSet = iniPositions.tailSet(startRequest);
workingIt = workingSet.iterator();
while (workingIt.hasNext()) {
((DocPosition) workingIt.next())
.adjustPosition(adjustment);
}

workingSet = iniPositions.tailSet(dpStart);
workingIt = workingSet.iterator();
dp = null;
if (workingIt.hasNext()) {
dp = (DocPosition) workingIt.next();
}
try {
Token t;
boolean done = false;
dpEnd = dpStart;
synchronized (doclock) {
syntaxLexer.reset(documentReader, 0,
dpStart.getPosition(), 0);
documentReader.seek(dpStart.getPosition());
t = syntaxLexer.getNextToken();
}
newPositions.add(dpStart);
while (!done && t != null) {
synchronized (doclock) {
if (t.getCharEnd() <= document.getLength()) {
document.setCharacterAttributes(
t.getCharBegin() + change,
t.getCharEnd() - t.getCharBegin(),
getStyle(t.getDescription()), true);
dpEnd = new DocPosition(t.getCharEnd());
}
lastPosition = (t.getCharEnd() + change);
}
if (t.getState() == Token.INITIAL_STATE) {
while (dp != null
&& dp.getPosition() <= t.getCharEnd()) {
if (dp.getPosition() == t.getCharEnd()
&& dp.getPosition() >= endRequest
.getPosition()) {
done = true;
dp = null;
} else if (workingIt.hasNext()) {
dp = (DocPosition) workingIt.next();
} else {
dp = null;
}
}
newPositions.add(dpEnd);
}
synchronized (doclock) {
t = syntaxLexer.getNextToken();
}
}

workingIt = iniPositions.subSet(dpStart, dpEnd)
.iterator();
while (workingIt.hasNext()) {
workingIt.next();
workingIt.remove();
}

workingIt = iniPositions.tailSet(
new DocPosition(document.getLength()))
.iterator();
while (workingIt.hasNext()) {
workingIt.next();
workingIt.remove();
}

iniPositions.addAll(newPositions);
newPositions.clear();
} catch (IOException x) {
}
synchronized (doclock) {
lastPosition = -1;
change = 0;
}
tryAgain = true;
}
asleep = true;
if (!tryAgain) {
try {
sleep(0xffffff);
} catch (InterruptedException x) {
}

}
asleep = false;
}
}
}

public void colorAll() {
color(0, document.getLength());
}

public void color(int position, int adjustment) {
colorer.color(position, adjustment);
}

private void initDocument() {

syntaxLexer = new JavaLexer(documentReader);

try {
document.insertString(document.getLength(), defaultLayout,
getStyle("text"));
} catch (BadLocationException ble) {
System.err.println("Couldn't insert initial text.");
}
}

@SuppressWarnings({ "rawtypes" })
private Hashtable styles = new Hashtable();

private SimpleAttributeSet getStyle(String styleName) {
return ((SimpleAttributeSet) styles.get(styleName));
}

@SuppressWarnings("unchecked")
private void initStyles(int fontSize) {
SimpleAttributeSet style;

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("body", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.blue);
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("tag", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.blue);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("endtag", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("reference", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(0xB03060));
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("name", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(0xB03060));
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, true);
styles.put("value", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("text", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(220, 0, 94).brighter());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("reservedWord", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("identifier", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(34, 122, 225).brighter());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("literal", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY.darker());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("separator", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.LIGHT_GRAY.darker());
StyleConstants.setBold(style, true);
StyleConstants.setItalic(style, false);
styles.put("operator", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.green.darker());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("comment", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, new Color(0xA020F0).darker());
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("preprocessor", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.black);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("whitespace", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.red);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("error", style);

style = new SimpleAttributeSet();
StyleConstants.setFontFamily(style, "Monospaced");
StyleConstants.setFontSize(style, fontSize);
StyleConstants.setForeground(style, Color.orange);
StyleConstants.setBold(style, false);
StyleConstants.setItalic(style, false);
styles.put("unknown", style);
}

@SuppressWarnings("serial")
private class HighLightedDocument extends DefaultStyledDocument {

public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
synchronized (doclock) {
super.insertString(offs, str, a);
color(offs, str.length());
documentReader.update(offs, str.length());
}
}

public void remove(int offs, int len) throws BadLocationException {
synchronized (doclock) {
super.remove(offs, len);
color(offs, -len);
documentReader.update(offs, -len);
}
}
}
}

class DocPosition {

private int position;

int getPosition() {
return position;
}

public DocPosition(int position) {
this.position = position;
}

public DocPosition adjustPosition(int adjustment) {
position += adjustment;
return this;
}

public boolean equals(Object obj) {
if (obj instanceof DocPosition) {
DocPosition d = (DocPosition) (obj);
if (this.position == d.position) {
return true;
} else {
return false;
}
} else {
return false;
}
}

public String toString() {
return "" + position;
}
}

@SuppressWarnings({ "rawtypes" })
class DocPositionComparator implements Comparator {

public boolean equals(Object obj) {
if (obj instanceof DocPositionComparator) {
return true;
} else {
return false;
}
}

public int compare(Object o1, Object o2) {
if (o1 instanceof DocPosition && o2 instanceof DocPosition) {
DocPosition d1 = (DocPosition) (o1);
DocPosition d2 = (DocPosition) (o2);
return (d1.getPosition() - d2.getPosition());
} else if (o1 instanceof DocPosition) {
return -1;
} else if (o2 instanceof DocPosition) {
return 1;
} else if (o1.hashCode() < o2.hashCode()) {
return -1;
} else if (o2.hashCode() > o1.hashCode()) {
return 1;
} else {
return 0;
}
}
}

class DocumentReader extends Reader {

public void update(int position, int adjustment) {
if (position < this.position) {
if (this.position < position - adjustment) {
this.position = position;
} else {
this.position += adjustment;
}
}
}

private long position = 0;

private long mark = -1;

private AbstractDocument document;

public DocumentReader(AbstractDocument document) {
this.document = document;
}

public void close() {
}

public void mark(int readAheadLimit) {
mark = position;
}

public boolean markSupported() {
return true;
}

public int read() {
if (position < document.getLength()) {
try {
char c = document.getText((int) position, 1).charAt(0);
position++;
return c;
} catch (BadLocationException x) {
return -1;
}
} else {
return -1;
}
}

public int read(char[] cbuf) {
return read(cbuf, 0, cbuf.length);
}

public int read(char[] cbuf, int off, int len) {
if (position < document.getLength()) {
int length = len;
if (position + length >= document.getLength()) {
length = document.getLength() - (int) position;
}
if (off + length >= cbuf.length) {
length = cbuf.length - off;
}
try {
String s = document.getText((int) position, length);
position += length;
for (int i = 0; i < length; i++) {
cbuf[off + i] = s.charAt(i);
}
return length;
} catch (BadLocationException x) {
return -1;
}
} else {
return -1;
}
}

public boolean ready() {
return true;
}

public void reset() {
if (mark == -1) {
position = 0;
} else {
position = mark;
}
mark = -1;
}

public long skip(long n) {
if (position + n <= document.getLength()) {
position += n;
return n;
} else {
long oldPos = position;
position = document.getLength();
return (document.getLength() - oldPos);
}
}

public void seek(long n) {
if (n <= document.getLength()) {
position = n;
} else {
position = document.getLength();
}
}
}

So, you are saying you pieced together your script editor, exactly the same way as I did for TRiBot's script editor? I'm not saying you couldn't use the Syntax Highlighter, I'm saying you cannot just steal my script editor code. There's a difference. My script editor is not 100% of the syntax highlightor, so you can't just steal my script editor.

What about the line numbering system? It wasn't included in the syntax highlightor. I made it MYSELF. Are you saying that you made it almost exactly how I did, having no idea it was almost exactly like how I did it?


final JTextArea lines = new JTextArea("");
lines.setSelectionEnd(document.getLength());
lines.setFont(new Font("Monospaced", Font.PLAIN, 12));
lines.setForeground(Color.DARK_GRAY);
lines.setBackground(new Color(210, 210, 210));
lines.setEditable(false);
lines.setMargin(new Insets(5, 2, 5, 2));

document.addDocumentListener(new DocumentListener() {
public String getText() {
int caretPosition = document.getEndPosition().getOffset();
Element root = document.getDefaultRootElement();
String text = "1" + System.getProperty("line.separator");
for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) {
text += i + System.getProperty("line.separator");
}
return text;
}

@Override
public void changedUpdate(DocumentEvent de) {
lines.setText(getText());
}

@Override
public void insertUpdate(DocumentEvent de) {
lines.setText(getText());
}

@Override
public void removeUpdate(DocumentEvent de) {
lines.setText(getText());
}

});

scrollPane.setRowHeaderView(lines);


JTextArea localJTextArea = new JTextArea("");
localJTextArea.setSelectionEnd(this.document.getLength());
localJTextArea.setFont(new Font("Monospaced", 0, 12));
localJTextArea.setBackground(new Color(210, 210, 210));
localJTextArea.setEditable(false);
localJTextArea.setMargin(new Insets(5, 2, 5, 2));

this.document.addDocumentListener(new DocumentListener(localJTextArea)
{
public String getText() {
int i = ScriptEditor.this.document.getEndPosition().getOffset();
Element localElement = ScriptEditor.this.document.getDefaultRootElement();
String str = "1" + System.getProperty("line.separator");
for (int j = 2; j < localElement.getElementIndex(i) + 2; ++j) {
str = str + j + System.getProperty("line.separator");
}
return str;
}

public void changedUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

public void insertUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

public void removeUpdate(DocumentEvent paramDocumentEvent) {
this.val$lines.setText(getText());
}

});
localJScrollPane.setRowHeaderView(localJTextArea);

There's only a few differences between the two, and they are declared at the exact same place.

What about this:

private static final long serialVersionUID = 8326421682467537173L;

public static File file = new File("");
protected JTextPane textPane;
protected HighLightedDocument document;
protected DocumentReader documentReader;
protected Lexer syntaxLexer;
protected Colorer colorer;
private Object doclock = new Object();

public String defaultLayout = "package scripts;"
+ "\n"
+ "\nimport java.awt.Graphics;"
+ "\n"
+ "\nimport org.tribot.loader.Client;"
+ "\nimport org.tribot.script.Script;"
+ "\nimport org.tribot.wrappers.RSInterface;"
+ "\nimport org.tribot.script.ScriptManifest;"
+ "\n"
+ "\n@ScriptManifest(authors = { \"TRiLeZ\" }, name = \"Script Skeleton\", category = \"Skeleton\")"
+ "\npublic class ScriptSkeleton extends Script {" + "\n"
+ "\n public ScriptSkeleton(Client bot) {" + "\n super(bot);"
+ "\n }" + "\n" + "\n public void onPause() {" + "\n" + "\n }"
+ "\n" + "\n public void onResume() {" + "\n" + "\n }" + "\n"
+ "\n public void onBreakStart() {" + "\n" + "\n }" + "\n"
+ "\n public void onBreakEnd() {" + "\n" + "\n }" + "\n"
+ "\n public void onEnd() {" + "\n" + "\n }" + "\n"
+ "\n public void onPaint(Graphics g) {" + "\n" + "\n }" + "\n"
+ "\n public void run() {" + "\n" + "\n }" + "\n" + "\n}";

and this:

private static final long serialVersionUID = 8326421682467537173L;
public static File file = new File("");
private JPopupMenu.Separator jSeparator1;
protected JTextPane textPane;
protected HighLightedDocument document;
protected DocumentReader documentReader;
protected Lexer syntaxLexer;
protected Colorer colorer;
private Object doclock = new Object();
public static String defaultLayout = "import java.awt.Graphics; \nimport java.util.Map; \n\nimport org.rsbot.event.listeners.PaintListener; \nimport org.rsbot.script.Script; \nimport org.rsbot.script.ScriptManifest; \n\n@ScriptManifest(authors = { \"Your Name Here\" }, name = \"Script Name Here\",\n category = \"\", version = 1.00, description = \"\") \n public class YourScriptNameHere extends Script implements PaintListener { \n\n public int loop() {\n return (5);\n }\n\n public void onRepaint(final Graphics render) {\n }\n\n public boolean onStart(final Map<String, String> args) {\n return true;\n }\n\n public void onFinish() {\n }\n}";

private Hashtable styles = new Hashtable();

You and I like to declare the variables in the same order? Our serial version UID is even the same.

Also, how come when you noticed someone noticed that the two serial version uid's were the same, that the serial version UID of Runedev was removed from it's script editor? It's like a criminal running away from the cops when they know they're onto him. It just makes it more clear that you stole TRiBot's script editor code.

From: sorcermus
I believe it is more the fact that the Runedev.info site has now 15,000 members and the Tribot.org site has a little over 125 members, and the developer of the tribot’s client feels that this prized “script editor” will not benefit his cause to improve his status in the macro development communities, or the membership on his site, and that is why this issue has been brought here to these forums to simply boaster an unjust cause of belittling the Runedev development and inflate the tribot site membership.


I tried posting about my findings on the Rundev forums, but all of the posts were immediatly deleted…

You do realize that I haven't even made one thread about TRiBot, don't you? I've only mentioned TRiBot in a few of my posts. The only thread that revolves around TRiBot is this one. However, Runedev is more in the spotlight than TRiBot is.

So, now I didn't make this thread to inflate TRiBot's member count. TRiBot is currently in it's alpha stage, and finding more members for TRiBot's community is at the bottom of my agenda.

sorcermus

2010-10-19 20:06:44

Not all the Runedev script editor was written by the lead developer of the Runedev client that is on site now. There were other developers on the project and another lead developer when the Runedev project started in March there was like 5 of them so if some parts got in there from someone and they were looking over yours when they did it then sorry for that happening. I was not aware of this and I stand by my claim that I did not know you or your work before putting the script editor in there. The same as I do not use these forums. I do not troll sites looking for things to do or ideas to steal.

Runedev had to clean house of developers that were just simply bad coders in June and many things were also left over from them. Rsbot going down and Runedev popping up to try and hold down the fort was a huge mess, but after we cleaned up and got back to work on things we just finished off some things that were already started. The script editor has been in our client since July. I didn’t write the base source used in making the file about 50 percent of it was with the development stuff when I took over.

I just know that in the work I did I used the source that I showed. Sorry dude but I didn’t rip off your stuff. I wish I could give you the name to blame but like Rsbot’s development that contained source from everything known to java our client too contains source from anyone on the site willing to help out. I don’t check every other macro development to see if the code came from there before I except a patch to our svn. There are now too many popping up and too many that have died out to keep track of that.

I will gladly add credit where credit is do if that is what it takes to just get you off the subject of Runedev being ripped off of other clients because that simply is not true, and is not a supported manner of development on our site.

Just be careful when we kicked some of those developers off our project they had their eye on looking for another development to try and get in on and mess them up with their crap java skills.

Putnam

2010-10-19 20:41:51

This is classic. It's almost like Runedev is trolling you! It's painfully obvious that Runedev's code is a slightly modified version of TRiBot's code. Runedev needs to get their shit together, pull the code, and make something of their own. A team of 5 should be able to make something better than (and not copy!) a one man team. If I were you, TRiLeZ, I would contact [email]icexaos@runedev.info[/email] (Runedev's owner)

pyroryan

2010-10-19 20:42:33

From: sorcermus
Not all the Runedev script editor was written by the lead developer of the Runedev client that is on site now. There were other developers on the project and another lead developer when the Runedev project started in March there was like 5 of them so if some parts got in there from someone and they were looking over yours when they did it then sorry for that happening. I was not aware of this and I stand by my claim that I did not know you or your work before putting the script editor in there. The same as I do not use these forums. I do not troll sites looking for things to do or ideas to steal.

Runedev had to clean house of developers that were just simply bad coders in June and many things were also left over from them. Rsbot going down and Runedev popping up to try and hold down the fort was a huge mess, but after we cleaned up and got back to work on things we just finished off some things that were already started. The script editor has been in our client since July. I didn’t write the base source used in making the file about 50 percent of it was with the development stuff when I took over.

I just know that in the work I did I used the source that I showed. Sorry dude but I didn’t rip off your stuff. I wish I could give you the name to blame but like Rsbot’s development that contained source from everything known to java our client too contains source from anyone on the site willing to help out. I don’t check every other macro development to see if the code came from there before I except a patch to our svn. There are now too many popping up and too many that have died out to keep track of that.

From: ScriptEditor.java

@author Sorcermus 08-30-2010


Clearly, it says that you made it towards the end of August. No need to blame it on the other people when they weren't around to contribute to this.

sorcermus

2010-10-19 20:47:50

From: pyroryan
Clearly, it says that you made it towards the end of August. No need to blame it on the other people when they weren't around to contribute to this.


that is that last modified date the Runedev web site on the script editor and how to use it was postes jun 13 2010.

pyroryan

2010-10-19 20:57:00

Well I'm pretty sure tribot wasn't around back in June…Either way, I think its pretty clear that Tribot's scripteditor was used in production of runedev's scripteditor and hence should be credited.

sorcermus

2010-10-19 21:04:20

From: putnam11
This is classic. It's almost like Runedev is trolling you! It's painfully obvious that Runedev's code is a slightly modified version of TRiBot's code. Runedev needs to get their shit together, pull the code, and make something of their own. A team of 5 should be able to make something better than (and not copy!) a one man team. If I were you, TRiLeZ, I would contact [email]icexaos@runedev.info[/email] (Runedev's owner)


I am the only developer of the Runedev client at this time and I am not removing code that 30 percent comes from a demo 30 percent comes from others and 40 percent comes from me. Anyone else could write from the demos of the highlight package and tribot would have nothing to be able to say the package and the denmo were free.

IceXaos is not the owner of the client just the site.

For the record Runedev has its shit together now and asking us to take something out that was worked on a group development simply becuase some one wants to right protect it now after the fact is insane. Thats like a developer of google asking that google change everything they have just becuase someone wants to right protect some part of it now. Near as I can tell who ever did whatever didn't do it at a time that anyone was trying to right protect it, and even if they tried they couldn't for the free open source that is in it. So it is a mute point.

Then again you and the other guy trolling this topic are more than likely 2 of the guys that got kicked to the road side because thats all thsoe guys did, and you guys seem hell bent on trying to make the Runedev development tean that we have now look bad. You just can't I haven't done anything and Im not ripping things out.

pyroryan

2010-10-19 21:08:17

I'm legitimately pointing that yours and tribot's scripteditor's look very similar and that the serialversionUID cannot possibly be the same without some form of collaboration. So without a doubt, runedev did take code from tribot. I don't even know what you're trying to prove anymore. If its that someone else added it to runedev, fine, but give trilez the credits that he deserves.
If I'm trying to make you look bad, its because I'm just pointing out that the scripteditor is copied.

sorcermus

2010-10-19 21:09:12

From: pyroryan
Well I'm pretty sure tribot wasn't around back in June…Either way, I think its pretty clear that Tribot's scripteditor was used in production of runedev's scripteditor and hence should be credited.


I have indeed already offered credit.

pyroryan

2010-10-19 21:15:56

From: sorcermus
I have indeed already offered credit.


I have no issues against modifying open-source code as long as the new code is properly credited.
I don't think anyone is trying to bring down your development team, but having an uncredited and seemingly copied piece of work looks very bad on this site and makes me suspicious of the entire group.

sorcermus

2010-10-19 21:23:58

From: pyroryan
I have no issues against modifying open-source code as long as the new code is properly credited.
I don't think anyone is trying to bring down your development team, but having an uncredited and seemingly copied piece of work looks very bad on this site and makes me suspicious of the entire group.


credit was never asked of Runedev. Just removal of what we have.

Putnam

2010-10-19 21:24:45

If you seriously want this project to go anywhere, you may as well write the code, and review what others give you. It doesn't look like you wrote 40% of the code, maybe modified 10%.
If anyone of your members in your userbase found out you use other's code, what would they think of you?

EDIT: Also, implying that we were some of your former members of your development team shows how much you care about this. Shouldn't you know who has worked for you? Seems pretty professional to me.

sorcermus

2010-10-19 21:29:13

From: putnam11
Also, if you seriously want this project to go anywhere, you may as well write the code and review what others give you. It doesn't look like you wrote 40% of the code, maybe modified 10%.
If anyone of your members in your userbase found out you use other's code, what would they think of you?


on this note I'm out of here. I have nothing more to say here.

moparisthebest

2010-10-19 21:38:45

As long as all of this code is GNU/GPL then I don't see any problem with what anyone did, besides the fact that it is nice to give credit where credit is due. Otherwise, code-reuse (as opposed to re-inventing the wheel) is what Open Source code is all about!

TRiLeZ

2010-10-19 21:49:42

From: pyroryan
Well I'm pretty sure tribot wasn't around back in June…Either way, I think its pretty clear that Tribot's scripteditor was used in production of runedev's scripteditor and hence should be credited.


TRiBot went public Feb 7, 2010 and the script editor was made on Feb 16, 2010.

From: sorcermus
I am the only developer of the Runedev client at this time and I am not removing code that 30 percent comes from a demo 30 percent comes from others and 40 percent comes from me. Anyone else could write from the demos of the highlight package and tribot would have nothing to be able to say the package and the denmo were free.

IceXaos is not the owner of the client just the site.

For the record Runedev has its shit together now and asking us to take something out that was worked on a group development simply becuase some one wants to right protect it now after the fact is insane. Thats like a developer of google asking that google change everything they have just becuase someone wants to right protect some part of it now. Near as I can tell who ever did whatever didn't do it at a time that anyone was trying to right protect it, and even if they tried they couldn't for the free open source that is in it. So it is a mute point.

Then again you and the other guy trolling this topic are more than likely 2 of the guys that got kicked to the road side because thats all thsoe guys did, and you guys seem hell bent on trying to make the Runedev development tean that we have now look bad. You just can't I haven't done anything and Im not ripping things out.


So, it's 70% from the Runedev team? So is the syntax highlighter just an addition to a massive piece of Runedev coding? The script editor revolves around the syntax highlighter.

With your google scenario… if I were appart of the Runedev dev team, it would be like that scenario, but I'm not. My script editor was not made for Runedev. It was made JUST for TRiBot.

Here's a better scenario: It's like you stole a piece of merchandise and got caught, and you're not returning the merchandise. It's theft.

From: sorcermus
I have indeed already offered credit.


From: sorcermus
credit was never asked of Runedev. Just removal of what we have.


Did I not say, somewhere in my posts in this thread or the one at my forums that I would have been fine is I was credited?

If you can give me credit, in the script editor coding/about box and somewhere on the Runedev website or forums, then I'll agree to put this issue to rest.

Camaro'

2010-10-21 20:46:12

From: moparisthebest
As long as all of this code is GNU/GPL then I don't see any problem with what anyone did, besides the fact that it is nice to give credit where credit is due. Otherwise, code-reuse (as opposed to re-inventing the wheel) is what Open Source code is all about!


Apparently what I gather, is that he is claiming the code his own, which I don't think is allowed :)

Edit: Me r dumb