Created by me, if you'd like to say otherwise; I don't care.
This is for 317-377 clients that don't already have scrolling for interfaces.
Code:
public class RSApplet extends Applet implements Runnable, MouseListener,
MouseMotionListener, KeyListener, FocusListener, WindowListener,
MouseWheelListener **
Code:
public void run() **
getGameComponent().addMouseListener(this);
getGameComponent().addMouseWheelListener(this);
getGameComponent().addMouseMotionListener(this);
getGameComponent().addKeyListener(this);
getGameComponent().addFocusListener(this);
if (gameFrame != null)
gameFrame.addWindowListener(this);
drawLoadingText(0, "Loading...");
Code:
public void mouseWheelMoved(MouseWheelEvent e) {
int Rot = e.getWheelRotation();
interfaceScrollCheck(e);
if (mouseX > 0 && mouseX < 512 && mouseY > 503 - 165
&& mouseY < 503 - 25) {
int ChatPosition = Game.anInt1089;
ChatPosition -= Rot * 28;
if (ChatPosition < 0) {
ChatPosition = 0;
}
if (ChatPosition > Game.anInt1211 - 77) {
ChatPosition = Game.anInt1211 - 77;
}
if (Game.anInt1089 != ChatPosition) {
Game.anInt1089 = ChatPosition;
Game.inputTaken = true;
}
}
}
public void interfaceScrollCheck(MouseWheelEvent e) {
try {
int Rotation = e.getWheelRotation();
int TAB = 0, WINDOW = 1;
int POSX = 0, POSY = 1, WIDTH = 2, HEIGHT = 3, OFFX = 4, OFFY = 5, CHILD = 6, SENSITIVITY = 7;
int[] InterfaceID = { Game.tabInterfaceIDs[Game.tabID],
Game.openInterfaceID };
int[] InterfaceSetting = { 0, 0, /* positionX, positionY */
0, 0, /* Width, Height */
0, 0, /* offsetX, offsetY */
0, 15 /* Child ID, Sensitivity */
};
int[] IS = InterfaceSetting;
if (InterfaceID[TAB] != -1) {
RSInterface Tab = RSInterface.interfaceCache[InterfaceID[TAB]];
InterfaceSetting[OFFX] = 547;
InterfaceSetting[OFFY] = 205;
for (int Index = 0; Index < Tab.children.length; Index++) {
if (RSInterface.interfaceCache[Tab.children[Index]].scrollMax > 0) {
InterfaceSetting[CHILD] = Index;
InterfaceSetting[POSX] = Tab.childX[Index];
InterfaceSetting[POSY] = Tab.childY[Index];
InterfaceSetting[WIDTH] = getChildWidth(Tab, Index);
InterfaceSetting[HEIGHT] = getChildHeight(Tab, Index);
break;
}
}
if (mouseX > IS[OFFX] + IS[POSX]
&& mouseY > IS[OFFY] + IS[POSY]
&& mouseX < IS[OFFX] + IS[POSX] + IS[WIDTH]
&& mouseY < IS[OFFY] + IS[POSY] + IS[HEIGHT]) {
switch (InterfaceID[TAB]) {
case 962: /* Music Tab */
IS[SENSITIVITY] = 30;
break;
case 638: /* Quest Tab */
IS[SENSITIVITY] = 30;
break;
case 1151: /* Magic Tab */
IS[SENSITIVITY] = 7;
break;
case 147: /* Emote Tab */
IS[SENSITIVITY] = 15;
break;
default:
IS[SENSITIVITY] = 15;
break;
}
;
switch (Rotation) {
case -1:
if (RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition != 0) {
RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition += Rotation
* IS[SENSITIVITY];
Game.needDrawTabArea = true;
Game.tabAreaAltered = true;
}
break;
case 1:
if (RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition != RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollMax
- RSInterface.interfaceCache[Tab.children[IS[CHILD]]].height) {
RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition += Rotation
* IS[SENSITIVITY];
Game.needDrawTabArea = true;
Game.tabAreaAltered = true;
}
break;
}
}
}
if (InterfaceID[WINDOW] != -1) {
RSInterface Window = RSInterface.interfaceCache[InterfaceID[WINDOW]];
InterfaceSetting[OFFX] = 4;
InterfaceSetting[OFFY] = 4;
for (int Index = 0; Index < Window.children.length; Index++) {
if (RSInterface.interfaceCache[Window.children[Index]].scrollMax > 0) {
InterfaceSetting[CHILD] = Index;
InterfaceSetting[POSX] = Window.childX[Index];
InterfaceSetting[POSY] = Window.childY[Index];
InterfaceSetting[WIDTH] = getChildWidth(Window, Index);
InterfaceSetting[HEIGHT] = getChildHeight(Window, Index);
break;
}
}
if (mouseX > IS[OFFX] + IS[POSX]
&& mouseY > IS[OFFY] + IS[POSY]
&& mouseX < IS[OFFX] + IS[POSX] + IS[WIDTH]
&& mouseY < IS[OFFY] + IS[POSY] + IS[HEIGHT]) {
switch (InterfaceID[WINDOW]) {
default:
IS[SENSITIVITY] = 30;
break;
}
;
switch (Rotation) {
case -1:
if (RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition != 0) {
RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition += Rotation
* IS[SENSITIVITY];
Game.needDrawTabArea = true;
Game.tabAreaAltered = true;
}
break;
case 1:
if (RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition != RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollMax
- RSInterface.interfaceCache[Window.children[IS[CHILD]]].height) {
RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition += Rotation
* IS[SENSITIVITY];
}
break;
}
RSInterface.interfaceCache[Window.children[InterfaceSetting[CHILD]]].scrollPosition += Rotation * 30;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
public int getScrollPosition(RSInterface Interface, int Child) {
return RSInterface.interfaceCache[Interface.children[Child]].scrollPosition;
}
public int getChildWidth(RSInterface Interface, int Index) {
return RSInterface.interfaceCache[Interface.children[Index]].width;
}
public int getChildHeight(RSInterface Interface, int Index) {
return RSInterface.interfaceCache[Interface.children[Index]].height;
}
Edit: I don't know why all the brackets changed into asterisks, but that's just something you're going have to deal with.