screwed over
04-30-2008, 10:23 AM
Hey, I recently wrote some functions for making a skinned progress bar. here they are:
Go in globals:
sProgressID = {}
sProgress = {
Make =
function (sIDNo, X, Y, Height, Width, lPart, lpWide, mPart, rPart, rpWide, pBar, pBarMargin)
sProgressID[sIDNo] = {}
sProgressID[sIDNo].X = X;
sProgressID[sIDNo].Y = Y;
sProgressID[sIDNo].Height = Height;
sProgressID[sIDNo].Width = Width;
sProgressID[sIDNo].Margin = pBarMargin;
sProgressID[sIDNo].Progress = 0;
sProgressID[sIDNo].LeftMarginImage = lPart;
sProgressID[sIDNo].LeftMarginWidth = lpWide;
sProgressID[sIDNo].BackgroundImage = mPart;
sProgressID[sIDNo].RightMarginImage = rPart;
sProgressID[sIDNo].RightMarginWidth = rpWide;
sProgressID[sIDNo].BarImage = pBar;
-- Image object properties table.
local lPartProps = {};
lPartProps.ImageFile = lPart;
lPartProps.Height = Height;
lPartProps.Width = lpWide;
lPartProps.Y = Y;
lPartProps.X = X;
lPartProps.UseTransColor = true;
lPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
lPartProps.Opacity = 100;
lPartProps.Tolerance = 10;
lPartProps.HitTest = HITTEST_STANDARD;
lPartProps.Cursor = CURSOR_ARROW;
lPartProps.TooltipText = "";
lPartProps.Visible = true;
lPartProps.Enabled = true;
lPartProps.ResizeLeft = false;
lPartProps.ResizeRight = false;
lPartProps.ResizeTop = false;
lPartProps.ResizeBottom = false;
lPartProps.ClickSound = SND_NONE;
lPartProps.ClickSoundFile = "";
lPartProps.HighlightSound = SND_NONE;
lPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "slpImage"..sIDNo, lPartProps);
-- Image object properties table.
local rPartProps = {};
rPartProps.ImageFile = rPart;
rPartProps.Height = Height;
rPartProps.Width = rpWide;
rPartProps.Y = Y;
rPartProps.X = X+Width-rpWide;
rPartProps.UseTransColor = true;
rPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
rPartProps.Opacity = 100;
rPartProps.Tolerance = 10;
rPartProps.HitTest = HITTEST_STANDARD;
rPartProps.Cursor = CURSOR_ARROW;
rPartProps.TooltipText = "";
rPartProps.Visible = true;
rPartProps.Enabled = true;
rPartProps.ResizeLeft = false;
rPartProps.ResizeRight = false;
rPartProps.ResizeTop = false;
rPartProps.ResizeBottom = false;
rPartProps.ClickSound = SND_NONE;
rPartProps.ClickSoundFile = "";
rPartProps.HighlightSound = SND_NONE;
rPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "srpImage"..sIDNo, rPartProps);
-- Image object properties table.
local mPartProps = {};
mPartProps.ImageFile = mPart;
mPartProps.Height = Height;
mPartProps.Width = Width-lpWide-rpWide;
mPartProps.Y = Y;
mPartProps.X = X+lpWide;
mPartProps.UseTransColor = true;
mPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
mPartProps.Opacity = 100;
mPartProps.Tolerance = 10;
mPartProps.HitTest = HITTEST_STANDARD;
mPartProps.Cursor = CURSOR_ARROW;
mPartProps.TooltipText = "";
mPartProps.Visible = true;
mPartProps.Enabled = true;
mPartProps.ResizeLeft = false;
mPartProps.ResizeRight = false;
mPartProps.ResizeTop = false;
mPartProps.ResizeBottom = false;
mPartProps.ClickSound = SND_NONE;
mPartProps.ClickSoundFile = "";
mPartProps.HighlightSound = SND_NONE;
mPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "smpImage"..sIDNo, mPartProps);
-- Image object properties table.
local bPartProps = {};
bPartProps.ImageFile = pBar;
bPartProps.Height = Height-(2*pBarMargin);
bPartProps.Width = 1;
bPartProps.Y = Y+pBarMargin;
bPartProps.X = X+pBarMargin;
bPartProps.UseTransColor = true;
bPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
bPartProps.Opacity = 100;
bPartProps.Tolerance = 10;
bPartProps.HitTest = HITTEST_STANDARD;
bPartProps.Cursor = CURSOR_ARROW;
bPartProps.TooltipText = "";
bPartProps.Visible = true;
bPartProps.Enabled = true;
bPartProps.ResizeLeft = false;
bPartProps.ResizeRight = false;
bPartProps.ResizeTop = false;
bPartProps.ResizeBottom = false;
bPartProps.ClickSound = SND_NONE;
bPartProps.ClickSoundFile = "";
bPartProps.HighlightSound = SND_NONE;
bPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "sbImage"..sIDNo, bPartProps);
return sIDNo
end;
SetProgress =
function (sIDNo, sprogress)
local bPartProps = {};
if sprogress ~= nil --[[and sprogress > 0 ]]then
bPartProps.Width = ((sProgressID[sIDNo].Width-(2*sProgressID[sIDNo].Margin))/100)*sprogress;
Image.SetProperties("sbImage"..sIDNo, bPartProps);
sProgressID[sIDNo].Progress = sprogress;
end
end;
GetProgress =
function (sIDNo)
return sProgressID[sIDNo].Progress;
end;
GetProperties =
function (sIDNo)
return sProgressID[sIDNo];
end;
SetProperties =
function (sIDNo, pTable)
if pTable ~= nil then
if pTable.X ~= nil then
sProgressID[sIDNo].X = pTable.X;
elseif pTable.Y ~= nil then
sProgressID[sIDNo].Y = pTable.Y;
elseif pTable.Height ~= nil then
sProgressID[sIDNo].Height = pTable.Height;
elseif pTable.Width ~= nil then
sProgressID[sIDNo].Width = pTable.Width;
elseif pTable.Margin ~= nil then
sProgressID[sIDNo].Margin = pTable.Margin;
elseif pTable.LeftMarginImage ~= nil then
sProgressID[sIDNo].LeftMarginImage = pTable.LeftMarginImage;
elseif pTable.LeftMarginWidth ~= nil then
sProgressID[sIDNo].LeftMarginWidth = pTable.LeftMarginWidth;
elseif pTable.BackgroundImage ~= nil then
sProgressID[sIDNo].BackgroundImage = pTable.BackgroundImage;
elseif pTable.RightMarginImage ~= nil then
sProgressID[sIDNo].RightMarginImage = pTable.RightMarginImage;
elseif pTable.RightMarginWidth ~= nil then
sProgressID[sIDNo].RightMarginWidth = pTable.RightMarginWidth;
elseif pTable.BarImage ~= nil then
sProgressID[sIDNo].BarImage = BarImage;
end
local X = sProgressID[sIDNo].X;
local Y = sProgressID[sIDNo].Y;
local Height = sProgressID[sIDNo].Height;
local Width = sProgressID[sIDNo].Width;
local pBarMargin = sProgressID[sIDNo].Margin;
local lPart = sProgressID[sIDNo].LeftMarginImage;
local lpWide = sProgressID[sIDNo].LeftMarginWidth;
local mPart = sProgressID[sIDNo].BackgroundImage;
local rPart = sProgressID[sIDNo].RightMarginImage;
local rpWide = sProgressID[sIDNo].RightMarginWidth;
local pBar = sProgressID[sIDNo].BarImage;
-- Left margin properties
local lPartProps = {};
lPartProps.ImageFile = lPart;
lPartProps.Height = Height;
lPartProps.Width = lpWide;
lPartProps.Y = Y;
lPartProps.X = X;
lPartProps.UseTransColor = true;
lPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
lPartProps.Opacity = 100;
lPartProps.Tolerance = 10;
lPartProps.HitTest = HITTEST_STANDARD;
lPartProps.Cursor = CURSOR_ARROW;
lPartProps.TooltipText = "";
lPartProps.Visible = true;
lPartProps.Enabled = true;
lPartProps.ResizeLeft = false;
lPartProps.ResizeRight = false;
lPartProps.ResizeTop = false;
lPartProps.ResizeBottom = false;
lPartProps.ClickSound = SND_NONE;
lPartProps.ClickSoundFile = "";
lPartProps.HighlightSound = SND_NONE;
lPartProps.HighlightSoundFile = "";
Image.SetProperties("slpImage"..sIDNo, lPartProps);
-- Right margin properties
local rPartProps = {};
rPartProps.ImageFile = rPart;
rPartProps.Height = Height;
rPartProps.Width = rpWide;
rPartProps.Y = Y;
rPartProps.X = X+Width-rpWide;
rPartProps.UseTransColor = true;
rPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
rPartProps.Opacity = 100;
rPartProps.Tolerance = 10;
rPartProps.HitTest = HITTEST_STANDARD;
rPartProps.Cursor = CURSOR_ARROW;
rPartProps.TooltipText = "";
rPartProps.Visible = true;
rPartProps.Enabled = true;
rPartProps.ResizeLeft = false;
rPartProps.ResizeRight = false;
rPartProps.ResizeTop = false;
rPartProps.ResizeBottom = false;
rPartProps.ClickSound = SND_NONE;
rPartProps.ClickSoundFile = "";
rPartProps.HighlightSound = SND_NONE;
rPartProps.HighlightSoundFile = "";
Image.SetProperties("srpImage"..sIDNo, rPartProps);
-- Center margin properties
local mPartProps = {};
mPartProps.ImageFile = mPart;
mPartProps.Height = Height;
mPartProps.Width = Width-lpWide-rpWide;
mPartProps.Y = Y;
mPartProps.X = X+lpWide;
mPartProps.UseTransColor = true;
mPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
mPartProps.Opacity = 100;
mPartProps.Tolerance = 10;
mPartProps.HitTest = HITTEST_STANDARD;
mPartProps.Cursor = CURSOR_ARROW;
mPartProps.TooltipText = "";
mPartProps.Visible = true;
mPartProps.Enabled = true;
mPartProps.ResizeLeft = false;
mPartProps.ResizeRight = false;
mPartProps.ResizeTop = false;
mPartProps.ResizeBottom = false;
mPartProps.ClickSound = SND_NONE;
mPartProps.ClickSoundFile = "";
mPartProps.HighlightSound = SND_NONE;
mPartProps.HighlightSoundFile = "";
Image.SetProperties("smpImage"..sIDNo, mPartProps);
-- Bar properties
local bPartProps = {};
bPartProps.ImageFile = pBar;
bPartProps.Height = Height-(2*pBarMargin);
bPartProps.Width = 1;
bPartProps.Y = Y+pBarMargin;
bPartProps.X = X+pBarMargin;
bPartProps.UseTransColor = true;
bPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
bPartProps.Opacity = 100;
bPartProps.Tolerance = 10;
bPartProps.HitTest = HITTEST_STANDARD;
bPartProps.Cursor = CURSOR_ARROW;
bPartProps.TooltipText = "";
bPartProps.Visible = true;
bPartProps.Enabled = true;
bPartProps.ResizeLeft = false;
bPartProps.ResizeRight = false;
bPartProps.ResizeTop = false;
bPartProps.ResizeBottom = false;
bPartProps.ClickSound = SND_NONE;
bPartProps.ClickSoundFile = "";
bPartProps.HighlightSound = SND_NONE;
bPartProps.HighlightSoundFile = "";
Image.SetProperties("sbImage"..sIDNo, bPartProps);
else
Dialog.Message("ERROR", "sProgress.SetProperties Argument 2 must be a table.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
end
end }
Heres a list of the functions, how to use them and what they do:
sProgress.Make(sIDNo, X, Y, Height, Width, lPart, lpWide, mPart, rPart, rpWide, pBar, pBarMargin)
Makes a skinned progress bar. sIDNo is the identifier number (must be a number) that the functions use to recognise different bars. X, Y, Height, Width are self explanatory. lPart is the left margin image, lpWide is the left margin width, similar thing for rPart and rpWide but for the right margin. mPart is the bit that will be stretched hoizontally between the margin images, pBar is the image that will be stretched horizontally to act as the progress bar and pBarMargin is the width of the border to be left by pBar (runs all the way around). Returns sIDNo.
e.g.
sProgress.Make(210, 50, 15, 20, 100, "autoplay\\images\\lpStat.bmp", 10, "autoplay\\images\\mpStat.bmp", "autoplay\\images\\rpStat.bmp", 10, "autoplay\\images\\Bar.bmp", 2)
sProgress.SetProgress(sIDNo, sprogress);
Sets the custom progress bars progress. sprogress is the PERCENTAGE to set the bar to, sIDNo is the numerical identifier of the progress bar you wish to change the progress of.
e.g.
Prog = 0;
sProgress.SetProgress(210, Prog)
sProgress.GetProgress(sIDNo);
Returns the current progress. sIDNo is the numerical identifier of the progress bar in question.
e.g.
sProg = sProgress.GetProgress(210)
sProgress.SetProperties(sIDNo, pTable);
Sets the bars properties from a table. sIDNo is the numerical identifier of the bar in question, pTable is a table containging the information of which to send to the function.
e.g.
tTable = {}
tTable.X = 100;
tTable.Y = 15;
tTable.Height = 30;
tTable.Width = 200;
tTable.Margin = 2;
tTable.LeftMarginImage = "autoplay\\images\\lpStat.bmp";
tTable.LeftMarginWidth = 10;
tTable.BackgroundImage = "autoplay\\images\\mpStat.bmp";
tTable.RightMarginImage = "autoplay\\images\\rpStat.bmp";
tTable.RightMarginWidth = 10;
tTable.BarImage = "autoplay\\images\\Bar.bmp";
sProgress.SetProperties(210, tTable)
sProgress.GetProperties(sIDNo);
Returns a table containing information about the bar in question. sIDNo is the numerical identifier of the bar in question. it returns a table in the format of:
sProgProps = sProgress.GetProperties(sIDNo)
sProgProps.X
sProgProps.Y
sProgProps.Height
sProgProps.Width
sProgProps.Margin
sProgProps.LeftMarginImage
sProgProps.LeftMarginWidth
sProgProps.BackgroundImage
sProgProps.RightMarginImage
sProgProps.RightMarginWidth
sProgProps.BarImage
Key:
Blue - Number
Red - Table
Purple - String
have fun with them (if anyone could make an example as for some reason my AMS doesnt export properly atm. i have still included an example just incase it fixed itself.)
note: also for transparency use red -255 green - 0 blue - 255.
Go in globals:
sProgressID = {}
sProgress = {
Make =
function (sIDNo, X, Y, Height, Width, lPart, lpWide, mPart, rPart, rpWide, pBar, pBarMargin)
sProgressID[sIDNo] = {}
sProgressID[sIDNo].X = X;
sProgressID[sIDNo].Y = Y;
sProgressID[sIDNo].Height = Height;
sProgressID[sIDNo].Width = Width;
sProgressID[sIDNo].Margin = pBarMargin;
sProgressID[sIDNo].Progress = 0;
sProgressID[sIDNo].LeftMarginImage = lPart;
sProgressID[sIDNo].LeftMarginWidth = lpWide;
sProgressID[sIDNo].BackgroundImage = mPart;
sProgressID[sIDNo].RightMarginImage = rPart;
sProgressID[sIDNo].RightMarginWidth = rpWide;
sProgressID[sIDNo].BarImage = pBar;
-- Image object properties table.
local lPartProps = {};
lPartProps.ImageFile = lPart;
lPartProps.Height = Height;
lPartProps.Width = lpWide;
lPartProps.Y = Y;
lPartProps.X = X;
lPartProps.UseTransColor = true;
lPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
lPartProps.Opacity = 100;
lPartProps.Tolerance = 10;
lPartProps.HitTest = HITTEST_STANDARD;
lPartProps.Cursor = CURSOR_ARROW;
lPartProps.TooltipText = "";
lPartProps.Visible = true;
lPartProps.Enabled = true;
lPartProps.ResizeLeft = false;
lPartProps.ResizeRight = false;
lPartProps.ResizeTop = false;
lPartProps.ResizeBottom = false;
lPartProps.ClickSound = SND_NONE;
lPartProps.ClickSoundFile = "";
lPartProps.HighlightSound = SND_NONE;
lPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "slpImage"..sIDNo, lPartProps);
-- Image object properties table.
local rPartProps = {};
rPartProps.ImageFile = rPart;
rPartProps.Height = Height;
rPartProps.Width = rpWide;
rPartProps.Y = Y;
rPartProps.X = X+Width-rpWide;
rPartProps.UseTransColor = true;
rPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
rPartProps.Opacity = 100;
rPartProps.Tolerance = 10;
rPartProps.HitTest = HITTEST_STANDARD;
rPartProps.Cursor = CURSOR_ARROW;
rPartProps.TooltipText = "";
rPartProps.Visible = true;
rPartProps.Enabled = true;
rPartProps.ResizeLeft = false;
rPartProps.ResizeRight = false;
rPartProps.ResizeTop = false;
rPartProps.ResizeBottom = false;
rPartProps.ClickSound = SND_NONE;
rPartProps.ClickSoundFile = "";
rPartProps.HighlightSound = SND_NONE;
rPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "srpImage"..sIDNo, rPartProps);
-- Image object properties table.
local mPartProps = {};
mPartProps.ImageFile = mPart;
mPartProps.Height = Height;
mPartProps.Width = Width-lpWide-rpWide;
mPartProps.Y = Y;
mPartProps.X = X+lpWide;
mPartProps.UseTransColor = true;
mPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
mPartProps.Opacity = 100;
mPartProps.Tolerance = 10;
mPartProps.HitTest = HITTEST_STANDARD;
mPartProps.Cursor = CURSOR_ARROW;
mPartProps.TooltipText = "";
mPartProps.Visible = true;
mPartProps.Enabled = true;
mPartProps.ResizeLeft = false;
mPartProps.ResizeRight = false;
mPartProps.ResizeTop = false;
mPartProps.ResizeBottom = false;
mPartProps.ClickSound = SND_NONE;
mPartProps.ClickSoundFile = "";
mPartProps.HighlightSound = SND_NONE;
mPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "smpImage"..sIDNo, mPartProps);
-- Image object properties table.
local bPartProps = {};
bPartProps.ImageFile = pBar;
bPartProps.Height = Height-(2*pBarMargin);
bPartProps.Width = 1;
bPartProps.Y = Y+pBarMargin;
bPartProps.X = X+pBarMargin;
bPartProps.UseTransColor = true;
bPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
bPartProps.Opacity = 100;
bPartProps.Tolerance = 10;
bPartProps.HitTest = HITTEST_STANDARD;
bPartProps.Cursor = CURSOR_ARROW;
bPartProps.TooltipText = "";
bPartProps.Visible = true;
bPartProps.Enabled = true;
bPartProps.ResizeLeft = false;
bPartProps.ResizeRight = false;
bPartProps.ResizeTop = false;
bPartProps.ResizeBottom = false;
bPartProps.ClickSound = SND_NONE;
bPartProps.ClickSoundFile = "";
bPartProps.HighlightSound = SND_NONE;
bPartProps.HighlightSoundFile = "";
Page.CreateObject(OBJECT_IMAGE, "sbImage"..sIDNo, bPartProps);
return sIDNo
end;
SetProgress =
function (sIDNo, sprogress)
local bPartProps = {};
if sprogress ~= nil --[[and sprogress > 0 ]]then
bPartProps.Width = ((sProgressID[sIDNo].Width-(2*sProgressID[sIDNo].Margin))/100)*sprogress;
Image.SetProperties("sbImage"..sIDNo, bPartProps);
sProgressID[sIDNo].Progress = sprogress;
end
end;
GetProgress =
function (sIDNo)
return sProgressID[sIDNo].Progress;
end;
GetProperties =
function (sIDNo)
return sProgressID[sIDNo];
end;
SetProperties =
function (sIDNo, pTable)
if pTable ~= nil then
if pTable.X ~= nil then
sProgressID[sIDNo].X = pTable.X;
elseif pTable.Y ~= nil then
sProgressID[sIDNo].Y = pTable.Y;
elseif pTable.Height ~= nil then
sProgressID[sIDNo].Height = pTable.Height;
elseif pTable.Width ~= nil then
sProgressID[sIDNo].Width = pTable.Width;
elseif pTable.Margin ~= nil then
sProgressID[sIDNo].Margin = pTable.Margin;
elseif pTable.LeftMarginImage ~= nil then
sProgressID[sIDNo].LeftMarginImage = pTable.LeftMarginImage;
elseif pTable.LeftMarginWidth ~= nil then
sProgressID[sIDNo].LeftMarginWidth = pTable.LeftMarginWidth;
elseif pTable.BackgroundImage ~= nil then
sProgressID[sIDNo].BackgroundImage = pTable.BackgroundImage;
elseif pTable.RightMarginImage ~= nil then
sProgressID[sIDNo].RightMarginImage = pTable.RightMarginImage;
elseif pTable.RightMarginWidth ~= nil then
sProgressID[sIDNo].RightMarginWidth = pTable.RightMarginWidth;
elseif pTable.BarImage ~= nil then
sProgressID[sIDNo].BarImage = BarImage;
end
local X = sProgressID[sIDNo].X;
local Y = sProgressID[sIDNo].Y;
local Height = sProgressID[sIDNo].Height;
local Width = sProgressID[sIDNo].Width;
local pBarMargin = sProgressID[sIDNo].Margin;
local lPart = sProgressID[sIDNo].LeftMarginImage;
local lpWide = sProgressID[sIDNo].LeftMarginWidth;
local mPart = sProgressID[sIDNo].BackgroundImage;
local rPart = sProgressID[sIDNo].RightMarginImage;
local rpWide = sProgressID[sIDNo].RightMarginWidth;
local pBar = sProgressID[sIDNo].BarImage;
-- Left margin properties
local lPartProps = {};
lPartProps.ImageFile = lPart;
lPartProps.Height = Height;
lPartProps.Width = lpWide;
lPartProps.Y = Y;
lPartProps.X = X;
lPartProps.UseTransColor = true;
lPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
lPartProps.Opacity = 100;
lPartProps.Tolerance = 10;
lPartProps.HitTest = HITTEST_STANDARD;
lPartProps.Cursor = CURSOR_ARROW;
lPartProps.TooltipText = "";
lPartProps.Visible = true;
lPartProps.Enabled = true;
lPartProps.ResizeLeft = false;
lPartProps.ResizeRight = false;
lPartProps.ResizeTop = false;
lPartProps.ResizeBottom = false;
lPartProps.ClickSound = SND_NONE;
lPartProps.ClickSoundFile = "";
lPartProps.HighlightSound = SND_NONE;
lPartProps.HighlightSoundFile = "";
Image.SetProperties("slpImage"..sIDNo, lPartProps);
-- Right margin properties
local rPartProps = {};
rPartProps.ImageFile = rPart;
rPartProps.Height = Height;
rPartProps.Width = rpWide;
rPartProps.Y = Y;
rPartProps.X = X+Width-rpWide;
rPartProps.UseTransColor = true;
rPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
rPartProps.Opacity = 100;
rPartProps.Tolerance = 10;
rPartProps.HitTest = HITTEST_STANDARD;
rPartProps.Cursor = CURSOR_ARROW;
rPartProps.TooltipText = "";
rPartProps.Visible = true;
rPartProps.Enabled = true;
rPartProps.ResizeLeft = false;
rPartProps.ResizeRight = false;
rPartProps.ResizeTop = false;
rPartProps.ResizeBottom = false;
rPartProps.ClickSound = SND_NONE;
rPartProps.ClickSoundFile = "";
rPartProps.HighlightSound = SND_NONE;
rPartProps.HighlightSoundFile = "";
Image.SetProperties("srpImage"..sIDNo, rPartProps);
-- Center margin properties
local mPartProps = {};
mPartProps.ImageFile = mPart;
mPartProps.Height = Height;
mPartProps.Width = Width-lpWide-rpWide;
mPartProps.Y = Y;
mPartProps.X = X+lpWide;
mPartProps.UseTransColor = true;
mPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
mPartProps.Opacity = 100;
mPartProps.Tolerance = 10;
mPartProps.HitTest = HITTEST_STANDARD;
mPartProps.Cursor = CURSOR_ARROW;
mPartProps.TooltipText = "";
mPartProps.Visible = true;
mPartProps.Enabled = true;
mPartProps.ResizeLeft = false;
mPartProps.ResizeRight = false;
mPartProps.ResizeTop = false;
mPartProps.ResizeBottom = false;
mPartProps.ClickSound = SND_NONE;
mPartProps.ClickSoundFile = "";
mPartProps.HighlightSound = SND_NONE;
mPartProps.HighlightSoundFile = "";
Image.SetProperties("smpImage"..sIDNo, mPartProps);
-- Bar properties
local bPartProps = {};
bPartProps.ImageFile = pBar;
bPartProps.Height = Height-(2*pBarMargin);
bPartProps.Width = 1;
bPartProps.Y = Y+pBarMargin;
bPartProps.X = X+pBarMargin;
bPartProps.UseTransColor = true;
bPartProps.TransparentColor = Math.HexColorToNumber("FF00FF");
bPartProps.Opacity = 100;
bPartProps.Tolerance = 10;
bPartProps.HitTest = HITTEST_STANDARD;
bPartProps.Cursor = CURSOR_ARROW;
bPartProps.TooltipText = "";
bPartProps.Visible = true;
bPartProps.Enabled = true;
bPartProps.ResizeLeft = false;
bPartProps.ResizeRight = false;
bPartProps.ResizeTop = false;
bPartProps.ResizeBottom = false;
bPartProps.ClickSound = SND_NONE;
bPartProps.ClickSoundFile = "";
bPartProps.HighlightSound = SND_NONE;
bPartProps.HighlightSoundFile = "";
Image.SetProperties("sbImage"..sIDNo, bPartProps);
else
Dialog.Message("ERROR", "sProgress.SetProperties Argument 2 must be a table.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
end
end }
Heres a list of the functions, how to use them and what they do:
sProgress.Make(sIDNo, X, Y, Height, Width, lPart, lpWide, mPart, rPart, rpWide, pBar, pBarMargin)
Makes a skinned progress bar. sIDNo is the identifier number (must be a number) that the functions use to recognise different bars. X, Y, Height, Width are self explanatory. lPart is the left margin image, lpWide is the left margin width, similar thing for rPart and rpWide but for the right margin. mPart is the bit that will be stretched hoizontally between the margin images, pBar is the image that will be stretched horizontally to act as the progress bar and pBarMargin is the width of the border to be left by pBar (runs all the way around). Returns sIDNo.
e.g.
sProgress.Make(210, 50, 15, 20, 100, "autoplay\\images\\lpStat.bmp", 10, "autoplay\\images\\mpStat.bmp", "autoplay\\images\\rpStat.bmp", 10, "autoplay\\images\\Bar.bmp", 2)
sProgress.SetProgress(sIDNo, sprogress);
Sets the custom progress bars progress. sprogress is the PERCENTAGE to set the bar to, sIDNo is the numerical identifier of the progress bar you wish to change the progress of.
e.g.
Prog = 0;
sProgress.SetProgress(210, Prog)
sProgress.GetProgress(sIDNo);
Returns the current progress. sIDNo is the numerical identifier of the progress bar in question.
e.g.
sProg = sProgress.GetProgress(210)
sProgress.SetProperties(sIDNo, pTable);
Sets the bars properties from a table. sIDNo is the numerical identifier of the bar in question, pTable is a table containging the information of which to send to the function.
e.g.
tTable = {}
tTable.X = 100;
tTable.Y = 15;
tTable.Height = 30;
tTable.Width = 200;
tTable.Margin = 2;
tTable.LeftMarginImage = "autoplay\\images\\lpStat.bmp";
tTable.LeftMarginWidth = 10;
tTable.BackgroundImage = "autoplay\\images\\mpStat.bmp";
tTable.RightMarginImage = "autoplay\\images\\rpStat.bmp";
tTable.RightMarginWidth = 10;
tTable.BarImage = "autoplay\\images\\Bar.bmp";
sProgress.SetProperties(210, tTable)
sProgress.GetProperties(sIDNo);
Returns a table containing information about the bar in question. sIDNo is the numerical identifier of the bar in question. it returns a table in the format of:
sProgProps = sProgress.GetProperties(sIDNo)
sProgProps.X
sProgProps.Y
sProgProps.Height
sProgProps.Width
sProgProps.Margin
sProgProps.LeftMarginImage
sProgProps.LeftMarginWidth
sProgProps.BackgroundImage
sProgProps.RightMarginImage
sProgProps.RightMarginWidth
sProgProps.BarImage
Key:
Blue - Number
Red - Table
Purple - String
have fun with them (if anyone could make an example as for some reason my AMS doesnt export properly atm. i have still included an example just incase it fixed itself.)
note: also for transparency use red -255 green - 0 blue - 255.