Link Search Menu Expand Document

Sfall funcX macros

Functions


add_extra_msg_file

sfall.h

int add_extra_msg_file(string fileName)

Loads the custom message file, and returns the file ID number assigned to it in range from 0x3000 to 0x3FFF for the message_str_game function to get messages from the file.

  • fileName: the name of the custom message file (including the .msg extension) in text\<language>\game\ directory.

Alternative form: int add_extra_msg_file(string fileName, int fileNumber)

  • fileNumber: the file ID number for the message_str_game function. The available range is from 0x2000 to 0x2FFF (see ExtraGameMsgFileList setting in ddraw.ini) Use fileNumber only if you want to add a message file without editing ddraw.ini or existing scripts to support the old way.

critter_inven_obj2

sfall.h

ObjectPtr critter_inven_obj2(ObjectPtr obj, int type)

Works just like vanilla critter_inven_obj, but correctly reports item in player’s inactive hand slot.


dialog_message

sfall.h

void dialog_message(string text)

Displays a message in the NPC response window in dialog or barter screen.


get_current_inven_size

sfall.h

get_current_inven_size(ObjectPtr object)

Returns the current inventory size of the container or the critter.


get_metarule_table

sfall.h

array get_metarule_table

Returns names of all currently available script functions.


get_object_ai_data

sfall.h

int get_object_ai_data(ObjectPtr object, int aiParam)

Returns the setting value from the AI packet of an object (critter). Use AI_CAP_* constants from define_extra.h for the aiParam argument to get AI value.


get_text_width

sfall.h

int get_text_width(string text)

Returns the text width in pixels for the currently set font.


item_weight

sfall.h

int item_weight(ObjectPtr obj)

Gets the current weight of an object.


metarule_exist

sfall.h

bool metarule_exist(string metaruleName)

Returns True if the specified name of metarule (sfall_funcX) function exists in the current version of sfall.


npc_engine_level_up

sfall.h

void npc_engine_level_up(bool toggle)

Enables/disables the engine function that increases the level of party members in the player leveling process. If the engine function is disabled, the process of leveling up party members should be performed by script functions.


objects_in_radius

sfall.h

objects_in_radius", int tile, int radius, int elevation, int type)
  • returns an array of objects of a type (see OBJ_TYPE_* constants in define_extra.h) within the specified radius from the given tile
  • passing -1 to the type argument or not specifying it will return all objects within the radius
  • the radius is limited to 50 hexes

set_drugs_data

sfall.h

void set_drugs_data(int type, int pid, int value)

Overrides the parameters of drugs set in the configuration file (DrugsFile setting in ddraw.ini). Type: 0 - changes the value of NumEffects for the drug (see Drugs.ini for the description of NumEffects), 1 - changes the duration of the addiction effect for the drug (a value of 1 = one game minute).


set_rest_heal_time

sfall.h

void set_rest_heal_time(int time)

Sets the time interval in minutes for healing during resting. The default is 180. Note: The interval will be reset each time the player reloads the game.


set_rest_mode

sfall.h

void set_rest_mode(int flags)

Sets the bit flags for the rest mode (see RESTMODE_* constants in sfall.h). Passing 0 will reset the rest mode. It will also be reset each time the player reloads the game.


sfall_func0(“hide_window”)

sfall.h

void sfall_func0("hide_window")

Hides currently active (selected) script window.


sfall_func0(“show_window”)

sfall.h

void sfall_func0("show_window")

Displays the script window previously hidden with the sfall_func0("hide_window") function.


sfall_func1(“hide_window”, string winName)

sfall.h

void sfall_func0("hide_window")

Hides the specified script window.

  • winName: the window name, assigned to the window by the CreateWin/create_win function

sfall_func1(“remove_timer_event”, int fixedParam)

sfall.h

void sfall_func1("remove_timer_event", int fixedParam)

Removes all timer events with the specified fixedParam value for the current global script.


sfall_func1(“show_window”, string winName)

sfall.h

void sfall_func1("show_window", string winName)

Displays the specified hidden script window. winName: the window name, assigned to the window by the CreateWin/create_win function


sfall_func2(“string_compare”, string str1, string str2)

sfall.h

bool sfall_func2("string_compare", string str1, string str2)

Compares two strings case-insensitive, and returns True if the two strings are matched.


sfall_func3(“string_compare”, string str1, string str2, int codePage)

sfall.h

bool sfall_func3("string_compare", string str1, string str2, int codePage)

Compares two strings case-insensitive, and returns True if the two strings are matched

  • codePage: code page number to properly compare national characters in the range 128-255 of the ASCII code table available encodings: 1250-1252, 866

spatial_radius

sfall.h

int spatial_radius(ObjectPtr obj)

Returns radius of spatial script, associated with given dummy-object (returned by create_spatial).


void sfall_func0(“remove_timer_event”)

sfall.h

void sfall_func0("remove_timer_event")

Clears all set timer events for the current global script.