Thread: MAKI Cheats
View Single Post
Old 17th September 2002, 18:03   #38
spleen
Senior Member
 
spleen's Avatar
 
Join Date: Feb 2002
Location: Split, Croatia
Posts: 180
Send a message via ICQ to spleen
Re: Balance

Quote:
Originally posted by proton078
Hi there,
first of all, thank you very much for the maki scripts. I find them very useful because I’m a total looser in scripting. That’s exactly why I’m asking this question. I’m planning to implement a balance function into my skin that should work like the animated volume and the autorepeatvolume buttons. I wonder if you could tell me how to modify the scripts so that they don’t change the volume but the balance.
Thank you...and keep but the great work
Map is declared like element:
code:
<bitmap
id="player.balance.map"
file="eq/balance-map.png"
/>




In XML set Balance animated layer like this:
code:
<AnimatedLayer
id="anlBalance"
x="20" y="20"
w="32" h="32"
image="player.balance.knob"
move="0"
/>




In XML set Balance slider like this:
code:
<slider
id="sliBalance"
action="PAN"
x="20" y="20"
w="100" h="10"
thumb="slider.thumb.norm"
downThumb="slider.thumb.down"
/>




Compile this (it should work, haven't tested this):
code:
#include "../../../lib/std.mi"

Function updateBalance(int v);

Global AnimatedLayer anlBalance;
Global Map mapBalance;
Global Slider sliBalance;
Global int BalChanging=0;

System.onScriptLoaded() {
// get anlBalance, mapBalance and sliBalance from XML...

mapBalance = new Map;
mapBalance.loadMap("player.balance.map");
sliBalance.hide(); // hide slider

updateBalance(sliBalance.getPosition()+1);
}

System.onScriptUnloading() {
delete mapBalance;
}

anlBalance.onLeftButtonDown(int x, int y) {
BalChanging=1;
x = x - anlBalance.getLeft();
y = y - anlBalance.getTop();
int v = mapBalance.getValue(x,y);
updateBalance(v);
}

anlBalance.onMouseMove(int x, int y) {
if (BalChanging) {
x = x - anlBalance.getLeft();
y = y - anlBalance.getTop();
if (mapBalance.inRegion(x,y)) {
int v = mapBalance.getValue(x,y);
updateBalance(v);
}
}
}

anlBalance.onLeftButtonUp(int x, int y) {
if (BalChanging) {
x = x - anlBalance.getLeft();
y = y - anlBalance.getTop();
if (mapBalance.inRegion(x,y)) {
int v = mapBalance.getValue(x,y);
updateBalance(v);
}
BalChanging=0;
}
}

updateBalance(int v) {
int k = v/255 * 16;
anlBalance.gotoFrame(k);
sliBalance.setPosition(v);
}

spleen is offline   Reply With Quote