Форум TeamX
   Home   Members  
Pages: [1] |   Go Down
 
Author Topic: Новые функции для sfall  (Read 1238 times)
Jordan
Пользователь
Posts: 416

476228895
Новые функции для sfall
« on: 09 June 2008, 13:49:34 »

Wasteland Ghost

Quote
Джордан, ё-моё, сначала объясни по-русски на тимЫксе, что конкретно ты пытаешься сделать. Скорее всего твоя проблема решается без необходимости ломания движка.

Я просто хотел что бы добавили новые скриптовык функции в sfall если это возможно.

1. msg(имя msg, номер строки)

Пример

msg(acklint.msg, 100)

Тогда не будет привязки

А лучше добавить еще вот такую функцию

msg_self(номер строки)

Здесь функция сама читает название скрипта и ищет по такому же названию мсг.

2. Что бы описание и имя задавалось не из scrname.msg а из скрипта  self

Пример

acklint.msg

{10000}{}{Имя}
{10001}{}{Описание}

Тогда не нужно править scrname.msg потому что при уроне появляется строка
клинт ранен и т.д
И если изменить номер скрипта тогда нужно изменять и scrname, понимаете?

А так все задается в msg
« Last Edit: 09 June 2008, 13:52:40 by Jordan »

Воспрянет Россия, из праха отцов
Расправятся крылья, миллионов сердец
Поднимут все головы и грудью вздохнут
И громка скажут, что пришли
Мы пришли, со столетней войны
Wasteland Ghost
Администратор
Posts: 869

Маленькое Злое Привидение


Re: Новые функции для sfall
« Reply #1 on: 11 June 2008, 13:48:28 »

1. Зачем? Кроме того, работа с... эээ... сторонними ресурсами -- лишняя проблема движку.
2. А макросы на что? Сэ мэ command.h макрос mstr(x). Один раз задаёшь в скрипте переменную NAME и получаешь удовольствие. Улыбка
3. Понимаю. Только не вижу здесь проблемы. Что мешает вписАть в scrname.msg новую строку?

Движок Фола, может, и не совсем удобен, но уж такой он нам достался. Приделывать костыли только "от лени" не имеет смысла и вреда приносит больше, чем пользы. Проще написАть свои утилиты для автоматизации, если уж настолько лениво прописать две строки в двух файлах и один дефайн в скрипте.
Fakels
Пользователь
Posts: 337

Модный геймер


Re: Новые функции для sfall
« Reply #2 on: 30 June 2008, 23:09:15 »

А можно огласить полный список новых функций из sfall, и как их правильно использовать?

"Необходимо учесть все условия и тогда - нет проблем"
Jordan
Пользователь
Posts: 416

476228895
Re: Новые функции для sfall
« Reply #3 on: 01 July 2008, 18:49:27 »

Fakels

Quote
А можно огласить полный список новых функций из sfall

This is a very slightly modified copy of sslc. It will recognise and compile the following extra functions:

0x8156 - int   read_byte(int address)
0x8157 - int   read_short(int address)
0x8158 - int   read_int(int address)
0x8159 - char* read_string(int address)

0x815a - void  set_pc_base_stat(int StatID, int value)
0x815b - void  set_pc_extra_stat(int StatID, int value)
0x815c - int   get_pc_base_stat(int StatID)
0x815d - int   get_pc_extra_stat(int StatID)

0x815e - void  set_critter_base_stat(CritterPtr, int StatID, int value)
0x815f - void  set_critter_extra_stat(CritterPtr, int StatID, int value)
0x8160 - int   get_critter_base_stat(CritterPtr, int StatID)
0x8161 - int   get_critter_extra_stat(CritterPtr, int StatID)

0x81b4 - void set_stat_max(int stat, int value)
0x81b5 - void set_stat_min(int stat, int value)
0x81b7 - void set_pc_stat_max(int stat, int value)
0x81b8 - void set_pc_stat_min(int stat, int value)
0x81b9 - void set_npc_stat_max(int stat, int value)
0x81ba - void set_npc_stat_min(int stat, int value)

0x816b - int input_funcs_available()
ox816c - int key_pressed(int dxScancode)
0x8162 - void  tap_key(int dxScancode)

0x8163 - int get_year()

0x8164 - bool game_loaded()

0x8165 - bool graphics_funcs_available()
0x8166 - int  load_shader(char* path)
0x8167 - void free_shader(int ID)
0x8168 - void activate_shader(int ID)
0x8169 - void deactivate_shader(int ID)
0x816d - void set_shader_int(int ID, char* param, int value)
0x816e - void set_shader_float(int ID, char* param, float value)
0x816f - void set_shader_vector(int ID, char* param, float f1, float f2, float f3, float f4)
0x81ad - int get_shader_version()
0x81ae - void set_shader_mode(int mode)
0x81b0 - void force_graphics_refresh(bool enabled)
0x81b1 - int get_shader_texture(int ID, int texture)
0x81b2 - void set_shader_texture(int ID, char* param, int texID)

0x816a - void set_global_script_repeat(int frames)
0x819b - void set_global_script_type(int type)
0x819c - int available_global_script_types()

0x8170 - bool in_world_map()

0x8171 - void force_encounter(int map)

0x8172 - void set_world_map_pos(int x, int y)
0x8173 - int get_world_map_x_pos()
0x8174 - int get_world_map_y_pos()

0x8175 - void set_dm_model(char* name)
0x8176 - void set_df_model(char* name)
0x8177 - void set_movie_path(char* filename, int movieid)

0x8178 - void set_perk_image(int perkID, int value)
0x8179 - void set_perk_ranks(int perkID, int value)
0x817a - void set_perk_level(int perkID, int value)
0x817b - void set_perk_stat(int perkID, int value)
0x817c - void set_perk_stat_mag(int perkID, int value)
0x817d - void set_perk_skill1(int perkID, int value)
0x817e - void set_perk_skill1_mag(int perkID, int value)
0x817f - void set_perk_type(int perkID, int value)
0x8180 - void set_perk_skill2(int perkID, int value)
0x8181 - void set_perk_skill2_mag(int perkID, int value)
0x8182 - void set_perk_str(int perkID, int value)
0x8183 - void set_perk_per(int perkID, int value)
0x8184 - void set_perk_end(int perkID, int value)
0x8185 - void set_perk_chr(int perkID, int value)
0x8196 - void set_perk_int(int perkID, int value)
0x8187 - void set_perk_agl(int perkID, int value)
0x8188 - void set_perk_lck(int perkID, int value)
0x8189 - void set_perk_name(int perkID, char* value)
0x818a - void set_perk_desc(int perkID, char* value)

0x818b - void set_pipboy_available(int available)

0x818c - int get_kill_counter(int critterType)
0x818d - void mod_kill_counter(int critterType, int amount)

0x818e - int get_perk_owed()
0x818f - void set_perk_owed(int value)
0x8190 - int get_perk_available(int perk)

0x8191 - int get_critter_current_ap(CritterPtr)
0x8192 - void set_critter_current_ap(CritterPtr, int ap)

0x8193 - int get_active_hand()
0x8194 - void toggle_active_hand()

0x8195 - void set_weapon_knockback(WeaponPtr, int type, float value)
0x8196 - void set_target_knockback(CritterPtr, int type, float value)
0x8197 - void set_attacker_knockback(CritterPtr, int type, float value)
0x8198 - void remove_weapon_knockback(WeaponPtr)
0x8199 - void remove_target_knockback(CritterPtr)
0x819a - void remove_attacker_knockback(CritterPtr)

0x819d - void set_sfall_global(string varname, int/float value)
0x819e - int get_sfall_global_int(string varname)
0x819f - float get_sfall_global_float(string varname)

0x81a0 - void set_pickpocket_max(int percentage)
0x81a1 - void set_hit_chance_max(int percentage)
0x81a2 - void set_skill_max(int value)
0x81aa - void set_xp_mod(int percentage)
0x81ab - void set_perk_level_mod(int levels)

0x81a3 - int eax_available()
0x81a4 - void set_eax_environment(int environment)

0x81a5 - void inc_npc_level(char* npc)

0x81a6 - int get_viewport_x()
0x81a7 - int get_viewport_y()
0x81a8 - void set_viewport_x()
0x81a9 - void set_viewport_y()

0x81ac - int get_ini_setting(char* setting)

0x81af - int get_game_mode()

0x81b3 - int get_uptime()

0x81b6 - void set_car_current_town(int town)

Unlike the original script compiler, this is not a dos program. When using this in place of the original compile.exe but still using p.bat, you need to either get rid of the dos4gw.exe reference from p.bat or replace the original dos4gw.exe with the one in this archive.

If you use fallout script editor, you can extract compile.exe and dos4gw.exe to its \binary folder, or extract them somewhere else and change your preferences in FSE to point there. FSE doesn't seem to be able to tell when errors occur when using this compiler, so I'd recommend compiling by hand if possible.

-----------------------------------------------------------
Original sslc source is over here:
http://www.teamx.ru/eng/files/srcs/index.shtml


-----------------------------------------------------------
sfall scripting notes:

As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj will crash the script.) To use a global script, the script must have a name which begins with 'gl' and contains a procedure called 'start'. This procedure will be executed once when the player loads a saved game or starts a new game. If you wish the script to be executed repeatedly, call set_global_script_repeat on this first run using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.) Global scripts do not have to be listed in scripts.lst.

Global scripts have multiple modes, which can be set using the set_global_script_type function. In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc. In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows. Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows. Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.

Both set_global_script_repeat and set_global_script_type only have an effect on the script they were called from. Every global script needs its own game_loaded block to correctly set up the script type and repeat rate. set_global_script_repeat will have no effect if called on a non-global script.

The read_xxx functions take a memory address as the parameter and can read arbitrary pieces of fallouts address space.

The get/set_pc_base/extra_stat functions are equivelent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat.

The set_stat_max/min functions can be used to set the valid ranges on on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only effect the player, the set_npc_ functions only effect other critters, and the set_ functions effect both.

game_loaded returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. It's primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.

The input functions are only available if the user has the input hook turned on in ddraw.ini. Use input_funcs_available to check.

The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can't. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.

load_shader takes a path relative to the data\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.

get_shader_version gives you the higest shader version supported by the players graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.

set_shader_mode tells sfall when to use a shader. The parameter is a set of 32 flags which specify the screens on which the shader will be disabled, unless bit 32 is set, in which case the shader will only be active on those screens. Remember that screens are displayed on top of each other; if the player opens the character menu which in combat, the game still considers the player to be in combat. See sfall.h for a list of defines.

force_graphics_refresh forces the screen to redraw at times when it normally wouldn't. If you're using animated shader, turning this option on is recommended.

in_world_map returns 1 if the player is looking at the world map, or 0 at any other time. Obviously this is only useful in global scripts, since normal scripts will never get the chance to run on the world map.

force_encounter can be called either from a global script while traveling on the world map, or from a normal script while on a local map. In either case the encounter occurs shortly after the next time the player moves on the world map. The player will not get an outdoorsman skill check.

The mapper manual lists the functions 'world_map_x_pos' and 'world_map_y_pos', which supposedly return the players x and y positions on the world map. get_world_map_x/y_pos are included here anyway, because I was unable to get those original functions to work, or even to find any evidence that they existed in game.

set_pipboy_available will only accept 0 or 1 as an argument. Using any other value will cause the function to have no effect. Use 0 to disable the pipboy, and 1 to enable it.

get/set_critter_current_ap functions should only be used during the target critters turn while in combat. Calling them outside of combat typically returns the critters max ap, but don't rely on that behaviour. (Specifically, if the critter has never before entered combat, it will probably return the critters base ap ignoring any extra bonuses from perks etc.) Using set_critter_current_ap on the player will not automatically redraw the screen, so the ap bar will be incorrect until the player next clicks.

The 'type' value in the weapon knockback functions can be 0 or 1. If 0, the value becomes an absolute distance that targets will be knocked back. If 1, the value is multiplied by the distance they would normally have been knocked back. Weapon knockback modifiers are applied in the order weapon -> attacker -> target, so a x2 weapon weilded by an abs 6 attacker hitting a /2 target will knock the target back 3 squares. The knockback functions will not override the stonewall perk or knockdowns resulting from criticals. knockback values set on weapons or critters are not saved, and must be reset each time the player reloads.

The get/set_sfall_global functions require an 8 character long case sensitive string for the variable name. The variables behave the same as normal fallout globals, except that they don't have to be declared beforehand in vault13.gam. Trying to get a variable which hasn't been set will always return 0. These functions are intended for use when a patch to a mod requires the addition of a new global variable, a case which would otherwise require the player to start a new game.

set_pickpocket_max and set_hit_chance_max effect all critters rather than just the player. set_skill_max can't be used to increase the skill cap above 300. set_perk_level_mod sets a modifier between +25 and -25 that is added/subtracted from the players level for the purposes of deciding which perks can be chosen.

inc_npc_level takes an npc name as an argument. The name is case sensitive, and the npc must be in your party. This function ignores player level requirements and the minimum 3 player level delay between npc level gains. It also ignores the random element, regardless of sfall's NPCAutoLevel setting.

get_ini_setting reads an integer value from an ini file in the fallout directory. It only takes a single argument; seperate the file name, section and key with a '|' character; e.g. 'myvar:=get_ini_setting("myini.ini|mysec|var1")' If the file or key cannot be found, -1 is returned. The file name is limited to 16 chars, including the extension. The section name is limited to 8 characters. It can also be used to get sfalls settings, by using ddraw.ini as the file name.

get_game_mode is a more flexible version of in_world_map. It will return a set of flags indicating which mode the game is currently in. These flags are the same as those used in the set_shader_mode function.

get_uptime is just a wrapper around the windows GetTickCount() function. It's useful for making time fade effects in shaders, since they already have access to the current tick count.

Quote
и как их правильно использовать?

Этот вопрос уже сложнее я разобрался только в некоторых функциях
изменить стат у чуза
set_pc_base_stat(номер статса, количество)
добавить стат у чуза
set_pc_extra_stat(номер статса, количество)

Это все тоже но для НПК
set_critter_base_stat(CritterPtr, int StatID, int value)
set_critter_extra_stat(CritterPtr, int StatID, int value)

Эти я пока не смотрел но вроде как должны задавать максимальное значение статса
0x81b4 - void set_stat_max(int stat, int value)
0x81b5 - void set_stat_min(int stat, int value)
0x81b7 - void set_pc_stat_max(int stat, int value)
0x81b8 - void set_pc_stat_min(int stat, int value)
0x81b9 - void set_npc_stat_max(int stat, int value)
0x81ba - void set_npc_stat_min(int stat, int value)

Возвращает текущий год
Я это использовал в пибое на интерфейсных функциях
0x8163 - int get_year()

Дать пипбой 0 нету пипбоя 1 есть пипбой
0x818b - void set_pipboy_available(int available)

Изменение перков задание описания, картинки и т.д
0x8178 - void set_perk_image(int perkID, int value)
0x8179 - void set_perk_ranks(int perkID, int value)
0x817a - void set_perk_level(int perkID, int value)
0x817b - void set_perk_stat(int perkID, int value)
0x817c - void set_perk_stat_mag(int perkID, int value)
0x817d - void set_perk_skill1(int perkID, int value)
0x817e - void set_perk_skill1_mag(int perkID, int value)
0x817f - void set_perk_type(int perkID, int value)
0x8180 - void set_perk_skill2(int perkID, int value)
0x8181 - void set_perk_skill2_mag(int perkID, int value)
0x8182 - void set_perk_str(int perkID, int value)
0x8183 - void set_perk_per(int perkID, int value)
0x8184 - void set_perk_end(int perkID, int value)
0x8185 - void set_perk_chr(int perkID, int value)
0x8196 - void set_perk_int(int perkID, int value)
0x8187 - void set_perk_agl(int perkID, int value)
0x8188 - void set_perk_lck(int perkID, int value)
0x8189 - void set_perk_name(int perkID, char* value)
0x818a - void set_perk_desc(int perkID, char* value)

Воспрянет Россия, из праха отцов
Расправятся крылья, миллионов сердец
Поднимут все головы и грудью вздохнут
И громка скажут, что пришли
Мы пришли, со столетней войны
Pages: [1] |   Go Up