Function reference table for foo_looks 2.1

'Get' Functions:

These function are used to access coorindates and values of sprites in your skin and use them in your scripts (usually for calculations)

Function Arguments Return Description Example
look_getX(sprite) Target Sprite Integer Returns the x-coordinate of the named sprite myspriteX = look_getX(mysprite)
look_getY(sprite) Target Sprite Integer Returns the y-coordinate of the named sprite myspriteY = look_getY(mysprite)
look_getWidth(sprite) Target Sprite Integer Returns the width of the named sprite myspriteWidth = look_getWidth(mysprite)
look_getHeight(sprite) Target Sprite Integer Returns the height of the named sprite currentHeight = look_getHeight(mysprite)
look_getSrcX(sprite) Target Sprite Integer Returns the x-coordinate from the srcoff property of named sprite
look_getSrcY(sprite) Target Sprite Integer Returns the y-coordinate from the srcoff property of named sprite
look_getToggle(sprite) Target Sprite Integer (0/1) Returns the current toggle status of the named sprite (0 or 1) if look_getToggle(mysprite) > 0 then
LOG("mysprite is toggled")
end
look_getLayer(sprite) Target Sprite Integer Returns the current z-layer of the named sprite
look_getRect(sprite) Target Sprite Table
{ x=int, y=int, width=int, height=int }
Return a 4-value table containing the rect dimensions myRect = look_getRect(mysprite)
mySurfaceArea = myRect.width * myRect.height
look_getSrcOffset(sprite) Target Sprite Table
{ sx=int, sy=int }
Return a 2-value table containing the srcoff values
look_getCursorPos(void) Target Sprite Table
{ x=int, y=int }
Return a 2-value table containing the current mouse pointer coordinates (top-left of the desktop is 0,0)
look_getVisible(sprite) Target Sprite Boolean
(true or false)
Checks the current state of the visible toggle for a sprite if look_getVisible(sprite1) == false then
look_setVisible(sprite1,true)
end
look_getEnabled(sprite) Target Sprite Boolean Checks the current state of the enable toggle for a sprite

'Set' Functions:

These function are used to set new values and coordinates for the sprites in your skin.

Notes: 'Set' functions never return a value (return:void), so i have omitted the 'Return' column from this table.

Also note that danZ has kindly coded all of the 'set' functions to accept either a single sprite, or a table of sprites as a target. To set multiple sprites at once you must encapsulate the list of target sprites in curly parantheses, for example { sprite1, sprite2, sprite3 }

Function Arguments Description Examples / Notes
look_setX(sprite, x) Sprite(s) + new x-coordinate Sets the x-coordinate of the target sprite(s) look_setX(mysprite,150)
look_setX({sprite1,sprite2},25)
look_setY(sprite, y) Sprite(s) + new y-coordinate Sets the y-coordinate of the target sprite(s) look_setY(mysprite,look_getX(mysprite)+20)
look_setY({sprite1,sprite2},50)
look_setWidth(sprite, width) Sprite(s) + new width Sets a new width for the target sprite(s) look_setWidth(mysprite,245)
look_setWidth({sprite1,sprite5},look_getWidth(sprite3))
look_setHeight(sprite, height) Sprite(s) + new height Sets a new height for the target sprite(s) look_setHeight(mysprite,100)
look_setHeight({sprite1,sprite2},look_getWidth(sprite1)*1.5)
look_setSrcX(sprite, srcx) Sprite(s) + new srcx value Sets a new srcx value (very useful for animation) onupdate(this)
x = look_getSrcX(mysprite)
look_setSrcX(mysprite,x+15)
end
look_setSrcY(sprite, srcy) Sprite(s) + new srcy value Sets a new srcy value (very useful for animation)
look_setToggle(sprite, toggle) Sprite(s) + desired toggle state (0 or 1) Changes the toggle state for the sprite
look_setLayer(sprite, layer) Sprite(s) + desired z-layer Sets a new z-layer for the sprite


The Rest...

'Get' functions

(Value) look_getValue(section, name)
String look_getName(sprite)
Table [a,r,g,b] look_getFontColor(sprite, which [0,1])
Table [a,r,g,b] look_getFillColor(sprite, which [0,1])
String look_getText(sprite)
String look_getFspec(sprite)
Image look_getImage(sprite)
Int look_getPlaylistIndex(sprite)
String look_getPath(target, verb)
String look_getExt(target, verb)
Int look_getTime(void)

'Set' functions

void look_setRect(sprite [ {sprite, ... } ], rect [ { x=int, y=int, width=int, height=int } ])
void look_setVisible(sprite [ {sprite, ... } ], visible)
void look_setEnabled(sprite [ {sprite, ... } ], enable)
void look_setSrcOffset(sprite [ {sprite, ... } ], table [sx=int, sy=int])
void look_setFillColor(sprite [ {sprite, ... } ], color, which [0,1,2 or nil == both])
void look_setBorderColor(sprite [ {sprite, ... } ], color)
void look_setBorderWidth(sprite [ {sprite, ... } ], width)
void look_setFont(sprite [ {sprite, ... } ], fontname)
void look_setFontColor(sprite [ {sprite, ... } ], color, which [0,1,2 or nil == both])
void look_setFontSize(sprite [ {sprite, ... } ], size)
void look_setFontStyle(sprite [ {sprite, ... } ], style)
void look_setAlpha(sprite [ {sprite, ... } ], alpha)
void look_setText(sprite [ {sprite, ... } ], Text)
void look_setFspec(sprite [ {sprite, ... } ], Fspec)
void look_setImage(sprite [ {sprite, ... } ], image)
void look_setStateMap(sprite [ {sprite, ... } ], state, offset)
void look_setPlaylistIndex(sprite [ {sprite, ... } ], index)

fb2k commands

Int fb2k_playlistGetFocus(void)
Int fb2k_getNumPlaylists(void)
Int fb2k_getActivePlaylist(void)
void fb2k_menuCommand(menuString)
void fb2k_playlistSetFocus(index)
void fb2k_playlistSetSel(index, select)
void fb2k_playlistSetFocusSel(index)
void fb2k_playlistContextCommand(menuString, [ index or { playlist index list }])
Int fb2k_createPlaylist(newname)
void fb2k_deletePlaylist(plindex)
void fb2k_renamePlaylist(plindex, newname)
void fb2k_activatePlaylist(plindex)
String or Table { name1, nameN } fb2k_getPlaylistName(plindex [void - all playlists])
bool fb2k_uiIsActivated(void)
void fb2k_playStart(void)
void fb2k_playPause(void)
void fb2k_playStop(void)
void fb2k_playSkipStart(N [N = 0 play current, +N next, -N previous])
bool fb2k_isPaused(void)
bool fb2k_isPlaying(void)
bool fb2k_isStopped(void)
vol [-10000 - 0] fb2k_getVolume(void)
String fb2k_getConfigString(name)
PLindex [-1 if none] fb2k_getNowPlaying(void)
Number [current song play pos] fb2k_getPlayPosition(void)
Length fb2k_getSongLength(void)
void fb2k_playbackSeek(newpos)

Misc functions:

String look_help(echo)
void look_callScript(hotspot, funcname)
Bool look_loadExtension(filename, initFuncName)
void look_invalidate(sprite [ {sprite, ... } ])
bool look_shellExec(target, verb)
void look_playSound(filename)
Int look_color(a, r, g, b)

Image functions:

int image_getWidth(image)
int image_getHeight(image)
table [a,r,g,b] image_getPixel(image,x,y)
void image_setPixel(image,x,y,look_color)

Calculation functions:

Table [ { x=int, y=int, width=int, height=int } ] look_inflateRect(rect [ { x=int, y=int, width=int, height=int } ], dx, dy)
Bool look_insideRect(rect [ { x=int, y=int, width=int, height=int } ], x, y)
Bool look_insideSprite(sprite, x, y)
Table [ { x=int, y=int, width=int, height=int } ] look_measureTextAbs(sprite, [text])