Link Search Menu Expand Document

Windows and images

Functions


create_win

sfall.h

void create_win(string winName, int x, int y, int width, int height, int flags)

flags argument is optional. Works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if the flags argument is not specified, and allows to set additional flags for the created window. MoveOnTop flag allows the created window to be placed on top of the game interface.

This is a macro, you need to include sfall.h to use it.


draw_image

sfall.h

void draw_image(string/int artFile/artId, int frame, int x, int y, bool noTransparent)
  • displays the specified PCX or FRM image in the active window created by vanilla CreateWin or sfall’s create_win script function
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format) optional arguments:
  • frame: frame number, the first frame starts from zero
  • x/y: offset relative to the top-left corner of the window
  • noTransparent: pass True to display an image without transparent background
  • NOTE: to omit optional arguments starting from the right, call the functions with different sfall_funcX (e.g. sfall_func4("draw_image", pathFile, frame, x, y))

This is a macro, you need to include sfall.h to use it.


draw_image_scaled

sfall.h

void draw_image_scaled(string/int artFile/artId, int frame, int x, int y, int width, int height)
  • displays the specified PCX or FRM image in the active window created by vanilla CreateWin or sfall’s create_win script function
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format) optional arguments:
  • frame: frame number, the first frame starts from zero
  • x/y: offset relative to the top-left corner of the window
  • width/height: the new width/height to scale the image to. Pass -1 to either width or height to keep the aspect ratio when scaling
  • NOTE: to omit optional arguments starting from the right, call the functions with different sfall_funcX (e.g. sfall_func4("draw_image", pathFile, frame, x, y))
  • if called without x/y/width/height arguments, the image will be scaled to fit the window without transparent background

This is a macro, you need to include sfall.h to use it.


get_window_attribute

int sfall_func1("get_window_attribute", int winType)

Alternative form: int sfall_func2("get_window_attribute", int winType, int attrType) Returns the attribute of the specified interface window by the attrType argument.

- winType: the type number of the interface window (see `WINTYPE_*` constants in `sfall.h`)
- attrType: 0 - checks and returns a value of 1 if the specified interface window is created by the game (same as without the argument)
            1 - X position, 2 - Y position (relative to the top-left corner of the game screen)
- returns -1 if the specified attribute cannot be obtained

get_window_under_mouse

int get_window_under_mouse()

interface_art_draw

int sfall_func4("interface_art_draw", int winType, string artFile/int artID, int x, int y)
int sfall_func4("interface_art_draw", int winType, string artFile/int artID, int x, int y)
int sfall_func5("interface_art_draw", int winType, string artFile/int artID, int x, int y, int frame)
int sfall_func6("interface_art_draw", int winType, string artFile/int artID, int x, int y, int frame, array param)
  • draws the specified PCX or FRM image in the game interface window, returns -1 in case of any error
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h) this also takes the value of the flag (0x10000) to prevent immediate redrawing of the interface window
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format)
  • x/y: offset relative to the top-left corner of the window

optional arguments:

  • frame: frame number, the first frame starts from zero
  • param: an array which specifies additional parameters, where: index 0 - sprite direction for multi-directional FRM index 1/index 2 - the new width/height to scale the image to. Pass -1 to use the original width/height

message_box

int sfall_func4("message_box", string message, int flags, int color1, int color2)

Creates a dialog box with text and returns the result of pressing the button: 0 - No (Escape), 1 - Yes/Done (Enter). Returns -1 if for some reason the dialog box cannot be created.

- message: the text in the dialog box. Use the \n control character to move text to a new line (example: "Hello\nWorld!")
optional arguments:
- flags: mode flags (see `MSGBOX_*` constants in define_extra.h). Pass -1 to skip setting the flags (default flags are NORMAL and YESNO)
- color1/color2: the color index in Fallout palette. color1 sets the text color for the first line, and color2 for all subsequent lines of text (default color is 145)

int sfall_func5("print_text", string text, int winType, int x, int y, int color)
int sfall_func5("print_text", string text, int winType, int x, int y, int color)
int sfall_func6("print_text", string text, int winType, int x, int y, int color, int width)
  • displays the text in the specified interface window with the current font. Use vanilla SetFont function to set the font
  • text: the text to be printed. Use the \n control character to move text to a new line (example: “Hello\nWorld!”)
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • x/y: offset relative to the top-left corner of the window
  • color: the color index in Fallout palette. Pass 0 if the text color was previously set by vanilla SetTextColor function it can also take additional flags (via bwor) for displaying text: 0x0010000 - adds a shadow to the text, the ‘textshadow’ compiler constant 0x2000000 - fills the background of the text with black color, the ‘textnofill’ compiler constant (works the other way around)
  • width: the maximum width of the text. The text will be wrapped to fit within the specified width

set_window_flag

sfall.h

void set_window_flag(string winName/int winID, int flag, bool value)

Changes the specified flag for the created script or game interface window.

  • winName: the window name, assigned to the window by the CreateWin/create_win function
  • winID: the ID number of the interface or script window obtained with the get_window_under_mouse function, or 0 for the current game interface
  • flag: the flag to change (see WIN_FLAG_* constants in define_extra.h)
  • value: true - set the flag, false - unset the flag

This is a macro, you need to include sfall.h to use it.