I can't find anything in the help guide about how to do a timer
Yeah, it is put into "global functions" sections, may be a bit confusing.
http://www.adventuregamestudio.co.uk/wiki/?title=Game_/_Global_functions#SetTimerAnyway, kconan explained how to use it already.
I'm thinking something about setting the slider
What about drawing the progress bar using raw drawing instead? That may look much prettier.
One of the ways to do that is to create a DynamicSprite from the sprite you are using for GUI's background (if you aren't create one transparent one with the size of GUI). Or, optionally, you may put button with no on-click handler.
So, you create a DynamicSprite at the game start and assign that new Dynamic Sprite as either the whole GUI or button's background (depending on your choice):
DynamicSprite* glProgressBarSprite; // this MUST be a global pointer, otherwise the sprite is released as soon as function ends
function game_start()
{
...
glProgressBarSprite = DynamicSprite.CreateFromExistingSprite(SPRITE_ID);
gGUI.BackgroundGraphic = glProgressBarSprite.Graphic;
// or
gProgressButton.NormalGraphic = glProgressBarSprite.Graphic;
...
Now you basically can draw upon the dynamic sprite anytime you want, and the GUI graphic will change.
Example code:
function OnScoreChanged()
{
DrawingSurface *ds = sprite.GetDrawingSurface();
ds.DrawRectangle(0, 0, 1 * game.score 10); // fill rectangle, which width depends on current game's score
// you may apply more math here, like calculating percent of total score and take maximal progress bar size into consideration
ds.Release(); // release drawing surface when finished drawing
}
You may draw using basic graphics and/or draw sprites.