Has I wrote in an old post I was triying to do an options menu like this
Well, the code is finished, and it works perfectly in projectman, but it does not work in the compiled version!!! In projectman, when the window opens, the buttons put himself in a position that represents the actual volume value that the registry sais, and when you keep pressed the left mouse button over the button of a vBar, you can drag it up and down, changing the volume while you listen a sound/music to test it, and the cursor ever stay inside the button until you release the left mouse button. But in the compiled version, when you click on the button, the only thing it do correctly is playing the music/sound! it does not move nor keep the cursors inside itself. And it doesn't catch the registry value for the volume. What's the problem? Here's the code for the button of the SFX Volume vBar (the code for the other buttons is almost equal):
[code]#include "scripts\base.inc"
var meters; //just to hold some values
var MoveButton; //if true, the button updates its position with the mouse position
self.Text = Game.GetGlobalSFXVolume(); //get the actual sfx volume value for the text of the
//button
meters.ActVol = Game.GetGlobalSFXVolume(); //same for the variable
if (meters.ActVol >= 100) self.Text = "Max"; //stupid thingie
else if (meters.ActVol <= 0) self.Text = "Off";
self.Y = self.Y - meters.ActVol; //place the button at the position desired for the actual
//volume value.
on "LeftClick"
{
var parent = self.Parent; //reference to the window that holds the button
MoveButton = true; //the button must update it's position
Game.MouseY = parent.Y + self.Y + (self.Height / 2); //place the cursor in the (vertical)
//middle of the button
meters.MouseY = Game.MouseY; //update the mouse position info in the variable
Game.PlaySound("interface\system\sfx.ogg",true); //play the test sound (it's good to hear
//something while you are increasing or
//decreasing the volume).
while (MoveButton) //loop that updates the mouse position and the volume value
{