buttontileart in gumps.inc

Archive of posts related to former distro versions. Be aware that posts here do not refer to the current distro and may not work.

Moderators: POL Developer, Distro Developer

Locked
Gnafu
Grandmaster Poster
Posts: 136
Joined: Thu Feb 02, 2006 7:29 am
Location: Livorno, Italy
Contact:

buttontileart in gumps.inc

Post by Gnafu »

I managed to add a funtion to my gump scripts (based on an old gump pkg) but It seems it is not used in the distro.

Code: Select all

// Display a "tile button" (returns a key value and can close gump)
//
// Syntax: x, y, release, press, quit, page, key, tilepic, hue, tile-x, tile-y
// (page=0 - it returns a value instead of changing page)
// Don't know if "release" ad "press" are really used by the client
//
// Adds a button to the gump with the specified coords and tilepic as graphic.
// tile-x and tile-y define the coords of the tile graphic, relative to x and y.
// 
// returns: A structure...
//	.lytidx = Layout-array index changed
//	.keyid	= KeyID allocated to the button - returned from Gump if pressed
//	 (butid)
//
function GFButtonTileArtID( x, y, release, press, close, tilepic, hue:= 0, tilex:= 0, tiley:= 0, id := 0 )
	// "ButtonTileArt x y release press quit page key tilepic hue tile-x tile-y"
	var line := "buttontileart " + CStr(GFref.x + CInt(x)) + " " + CStr(GFref.y + CInt(y));
	line := line + " " + CStr(CInt(release)) + " " + CStr(CInt(press)) + " ";
	if ( close == 0 )
		line := line + "0 0 ";
	else
		line := line + "1 0 ";
	endif
	id := CInt(id);		// Ensure it's an integer
	if ( id < 1 )		// Catch errors (0) and invalid (negative) values
		id := GFbutid;
		GFbutid := GFbutid + 1;		// Update KeyID (butid) (only if used)
	endif
	line := line + CStr(id);
	line := line + " " + CStr(CInt(tilepic)) + " " + CStr(CInt(hue));
	line := line + " " + CStr(CInt(tilex)) + " " + CStr(CInt(tiley));
	GFlayout.append( line );
	return XGFRetVal( GFlayout.size(), -1, id );
endfunction
Usefull to use a tile as a button :D
I will change it to fit in the distro and submit a patch soon...
User avatar
Damien White
Journeyman Poster
Posts: 68
Joined: Tue Aug 18, 2009 6:34 pm
Location: Canada

Re: buttontileart in gumps.inc

Post by Damien White »

This is excellant!

Thank you very much.
Locked