[WB] Warband Script Enhancer v3.2.0 (21/07/2013)

Users who are viewing this thread

Status
Not open for further replies.
WSE is no longer being developed. Source code can be downloaded here.

WSE - Warband Script Enhancer v3.2.0 for Warband 1.153

What is the Warband Script Enhancer?
A program that enhances the Warband engine by adding operations/scripts/triggers and changing hardcoded game mechanics.
You can check my YouTube channel to see some features that have been/will be/could be added to WSE.

I'm not a modder, should I be using the Warband Script Enhancer?
Absolutely.
WSE fixes some engine bugs, including one that causes very frequent crashes. It also log crash data, so that the ones still present might be reported and fixed easily.
In addition to that, there are some integrated tools that you might find useful, like the memory optimizer.
If you're hosting a server under Wine you might want to use the Script Enhancer to avoid an engine bug that causes global variable corruption and other issues.


Downloads

WSE v3.2.0 (for Warband 1.153)
WSE v2.8.1 (for Warband 1.143)
WSEProfilerGUI v1.1 (graphical user interface for reading profiling logs)
MBSE Profiler v1.000 (profiler-only version for Mount&Blade 1.011 Enhanced Edition)


Installation

Users
1. Download WSE
2. Extract the files anywhere
3. Edit wse_settings.ini
4. Run WSELoader

Modders
1. Download WSE
2. Enhance the Module System with the files in the WSESDK directory (see README.txt for more information)
3. Package WSE in your mod download


Changelog:
v3.2.0
- Added loader option to change server window name
- Fixed an issue that caused scripts to execute incorrectly
- Fixed global variables being clamped to 32 bit


Previous versions
v3.1.5
- Fixed scene_set_* operations not working
- Added missile_remove_on_hit operation


v3.1.4
- Fixed WSE network events
- Fixed weapons becoming invisible


v3.1.3
- Fixed crashes and weird server behavior

v3.1.2
- Fixed composite message operations

v3.1.1
- Fixed a possible crash when starting a battle

v3.1.0
- Fixed several opcode clashes (store_trigger_param, all menu operations)
- Fixed use tooltips not working and causing crashes
- Added back ti_on_missile_dive and added more parameters to script_game_missile_dives_into_water (see WSESDK\module_scripts_addon.py)


v3.0.0
- Ported to 1.153
- Added operations timer_reset, timer_get_elapsed_time, options_get_realistic_headshots, options_set_realistic_headshots


v2.8.1
- Fixed str_sanitize removing certain Unicode characters

v2.8.0
- Fixed try_for_dict_keys and position_align_to_ground crashing the game under certain circumstances
- Fixed send_message_to_url_advanced calling the script with wrong parameters
- Added female frame support for boots
- Added operations prop_instance_set_vertex_keys_time_point, party_heal_members, process_advanced_url_messages, sleep_ms, player_set_banner_id


v2.7.1
- Fixed operation troop_set_skill not working correctly

v2.7.0
- Fixed get_server_option_at_connect not working for Steam users
- Added operation player_stop_controlling_agent


v2.6.2
- Added operations try_for_dict_keys, order_flag_is_active, play_bink_file

v2.6.1
- Fixed crash when calling operation get_server_option_at_connect
- Added triggers ti_on_agent_start_reloading, ti_on_agent_end_reloading


v2.6.0
- Fixed crash when running under newer Wine versions
- Added operations cast_ray, agent_ai_set_simple_behavior, presentation_activate, get_server_option_at_connect, close_order_menu, edit_mode_set_enabled, get_water_level, item_set_speed_rating, item_set_missile_speed


v2.5.2
- Added alternative library for CPUs without SSE2 support
- Improved library injection on Windows Vista/7
- Fixed a bug causing "invalid party" script errors
- Added operations position_align_to_ground, agent_set_horse


v2.5.1
- Improved Steam injection
- Fixed crash in wse_chat_message_received


v2.5.0
- Added operation feval (see EVAL_README.txt in WSESDK for more info)
- Added individual call info and color coding to profiler GUI


v2.4.8
- Added operation agent_ai_get_move_target_position

v2.4.7
- Fixed crash when using shader operations in FFP mode ("DirectX 7")

v2.4.6
- Fixed a possible chat-related crash

v2.4.5
- Removed set_max_players server console command player limit
- Added operations mtsrand, mtrand, get_time, update_material
- Fixed a crash with "Force single threading" enabled


v2.4.4
- Added some item operations for runtime stats changing

v2.4.3
- Improved Steam compatibility
- Fixed ping display in server list
- Fixed horse friendly fire on dedicated server
- Fixed module system error when using agent_get_scale


v2.4.2
- cRPG internal release

v2.4.1
- cRPG internal release

v2.4.0
- Improved loader compatibility with some systems
- Fixed items not being pruned when prune time explicitly set
- Fixed dropped items with high ids not being displayed correctly on clients (bug #3157, fix available only in non network compatible mode)
- Added operations stop_time, set_shader_param_int, set_shader_param_float, set_shader_param_vector, set_shader_param_matrix, prop_instance_set_variation_id, prop_instance_set_variation_id_2, cur_missile_get_path_point_position


v2.3.1
- Added module.ini setting allow_unset_script_params
- Fixed infinite loop while modifying a collection during iteration


v2.3.0
- Added "server friendly" loader (no UAC prompts, no GUI messages)
- Log additional information when crashing (operation block name, statement #, opcode)
- Added operations send_message_to_url_advanced, troop_set_skill, troop_set_attribute, troop_set_proficiency, scene_set_flags, scene_set_water_level, scene_set_bounds, scene_set_outer_terrain, scene_set_terrain_seed, scene_set_river_seed, scene_set_flora_seed, scene_set_deep_water, scene_set_place_river, scene_set_disable_grass, scene_set_valley_size, scene_set_hill_height, scene_set_ruggedness, scene_set_vegetation, scene_set_size, scene_set_region_type, scene_set_region_detail, edit_mode_in_edit_objects_mode, edit_mode_get_num_selected_prop_instances, edit_mode_get_selected_prop_instance, edit_mode_select_prop_instance, edit_mode_deselect_prop_instance, edit_mode_get_highlighted_prop_instance, edit_mode_set_highlighted_prop_instance
- Added item flags itp_show_body, itp_offset_flip
- Added advanced param to prop_instance_receive_damage


v2.2.0
- Use wse_settings.ini in module directory to override global settings
- Added position_get_vector_to_position, str_store_skill_name
- Added float operations
- Added item flags itp_offset_mortschlag, itp_offset_melee_firearm
- Fixed itp_unbalanced not working on alternative weapon modes (bug #3331)
- Fixed use_missile_damage_type not working properly
- Fixed position_rotate_z_floating when using global axis, add optional parameter use_global_axis to x and y rotation operations too


v2.1.0
- Added item/missile parameters to ti_on_scene_prop_hit (server only)
- Removed cur_missile_add_point_light and cur_missile_add_particle_system, improved particle_system_add_new and add_point_light to work in more cases (missiles included)
- Added operations particle_system_remove, key_released, game_key_released, get_camera_position, get_spectated_agent_no, set_forced_lod, prop_instance_set_forced_lod, agent_set_forced_lod


v2.0.0
- Changed versioning scheme
- Fixed dedicated server crashing under Wine
- Fixed a Warband bug where servers running under Wine would receive junk network data (leading to variable corruption and other issues)
- Improved crash logging
- Switched to new profiling file format (~4x smaller)
- Renamed ti_on_shield_receive_damage to ti_on_shield_hit, changed order of parameters and added agent/item/missile parameters
- Added item trigger ti_on_missile_dive
- Added operations agent_get_scale, game_key_get_key
- Added game script wse_window_opened (experimental)
- Use core resources from module if present (core_shaders.brf, core_textures.brf, core_materials.brf, core_ui_meshes.brf, core_pictures.brf)


v1901
- Really fixed try_for_prop_instances

v1900
- Fixed a bug that would result in wrong arguments being passed to some WSE scripts
- Fixed try_for_prop_instances ignoring the second parameter
- Added loader logging on failure
- Added crash logging
- Added party_has_flag, server_get_horse_friendly_fire, server_set_horse_friendly_fire, server_get_show_crosshair, server_set_show_crosshair, set_ally_collision_threshold, set_prop_collision_threshold, get_last_sound_channel, sound_channel_set_position
- Added module.ini directive use_missile_damage_type
- Added game script wse_get_agent_scale


v1840
- Fix bug that resulted in negative script params being set to 0
- Added str_store_game_variable


v1830
- Loader: ask for elevated privileges
- Fixed a crash that could randomly occur while using certain WSE operations
- Added prop_instance_add_particle_system, prop_instance_remove_particle_system


v1820
- Fixed loader giving wrong debug information in verbose mode
- Fixed agent_get_bone_position to give more accurate results
- Added set_show_use_tooltip


v1810
- Fixed try_for_active_players
- Added agent_get_wielded_item_slot_no, agent_get_bone_position


v1802
- Fixed Steam detection by registry

v1801
- Improved loader command line parsing
- Fixed some missing script errors


v1800
- Improved overall compatibility with Windows XP and Windows Server 2003
- Loader now tries to guess Warband path by reading the registry if Warband is not found in the current directory and no -p (--path) argument is provided
- Loader will now set the launcher default module if a -m (--module) argument is provided
- Load wse_settings.ini from the loader folder where is, not the Warband folder (for bundling with mods)
- Added memory optimizer (see wse_settings.ini for more information)
- Added operations break_loop, continue_loop, try_for_active_players, try_for_prop_instances, try_for_attached_parties, str_store_player_ip, overlay_get_val, troop_has_flag
- Added damage_type parameter to ti_on_agent_hit
- Added optional position and range parameters to try_for_agents, to efficiently loop over agents in an area
- Fixed a Warband crash that could occur when entering a scene (bug #3725)


v1703
- Added correct header_operations_addon.py file

v1702
- Fixed spawned scene props being pruned after 3 minutes

v1701
- Fixed critical bug with custom operations in Steam version

v1700
- Dropped support for Warband 1.134, added support for Warband 1.143
- Removed operations agent_get_sound_channel and agent_get_sound_duration, added sound_channel and sound_duration trigger params to ti_on_agent_play_sound
- Renamed operations get_cheat_mode, set_cheat_mode to options_get_cheat_mode, options_set_cheat_mode
- Added operations options_get_battle_size, options_set_battle_size, options_get_verbose_casualties, options_set_verbose_casualties, server_map_rotation_get_count, server_map_rotation_get_index, server_map_rotation_set_index, server_map_rotation_get_map, server_map_rotation_add_map, server_map_rotation_remove_map
- Added convenience operations to retrieve item values (item_get_head_armor, item_get_max_ammo, item_get_shield_width, item_has_flag...)
- Added item trigger ti_on_shield_receive_damage
- Added item trigger ti_on_init_item to horses, enabling tableau material (heraldry) support


v1600
- Disabled per-item animations until fixed
- Removed operation agent_set_cur_sound_frequency
- Simplified wse_settings.ini
- Fixed a WSE bug that caused party operations not to load
- Fixed an engine bug where using agent_play_sound inside ti_on_agent_spawn on the server would crash clients
- Fixed an engine bug where particle systems would disappear when not directly looking at their emit position
- Added hide_other_mod_servers setting to module.ini
- Added max_corpses to wse_settings.ini
- Added trigger ti_on_agent_play_sound
- Added operations player_set_skin, position_rotate_z_floating, camera_in_first_person, set_camera_in_first_person, get_cheat_mode, set_cheat_mode, agent_get_sound_channel, agent_get_sound_duration, sound_channel_stop, sound_channel_set_frequency, menu_create_new, menu_add_item, menu_clear_items, menu_clear_generated
- Removed value clamping from mission_cam_set_aperture
- Improved some error messages
- Improved behavior of loader when multiple Warband processes active


v1540
- Fixed operation face_keys_get_morph_key, face_keys_set_hair_color, face_keys_set_age
- Added operations agent_get_item_slot_ammo, agent_set_item_slot_ammo, agent_get_item_slot_hit_points, agent_set_item_slot_hit_points, face_keys_store_string
- Added shooting_agent_no and launcher_item_kind_no params to ti_on_init_missile


v1530
- Added trigger ti_on_init_missile
- Added operations agent_get_ground_scene_prop, cur_missile_add_particle_system, cur_missile_add_point_light


v1520
- Added trigger ti_on_scene_prop_stepped_on

v1511
- Moved network_compatible setting to module.ini to allow per-mod compatibility

v1510
- Added ground_weapon_collision setting to module.ini. If set to 1, melee weapons will collide with ground.
- Added operation spawn_missile


v1500
- Removed input (key) operations (can be done without WSE, see example)
- Profiling: items now display proper ids instead of (null)
- Fixed agent_unequip_item (unequipping armature)
- Fixed agent_equip_item (hair/beard when equipping helmets, bug with shields not being equipped)
- Fixed bug in quest_slot_gt (check if value is a valid quest, not a valid item kind)
- Added an optional item_modifier parameter to agent_equip_item
- Added core operations: store_current_trigger, return_values, store_num_return_values, store_return_value
- Added multiplayer operations: multiplayer_get_num_profiles, multiplayer_get_cur_profile, multiplayer_profile_get_face_keys, multiplayer_send_composite_message_to_player, multiplayer_send_composite_message_to_server, multiplayer_message_init, multiplayer_message_put_string, multiplayer_message_put_int, multiplayer_message_put_position, multiplayer_message_put_coordinate, multiplayer_message_put_face_keys, multiplayer_cur_message_get_string, multiplayer_cur_message_get_int, multiplayer_cur_message_get_position, multiplayer_cur_message_get_coordinate, multiplayer_cur_message_get_face_keys
- Added face key operations: face_keys_init, face_keys_copy, face_keys_get_hair, face_keys_set_hair, face_keys_get_beard, face_keys_set_beard, face_keys_get_face_texture, face_keys_set_face_texture, face_keys_get_hair_texture, face_keys_set_hair_texture, face_keys_get_hair_color, face_keys_set_hair_color, face_keys_get_age, face_keys_set_age, face_keys_get_morph_key, face_keys_set_morph_key
- Added troop operations: troop_get_face_keys, troop_set_face_keys
- Added item operations: item_has_faction
- Added player operations: player_get_face_keys, player_set_face_keys
- Added mission operations: store_cur_mission_template_no
- Added agent operations: agent_set_item_slot, agent_get_dna
- Added string operations: str_store_overlay_text, str_store_face_keys, str_store_profile_name, str_store_module_setting


v1400
- Internal version

v1300b1
- Fixed loader not recognizing some Steam executables

v1300
- Added Steam support
- Added operations prop_instance_clear_attached_missiles, set_default_item_prune_time, agent_get_animation_progress, party_stack_get_experience, party_stack_get_num_upgradeable
- Added trigger params to ti_on_agent_hit: raw_damage, bone_no, item_id, item_modifier, missile_item_id, missile_item_modifier
- Added operation (store_trigger_param, <destination>, <param_no>), extending amount of trigger params usable by WSE to 16


v1211
- Fixed agent operations not being marked as lhs
- Added operations troop_get_attribute_points, troop_set_attribute_points, troop_get_skill_points, troop_set_skill_points, troop_get_proficiency_points, troop_set_proficiency_points
- Enabled a linker optimization that was disabled for the dedicated server library


v1210
- Added gt and le slot operations
- Added agent_get_item_slot_modifier, agent_ai_get_look_target, agent_ai_get_move_target, agent_ai_get_behavior_target operations
- OGP: fixed SERVER player showing up as a regular player
- Fixed party_template_set_slot (#3432)
- Fixed internal operand boundary checks
- Minor changes and fixes to header_operations_addon.py file


v1201
- Fixed loader ignoring command line

v1200
- Added .ini file to allow enabling/disabling individual WSE features
- Added possibility to override individual item animations
- Added Open Game Protocol server
- Added profiling
- Added new operations: agent_get_item_modifier, dict_delete_file, item_get_weight, item_get_difficulty,
- Enhanced ti_on_agent_hit trigger
- Fixed a critical bug in the loader that would make it crash on non-Vista/7 machines (thanks to agrippa)
- Lots of internal changes (hopefully improving stability)


v1110
- New game script: wse_game_saved
- New bitwise operations: val_shr, store_shr (arithmetic right shift), val_lshr, store_lshr (logical right shift), val_shl, store_shl (left shift), val_xor, store_xor (exclusive or), val_not, store_not (complement)
- New string operation: str_sort


v1100
- Added string operations: str_split, str_store_join, str_store_replace_spaces_with_underscores, str_store_replace_underscores_with_spaces, str_store_server_password_admin, str_store_server_password_private.
- Added a string-indexed dictionary datatype that can be saved and loaded from files. Dict operations: dict_create, dict_free, dict_load_file, dict_load_dict, dict_save, dict_clear, dict_is_empty, dict_has_key, dict_get_size, dict_get_str, dict_get_int, dict_set_str, dict_set_int.
- Added network operations: multiplayer_send_chat_message_to_player, server_set_password_admin, server_set_password_private.
- Replaced server_set_max_num_players with a counterpart that handles Warband's 250 player limit properly.
- Internal changes.


v1041
- Fixed store_wse_version returning an older version number.
- Enabled some compiler optimizations (most likely no difference).


v1040
- Added str_compare and str_store_reverse operations.
- Added wse_console_command_received game script that will be executed when a command is entered on the dedicated server console (after parsing standard commands). See example #2.
- Changed all string operations from using cstring functions (strlen, strstr, _strlwr_s...) to ATL::CStringW to allow for UTF8 compatibility.
- Removed <max_replacements> parameter from str_replace to simplify logic.
- Renamed str_get_ascii to str_get_char (not all characters returned are ASCII).


v1030
- Added key operations (wse_key_is_down, wse_key_clicked, wse_key_get, wse_key_set, wse_key_clear)

v1020
- Added case insensitive parameter to string comparison functions (str_equals, str_contains, str_starts_with, str_ends_with).
- Added register_get and register_set operations. Example usage: looping over registers in script_game_receive_url_response.
- Added store_wse_version operation. Self-explanatory.
- Fixed trial mode check (wrong check at wrong location - can't get any worse).
- Bundled msvcp100.dll and msvcr100.dll. There should be no need to install the Visual C++ 2010 Redistributable Package anymore.


v1010
- WSE now refuses to start if the game is running in trial mode.
- String operations moved from plugin to core library.
- New string operations: str_get_ascii, str_to_int, str_is_alpha, str_is_digit, str_is_whitespace.
- Added error handling to operations.
- Lots of internal changes.


v1000b2
- Added -exe argument to loader. Can be used to specify Warband executable file (loader must still be in the same directory).
- Added -v/--verbose argument to loader. Displays some info that might be handy to track down errors.


v1000
- Initial version.


FAQ:

Who are you? I've never seen you. This seems fishy.
I'm a cRPG developer.

How do I know the executable is not a virus?
You don't. :smile:
Scan it, sandbox it, run it in virtual machine, whatever. If you don't want to run it then don't.

Isn't modifying/cracking game files illegal?
No game file is modified, at all.

Does this allow people who don't own Warband to play?
No.

When I try to run it, it says that a .dll file is missing.
Since version 1.020 there should be zero external dependencies. If you have unpacked the whole archive and still keep getting errors you can try installing the Microsoft Visual C++ 2012 Redistributable Package (x86).

My game crashes/shows weird errors.
Post here and paste the contents of the wse_log.txt and rgl_log.txt files in your game directory.

My log file has entries like WARNING: Unable to map WSE script code ...
Unless you're a modder, you can safely ignore warnings. It just means the current mod is not using all of WSE's features.

I want to add WSE to my mod. What do I do?
Add the required WSE files to your mod download. The latest version linked here might not be compatible with the one you used to compile the mod.


Credits:

- The cRPG team (aka donkey crew), for many ideas, support and being awesome in general
- Vincenzo, for the discussion that inspired me to create this tool
... and the countless modders who contributed with ideas and bug reports


External software:

- muParser
- Open Game Protocol


Disclaimer:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
This is so awesome and so useful! But It can be much more useful in the Forge - Mod Development. Thanks for sharing this.

Regards.
 
This thing is so awesome, I'm not sure where to start.

I hope for many patches and many added ops!
 
GetAssista said:
Woah!

How does it work internally?
1) the loader forces Warband to load the WSE library
2) in certain parts of the original code the WSE library redirects program flow to handler functions
3) lots of abstraction and c++ code
4) eventually program flow is redirected back into the original code (not necessarily in the same part)

Changing behavior of Warband functions requires lots of low-level work, while adding new operations is fairly trivial now that some sort of "framework" is in place. For example, the str_equals operation looks like this:
Code:
#include "WSEPluginAPI"

bool StringEquals(WSEScriptingContext *context)
{
	RglString str1, str2;
	
	context->GetString(str1, 0);
	context->GetString(str2, 1);

	return !strcmp(str1.text, str2.text);
}

//CUT: other operations

void WSEStringOperations::Init(WSEOperationProvider *provider)
{
	provider->RegisterOperation(2600, "str_equals", "Fails if <string_1> is not equal to <string_2>", StringEquals, Cf, 2, 2,
		"string_1", String, "string_2", String);

	//CUT: other operations
}
 
cmpxchg8b said:
2) in certain parts of the original code the WSE library redirects program flow to handler functions
3) lots of abstraction and c++ code
4) eventually program flow is redirected back into the original code (not necessarily in the same part)

Changing behavior of Warband functions requires lots of low-level work, while adding new operations is fairly trivial now that some sort of "framework" is in place.
Woah #2!  This is just awesome  :idea:
What kind of WB generated data do you have access to in #2? Can it be used for some more indepth actions like operating agents/props?
 
GetAssista said:
What kind of WB generated data do you have access to in #2? Can it be used for some more indepth actions like operating agents/props?
Technically, everything in the game can be accessed and modified. However, I must know the layout of data structures and memory addresses of methods.
I don't know much about either scene prop instances or agents yet, but it's only a matter of time (could be a very long time, though).
 
Sooo many things can be done with this...how does this work with a dedicated server though? You have to run WSELoader.exe first and than the .bat file (or the .exe if that's what you use) that runs the server? Or does the WSELoader.exe replace the dedicated server exe?
 
Arch3r said:
Sooo many things can be done with this...how does this work with a dedicated server though? You have to run WSELoader.exe first and than the .bat file (or the .exe if that's what you use) that runs the server? Or does the WSELoader.exe replace the dedicated server exe?
WSELoader.exe passes the command line to the dedicate server, so you only need to change the batch file (.bat) from:
Code:
mb_warband_dedicated.exe -r Sample_Battle.txt -m Native
to
Code:
WSELoader.exe -r Sample_Battle.txt -m Native
 
Update!
cmpxchg8b said:
v1010
- WSE now refuses to start if the game is running in trial mode
- String operations moved from plugin to core library
- New string operations: str_get_ascii, str_to_int, str_is_alpha, str_is_digit, str_is_whitespace
- Added error handling to operations
- Lots of internal changes
 
Fantastic stuff, cmpxchg8b.

The only possible downside is that I can't host a server with a server provider (e.g JestServers), because they won't allow custom .exe's to be run.. with good reason, I guess..

If it's not too much, maybe you could contact the owner of JestServers (seems like a cool guy) and make him include WSE with the standard files (mb_warband_dedicated.exe etc).

Edit
I sent them a support ticket regarding it and this is what they sent me back.
While I trust your work, we would need the Visual C++ requirement removed to test this out.
Hmm..
 
Theoris said:
Edit
I sent them a support ticket regarding it and this is what they sent me back.
While I trust your work, we would need the Visual C++ requirement removed to test this out.
Hmm..
The only parts of the Visual C++ redistributable package I need are the C runtime and the C++ standard library, but I can't remove those. However, as far as I know, Microsoft allows me to redistribute both libraries independently (as .dll files) without the need to install the whole package.
I'll give it a look, include them in the next version if possible.


On an unrelated note, I got a Steam version working, but I have to find a way to stop it from joining VAC (Valve Anti-Cheat) secured servers. It's not that big of a deal (there is no dedicated server for Steam, so the only VAC secured servers are listen servers), but as they say: better safe than sorry. :grin:
 
Status
Not open for further replies.
Back
Top Bottom