Hi Ruben,
it is not possible to use variables as limits on sliders. You can define the limits of the slider with the content of a variable but no with the variable itself as you tried. You get that error when trying to define a limit with the content of a non initialized variable.

You only need to modify the slider just before showing the panel. 'pan_setslider' works a bit different, parallel to 'slider' instead of 'hslider'. Here is an example:

Code:
var transf_amt = 0;

BMAP *bmpTransferOn = "transfer_button_click.pcx";
BMAP *bmpTransferOff = "transfer_button.pcx";
BMAP *bmpTransferOver = "transfer_button_hover.pcx";
BMAP *bmpTransferSliderBg = "horizontalSliderBg.pcx";
BMAP *bmpTransferSliderKnob = "horizontalSlider.pcx";

function buttonTransferItems ( var button_id, PANEL *panel )
{
	reset ( panel, SHOW );
	printf ( "%.0f", (double)transf_amt );
}

PANEL* invTransferAmount =
{
	digits  ( 590, 490, 5, *, 1, transf_amt );
	button  ( 640, 510, bmpTransferOn, bmpTransferOff, bmpTransferOver, buttonTransferItems, NULL, NULL );
	slider ( 450, 514, bmpTransferSliderBg, bmpTransferSliderKnob, 0, 1, transf_amt );
	flags = OUTLINE;
}

...
transf_amt = 0;
var count_max = 1 + floor ( random(10) ); // maximum of items
pan_setslider ( invTransferAmount, 1, 450, 514, bmpTransferSliderBg, bmpTransferSliderKnob, 0, count_max, transf_amt );
set ( invTransferAmount, SHOW );
...



Salud!