From 5578bbef71657c31f79e7e70cc7c766affbb1544 Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Tue, 1 Apr 2025 00:22:22 +0300 Subject: [PATCH 1/5] A lot of string/array related function stuff --- objects/obj_controller/Create_0.gml | 76 +++++++++---------- objects/obj_controller/Step_0.gml | 4 +- objects/obj_enunit/Draw_0.gml | 20 ++--- objects/obj_ncombat/Alarm_5.gml | 12 +-- .../scr_array_functions.gml | 41 +++++++++- .../scr_equipment_struct.gml | 11 +-- scripts/scr_management/scr_management.gml | 51 +++++++------ .../scr_punit_combat_heplers.gml | 14 +--- scripts/scr_roster/scr_roster.gml | 27 +++---- .../scr_string_functions.gml | 5 +- 10 files changed, 130 insertions(+), 131 deletions(-) diff --git a/objects/obj_controller/Create_0.gml b/objects/obj_controller/Create_0.gml index a6e453b82d..6d77b815a5 100644 --- a/objects/obj_controller/Create_0.gml +++ b/objects/obj_controller/Create_0.gml @@ -1534,12 +1534,12 @@ vih=string_pos(",",temp[njm]); temp[njm]=string_delete(temp[njm],vih,1); njm+=1; temp[njm] = "Specialist branches staffed by"; -if (techa > 0) then temp[njm] += $", {techa} {string_plural(obj_ini.role[100][16], techa)}"; -if (old_dudes > 0) then temp[njm] += $", {old_dudes} {string_plural(obj_ini.role[100][14], old_dudes)}"; -if (apotha > 0) then temp[njm] += $", {apotha} {string_plural(obj_ini.role[100][15], apotha)}"; -if (libra > 0) then temp[njm] += $", {libra} {string_plural(obj_ini.role[100,17], libra)}"; -if (coda > 0) then temp[njm] += $", {coda} {string_plural("Codiciery", coda)}"; -if (lexa > 0) then temp[njm] += $", {lexa} {string_plural("Lexicanum", lexa)}."; +if (techa > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; +if (old_dudes > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][14], old_dudes)}"; +if (apotha > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][15], apotha)}"; +if (libra > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100,17], libra)}"; +if (coda > 0) then temp[njm] += $", {string_plural_count("Codiciery", coda)}"; +if (lexa > 0) then temp[njm] += $", {string_plural_count("Lexicanum", lexa)}."; vih=string_pos(",",temp[njm]); temp[njm]=string_delete(temp[njm],vih,1); @@ -1608,30 +1608,30 @@ for(var company=0; company<10; company++){ else{temp[njm]="";} } - if (capt > 0) then temp[njm] += $", {capt} {string_plural(obj_ini.role[100][5], capt)}"; - if (chap > 0) then temp[njm] += $", {chap} {string_plural(obj_ini.role[100][14], chap)}"; - if (apoth > 0) then temp[njm] += $", {apoth} {string_plural(obj_ini.role[100][15], apoth)}"; - if (techa > 0) then temp[njm] += $", {techa} {string_plural(obj_ini.role[100][16], techa)}"; - if (standard > 0) then temp[njm] += $", {standard} {string_plural(obj_ini.role[100][11], standard)}"; - if (champ > 0) then temp[njm] += $", {champ} {string_plural(obj_ini.role[100][7], champ)}"; - if (lib > 0) then temp[njm] += $", {lib} {string_plural(obj_ini.role[100][17], lib)}"; - - if (serg > 0) then temp[njm] += $", {serg} {string_plural(obj_ini.role[100][18], serg)}"; - if (vet_serg > 0) then temp[njm] += $", {vet_serg} {string_plural(obj_ini.role[100][19], vet_serg)}"; - if (termi > 0) then temp[njm] += $", {termi} {string_plural(obj_ini.role[100][4], termi)}"; - if (veter > 0) then temp[njm] += $", {veter} {string_plural(obj_ini.role[100][3], veter)}"; - if (tact > 0) then temp[njm] += $", {tact} {string_plural(obj_ini.role[100][8], tact)}"; - if (assa > 0) then temp[njm] += $", {assa} {string_plural(obj_ini.role[100][10], assa)}"; - if (deva > 0) then temp[njm] += $", {deva} {string_plural(obj_ini.role[100][9], deva)}"; - if (scou > 0) then temp[njm] += $", {scou} {string_plural(obj_ini.role[100][12], scou)}"; - if (dread > 0) then temp[njm] += $", {dread} {string_plural(obj_ini.role[100][6], dread)}"; + if (capt > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][5], capt)}"; + if (chap > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][14], chap)}"; + if (apoth > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][15], apoth)}"; + if (techa > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][16], techa)}"; + if (standard > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][11], standard)}"; + if (champ > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][7], champ)}"; + if (lib > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][17], lib)}"; + + if (serg > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][18], serg)}"; + if (vet_serg > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][19], vet_serg)}"; + if (termi > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][4], termi)}"; + if (veter > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][3], veter)}"; + if (tact > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][8], tact)}"; + if (assa > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][10], assa)}"; + if (deva > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][9], deva)}"; + if (scou > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][12], scou)}"; + if (dread > 0) then temp[njm] += $", {string_plural_count(obj_ini.role[100][6], dread)}"; - if (raider > 0) then temp[njm] += $", {raider} {string_plural("Land Raider", raider)}"; - if (pred > 0) then temp[njm] += $", {pred} {string_plural("Predator", pred)}"; - if (whirl > 0) then temp[njm] += $", {whirl} {string_plural("Whirlwind", whirl)}"; - if (rhino > 0) then temp[njm] += $", {rhino} {string_plural("Rhino", rhino)}"; - if (speeder > 0) then temp[njm] += $", {speeder} {string_plural("Land Speeder", speeder)}"; - if (bike > 0) then temp[njm] += $", {bike} {string_plural("Attack Bike", bike)}"; + if (raider > 0) then temp[njm] += $", {string_plural_count("Land Raider", raider)}"; + if (pred > 0) then temp[njm] += $", {string_plural_count("Predator", pred)}"; + if (whirl > 0) then temp[njm] += $", {string_plural_count("Whirlwind", whirl)}"; + if (rhino > 0) then temp[njm] += $", {string_plural_count("Rhino", rhino)}"; + if (speeder > 0) then temp[njm] += $", {string_plural_count("Land Speeder", speeder)}"; + if (bike > 0) then temp[njm] += $", {string_plural_count("Attack Bike", bike)}"; if (string_length(temp[njm])>0) then temp[njm]+="."; @@ -1647,13 +1647,7 @@ temp[60] = $"{temp[59]}\n\n{temp[34]}\n\n{temp[35]}##{temp[36]}##{temp[37]}##{te temp[61]="\n\nYour armamentarium contains some spare equipment- \n"; -for(var u=0; u<=30; u++){ - if (obj_ini.equipment[u]!="") then temp[61]+=$"{obj_ini.equipment_number[u]} {string_plural(obj_ini.equipment[u], obj_ini.equipment_number[u])}, "; - if (obj_ini.equipment[u]=="") and (obj_ini.equipment[u-1]!=""){ - temp[61]=string_delete(temp[61],string_length(temp[61]),3); - temp[61]+="."; - } -} +temp[61] += arrays_to_string_with_counts(obj_ini.equipment, obj_ini.equipment_number, true, true); temp[62]="##Your fleet contains "; @@ -1685,7 +1679,7 @@ for(var mm=0; mm 0) { - temp[62] += $"{bb} {string_plural("Battle Barge")}: {array_to_string_order(bb_names)}."; + temp[62] += $"{string_plural_count("Battle Barge", bb)}: {array_to_string_order(bb_names, true)}"; temp[62] += "\n"; } if (sk > 0) { - temp[62] += $"{sk} {string_plural("Strike Cruiser")}: {array_to_string_order(sk_names)}."; + temp[62] += $"{string_plural_count("Strike Cruiser", sk)}: {array_to_string_order(sk_names, true)}"; temp[62] += "\n"; } if (glad > 0) { - temp[62] += $"{glad} {string_plural("Gladius Escort")}: {array_to_string_order(glad_names)}."; + temp[62] += $"{string_plural_count("Gladius Escort", glad)}: {array_to_string_order(glad_names, true)}"; temp[62] += "\n"; } if (hunt > 0) { - temp[62] += $"{hunt} {string_plural("Hunter Escort")}: {array_to_string_order(hunt_names)}."; + temp[62] += $"{string_plural_count("Hunter Escort", hunt)}: {array_to_string_order(hunt_names, true)}"; temp[62] += "\n"; } diff --git a/objects/obj_controller/Step_0.gml b/objects/obj_controller/Step_0.gml index 1b68f75d5a..37ef86d280 100644 --- a/objects/obj_controller/Step_0.gml +++ b/objects/obj_controller/Step_0.gml @@ -526,9 +526,7 @@ try { _tooltip += $"\nKnown Powers: "; for (var i = 0; i < _psy_powers_count; i++) { _tooltip += get_power_data(_psy_powers_known[i], "name"); - if (i < _psy_powers_count - 1) { - _tooltip += ", "; - } + _tooltip += smart_delimeter_sign(_psy_powers_count, i, false); } temp[123] = _tooltip; } diff --git a/objects/obj_enunit/Draw_0.gml b/objects/obj_enunit/Draw_0.gml index 791cfcc9ac..74022854ed 100644 --- a/objects/obj_enunit/Draw_0.gml +++ b/objects/obj_enunit/Draw_0.gml @@ -25,19 +25,18 @@ if (draw_size > 0){ if (obj_ncombat.enemy!=1){ composition_string += block_composition_string(); } else { - var variety, variety_num, stop, sofar, compl, vas; - stop = 0; + var variety, variety_num, sofar, compl; variety = []; variety_num = []; sofar = 0; compl = ""; - vas = ""; var variety_len = array_length(variety); for (var q = 0; q < variety_len; q++) { variety[q] = ""; variety_num[q] = 0; } + var dudes_len = array_length(dudes); for (var q = 0; q < dudes_len; q++) { if (dudes[q] != "") and(string_count(string(dudes[q]) + "|", compl) = 0) { @@ -47,6 +46,7 @@ if (draw_size > 0){ sofar += 1; } } + var dudes_len = array_length(dudes); for (var q = 0; q < dudes_len; q++) { if (dudes[q] != "") { @@ -55,19 +55,9 @@ if (draw_size > 0){ if (dudes[q] = variety[i]) then variety_num[i] += dudes_num[q]; } } - - } - stop = 0; - var variety_num_len = array_length(variety_num); - for (var i = 0; i < variety_num_len; i++) { - if (stop = 0) { - if (variety_num[i] > 0) and(variety_num[i + 1] > 0) then composition_string += string(variety_num[i]) + "x " + string(variety[i]) + ", "; - if (variety_num[i] > 0) and(variety_num[i + 1] <= 0) { - composition_string += string(variety_num[i]) + "x " + string(variety[i]) + ". "; - stop = 1; - } - } } + + _composition_string += arrays_to_string_with_counts(variety, variety_num, true); } } diff --git a/objects/obj_ncombat/Alarm_5.gml b/objects/obj_ncombat/Alarm_5.gml index 7a34ac3a8e..d70af4dcd8 100644 --- a/objects/obj_ncombat/Alarm_5.gml +++ b/objects/obj_ncombat/Alarm_5.gml @@ -100,7 +100,7 @@ if (_total_deaths > 0 || injured > 0 || units_saved > 0) { scr_newtext(); if (units_saved > 0) { - newline = $"{units_saved}x were saved by the {string_plural(roles[eROLE.Apothecary])}."; + newline = $"{units_saved}x were saved by the {string_plural(roles[eROLE.Apothecary], apothecaries_alive)}."; scr_newtext(); } if (injured > 0) { @@ -207,15 +207,9 @@ if (vehicle_deaths > 0) { if (post_equipment_lost[1]!=""){ part6="Equipment Lost: "; - var i=0; - for (var i=0;i0){ - part7+=string(post_equipments_lost[i])+"x "+string(post_equipment_lost[i])+", "; - } - } - part7=string_delete(part7,string_length(part7)-1,2);part7+=".";i=0; + part7 += arrays_to_string_with_counts(post_equipment_lost, post_equipments_lost, true, false); if (ground_mission){ - part7 += "Some may be recoverable" + part7 += " Some may be recoverable." } newline=part6; scr_newtext(); diff --git a/scripts/scr_array_functions/scr_array_functions.gml b/scripts/scr_array_functions/scr_array_functions.gml index a05669a226..cc0a45028b 100644 --- a/scripts/scr_array_functions/scr_array_functions.gml +++ b/scripts/scr_array_functions/scr_array_functions.gml @@ -98,7 +98,7 @@ function array_to_string_list(_array, _pop_last = false) { /// @description Converts an array into a string, with "," after each member and "and" before the last one. /// @param {array} _strings_array An array of strings. /// @return {string} -function array_to_string_order(_strings_array) { +function array_to_string_order(_strings_array, _use_and = false, _dot_end = true) { var result = ""; var length = array_length(_strings_array); @@ -110,16 +110,35 @@ function array_to_string_order(_strings_array) { // Check if it's the last string if (i < length - 1) { // If it's the second last item, add " and " before the last one - if (i == length - 2) { + if (_use_and && i == length - 2) { result += " and "; } else { result += ", "; } - } + } else if (_dot_end) { + result += "."; + } } return result; } + + +function arrays_to_string_with_counts(_names_array, _counts_array, _exclude_null = false, _dot_end = true) { + var _array_length = array_length(_names_array); + var _result_string = ""; + + for(var i = 0; i < _array_length; i++) { + if (_exclude_null && _counts_array[i] == 0) { + continue; + } + _result_string += string_plural_count(_names_array[i], _counts_array[i]); + _result_string += smart_delimeter_sign(_array_length, i, _dot_end); + } + + return _result_string; +} + /// @function alter_deep_array /// @description Modifies a value in a deeply nested array structure. /// @param {array} array The array to modify @@ -148,3 +167,19 @@ function fetch_deep_array(array, accessors){ return _array_step; } +/// @description Choose either `.` or `,` based on the array lengh and current loop iteration. +/// @param {array|real} _array_or_length +/// @param {real} _loop_iteration +/// @return {string} +function smart_delimeter_sign(_array_or_length, _loop_iteration, _dot_end = true) { + var _delimeter = ""; + var _array_length = is_array(_array_or_length) ? array_length(_array_or_length) : _array_or_length; + + if (_loop_iteration < _array_length - 1) { + _delimeter += ", "; + } else if (_dot_end) { + _delimeter += "."; + } + + return _delimeter; +} diff --git a/scripts/scr_equipment_struct/scr_equipment_struct.gml b/scripts/scr_equipment_struct/scr_equipment_struct.gml index bce149a477..b4b673d841 100644 --- a/scripts/scr_equipment_struct/scr_equipment_struct.gml +++ b/scripts/scr_equipment_struct/scr_equipment_struct.gml @@ -194,14 +194,9 @@ function EquipmentStruct(item_data, core_type, quality_request = "none") constru } } - if (array_length(special_properties_array) > 0) { - var special_properties_string = ""; - for (var j = 0; j < array_length(special_properties_array); j++) { - special_properties_string += special_properties_array[j]; - if (j < array_length(special_properties_array) - 1) { - special_properties_string += ", "; - } - } + var _array_length = array_length(special_properties_array); + if (_array_length > 0) { + var special_properties_string = array_to_string_order(special_properties_array, false, false); item_desc_tooltip += $"#Properties:#{special_properties_string}#"; } break; diff --git a/scripts/scr_management/scr_management.gml b/scripts/scr_management/scr_management.gml index ac3185840d..29be26f17c 100644 --- a/scripts/scr_management/scr_management.gml +++ b/scripts/scr_management/scr_management.gml @@ -121,14 +121,16 @@ function scr_management(argument0) { if (num[1]>0){ q++; obj_managment_panel.line[q]=string(nam[1]); - obj_managment_panel.italic[q]=1; obj_managment_panel.bold[q]=1; + // obj_managment_panel.italic[q]=1; + obj_managment_panel.bold[q]=1; } if (num[2]>0){ q++; - obj_managment_panel.line[q]=string(num[2])+"x "+string(nam[2]); + obj_managment_panel.line[q]=string_plural_count(nam[2], num[2], false); } - obj_managment_panel.italic[1]=1; obj_managment_panel.bold[q]=1; + // obj_managment_panel.italic[1]=1; + obj_managment_panel.bold[q]=1; instance_activate_object(obj_managment_panel); // ll=0;ll2=0;repeat(200){ll2++;if (obj_ini.role[company,ll2]=role_names[eROLE.HonourGuard]) then ll++;} @@ -166,15 +168,16 @@ function scr_management(argument0) { if (num[1]>0){ q++;obj_managment_panel.line[q]=string(nam[1]); - obj_managment_panel.italic[q]=1; obj_managment_panel.bold[q]=1; + // obj_managment_panel.italic[q]=1; + obj_managment_panel.bold[q]=1; } if (num[2]>0){ q++; - obj_managment_panel.line[q]=string(num[2])+"x "+string(nam[2]); + obj_managment_panel.line[q]=string_plural_count(nam[2], num[2], false); } if (num[3]>0){ q++; - obj_managment_panel.line[q]=string(num[3])+"x "+string(nam[3]); + obj_managment_panel.line[q]=string_plural_count(nam[3], num[3], false); } // if (num[4]>0){q++;obj_managment_panel.line[q]=string(num[4])+"x "+string(nam[4]);} instance_activate_object(obj_managment_panel); @@ -211,7 +214,8 @@ function scr_management(argument0) { if (num[1]>0){ q++; obj_managment_panel.line[q]=string(nam[1]); - obj_managment_panel.italic[q]=1; obj_managment_panel.bold[q]=1; + // obj_managment_panel.italic[q]=1; + obj_managment_panel.bold[q]=1; } // TODO add specific Space Wolves and successor chapter logic for Master of Sanctity @@ -221,11 +225,11 @@ function scr_management(argument0) { if (chapter_name!="Iron Hands"){ if (num[2]>0){ q++; - obj_managment_panel.line[q]=string(num[2])+"x "+string(nam[2]); + obj_managment_panel.line[q]=string_plural_count(nam[2], num[2], false); } if (num[3]>0){ q++; - obj_managment_panel.line[q]=string(num[3])+"x "+string(nam[3]); + obj_managment_panel.line[q]=string_plural_count(nam[3], num[3], false); } } instance_activate_object(obj_managment_panel); @@ -267,22 +271,23 @@ function scr_management(argument0) { if (num[1]>0){ q++; obj_managment_panel.line[q]=string(nam[1]); - obj_managment_panel.italic[q]=1; obj_managment_panel.bold[q]=1; + // obj_managment_panel.italic[q]=1; + obj_managment_panel.bold[q]=1; } if (num[2]>0){ q++; - obj_managment_panel.line[q]=string(num[2])+"x "+string(nam[2]); + obj_managment_panel.line[q]=string_plural_count(nam[2], num[2], false); } if (num[3]>0){ q++; - obj_managment_panel.line[q]=string(num[3])+"x "+string(nam[3]); + obj_managment_panel.line[q]=string_plural_count(nam[3], num[3], false); } if (num[4]>0){ q++; - obj_managment_panel.line[q]=string(num[4])+"x "+string(nam[4]); + obj_managment_panel.line[q]=string_plural_count(nam[4], num[4], false); } instance_activate_object(obj_managment_panel); @@ -323,27 +328,29 @@ function scr_management(argument0) { if (num[1]>0){ q++; - obj_managment_panel.line[q]=string(nam[1]);obj_managment_panel.italic[q]=1; obj_managment_panel.bold[q]=1; + obj_managment_panel.line[q]=string(nam[1]); + // obj_managment_panel.italic[q]=1; + obj_managment_panel.bold[q]=1; } if (num[2]>0){ q++; - obj_managment_panel.line[q]=string(num[2])+"x "+string(nam[2]); + obj_managment_panel.line[q]=string_plural_count(nam[2], num[2], false); } if (num[3]>0){ q++; - obj_managment_panel.line[q]=string(num[3])+"x "+string(nam[3]); + obj_managment_panel.line[q]=string_plural_count(nam[3], num[3], false); } if (num[4]>0){ q++; - obj_managment_panel.line[q]=string(num[4])+"x "+string(nam[4]); + obj_managment_panel.line[q]=string_plural_count(nam[4], num[4], false); } if (num[5]>0){ q++; - obj_managment_panel.line[q]=string(num[5])+"x "+string(nam[5]); + obj_managment_panel.line[q]=string_plural_count(nam[5], num[5], false); } instance_activate_object(obj_managment_panel); @@ -429,12 +436,10 @@ function scr_management(argument0) { q += 1; if (d == 1) { obj_managment_panel.line[q] = string(nam[d]); - obj_managment_panel.italic[q] = 1; + // obj_managment_panel.italic[q] = 1; obj_managment_panel.bold[q] = 1; - } else if (num[d] > 1){ - obj_managment_panel.line[q] = string(num[d]) + " " + string_plural(nam[d]); - } else{ - obj_managment_panel.line[q] = string(nam[d]); + } else { + obj_managment_panel.line[q] = string_plural_count(nam[d], num[d], false); } } } diff --git a/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml b/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml index 85a685e60a..b205db3637 100644 --- a/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml +++ b/scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml @@ -258,18 +258,8 @@ function block_composition_string() { } _composition_string += $"\n"; - var dudes_len = array_length(dudes_num); - for(var i = 0; i < dudes_len; i++) { - if (dudes_num[i] == 0) { - continue; - } - _composition_string += $"{dudes_num[i]}x {dudes[i]}"; - if (i < dudes_len - 1) { - _composition_string += ", "; - } else { - _composition_string += ". "; - } - } + + _composition_string += arrays_to_string_with_counts(dudes, dudes_num, true, false); return _composition_string; } diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index bc6963ab28..8ec31140e0 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -39,11 +39,10 @@ function Roster() constructor{ var _roster_types = struct_get_names(selected_roster); for (var i=0;i Date: Tue, 1 Apr 2025 01:08:46 +0300 Subject: [PATCH 2/5] Fix roster strings --- scripts/scr_roster/scr_roster.gml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index 8ec31140e0..cd034b19bb 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -217,9 +217,10 @@ function Roster() constructor{ var _roster_type_name = _roster_types[i]; var _roster_type_count = selected_roster[$_roster_type_name]; - roster_string += $"{string_plural_count(_roster_type_name, _roster_type_count)}"; - roster_string += smart_delimeter_sign(_roster_types, i, false); + roster_local_string += $"{string_plural_count(_roster_type_name, _roster_type_count)}"; + roster_local_string += smart_delimeter_sign(_roster_types, i, false); } + roster_local_string+="\n" roster_local_string += "Remaining\n"; var _roster_types = struct_get_names(possible_local_roster); @@ -227,8 +228,8 @@ function Roster() constructor{ var _roster_type_name = _roster_types[i]; var _roster_type_count = selected_roster[$_roster_type_name]; - roster_string += $"{string_plural_count(_roster_type_name, _roster_type_count)}"; - roster_string += smart_delimeter_sign(_roster_types, i, false); + roster_local_string += $"{string_plural_count(_roster_type_name, _roster_type_count)}"; + roster_local_string += smart_delimeter_sign(_roster_types, i, false); } } From 8ef11bf910770eb8f2bbbcb41956ccf4c1d40bdc Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Tue, 1 Apr 2025 01:20:48 +0300 Subject: [PATCH 3/5] Recovery battlelog improvments --- objects/obj_ncombat/Alarm_3.gml | 2 +- objects/obj_ncombat/Alarm_5.gml | 100 +++++++++++++----- objects/obj_ncombat/Create_0.gml | 7 +- scripts/scr_after_combat/scr_after_combat.gml | 7 +- 4 files changed, 84 insertions(+), 32 deletions(-) diff --git a/objects/obj_ncombat/Alarm_3.gml b/objects/obj_ncombat/Alarm_3.gml index 8c1092dcf2..2fc932d6d9 100644 --- a/objects/obj_ncombat/Alarm_3.gml +++ b/objects/obj_ncombat/Alarm_3.gml @@ -94,7 +94,7 @@ if ((messages>0) and (messages_shown<24)) and (messages_shown<=100){ newline=message[that]; if (message_priority[that]>0) then newline_color="bright"; if (string_count("lost",newline)>0) then newline_color="red"; - if (string_count("critically injured",newline)>0) then newline_color="red"; + if (string_count("critically damaged",newline)>0) then newline_color="red"; if (string_count("^",newline)>0){ newline=string_replace(newline,"^",""); newline_color="white"; diff --git a/objects/obj_ncombat/Alarm_5.gml b/objects/obj_ncombat/Alarm_5.gml index d70af4dcd8..5265b78880 100644 --- a/objects/obj_ncombat/Alarm_5.gml +++ b/objects/obj_ncombat/Alarm_5.gml @@ -34,6 +34,7 @@ if (obj_ncombat.defeat == 0) { var _column_id = _candidate.column_id; var _unit_id = _candidate.id; var _unit = _candidate.unit; + var _unit_role = _unit.role(); var _constitution_test_mod = _unit.hp() * -1; var _constitution_test = global.character_tester.standard_test(_unit, "constitution", _constitution_test_mod); @@ -41,7 +42,13 @@ if (obj_ncombat.defeat == 0) { _unit.update_health(_constitution_test[1]); _column_id.marine_dead[_unit_id] = false; unit_recovery_score--; - units_saved++; + units_saved_count++; + + if (!struct_exists(obj_ncombat.units_saved_counts, _unit_role)) { + obj_ncombat.units_saved_counts[$ _unit_role] = 1; + } else { + obj_ncombat.units_saved_counts[$ _unit_role]++; + } continue; } @@ -64,15 +71,22 @@ if (obj_ncombat.defeat == 0) { var _candidate = ds_priority_delete_max(vehicles_to_recover); var _column_id = _candidate.column_id; var _vehicle_id = _candidate.id; + var _vehicle_type = _column_id.veh_type[_vehicle_id]; if (obj_controller.stc_bonus[3] = 4) { - var _survival_roll = 80 + _candidate.priority; + var _survival_roll = 70 + _candidate.priority; var _dice_roll = roll_dice(1, 100, "high"); if (_dice_roll >= _survival_roll) && (_column_id.veh_dead[_vehicle_id] != 2) { _column_id.veh_hp[_vehicle_id] = roll_dice(1, 10, "high"); _column_id.veh_dead[_vehicle_id] = false; - vehicles_saved++; + vehicles_saved_count++; vehicle_deaths--; + + if (!struct_exists(obj_ncombat.vehicles_saved_counts, _vehicle_type)) { + obj_ncombat.vehicles_saved_counts[$ _vehicle_type] = 1; + } else { + obj_ncombat.vehicles_saved_counts[$ _vehicle_type]++; + } continue; } } @@ -81,8 +95,14 @@ if (obj_ncombat.defeat == 0) { _column_id.veh_hp[_vehicle_id] = roll_dice(1, 10, "high"); _column_id.veh_dead[_vehicle_id] = false; vehicle_recovery_score -= _candidate.priority; - vehicles_saved++; + vehicles_saved_count++; vehicle_deaths--; + + if (!struct_exists(obj_ncombat.vehicles_saved_counts, _vehicle_type)) { + obj_ncombat.vehicles_saved_counts[$ _vehicle_type] = 1; + } else { + obj_ncombat.vehicles_saved_counts[$ _vehicle_type]++; + } } } ds_priority_destroy(vehicles_to_recover); @@ -94,15 +114,26 @@ with (obj_pnunit) { } var _total_deaths = final_marine_deaths + final_command_deaths; -if (_total_deaths > 0 || injured > 0 || units_saved > 0) { - newline = $"{_total_deaths + injured + units_saved}x units were critically injured."; +if (_total_deaths > 0 || injured > 0 || units_saved_count > 0) { + newline = $"{_total_deaths + injured + units_saved_count}x units were critically injured."; newline_color = "red"; scr_newtext(); - if (units_saved > 0) { - newline = $"{units_saved}x were saved by the {string_plural(roles[eROLE.Apothecary], apothecaries_alive)}."; + if (units_saved_count > 0) { + var _units_saved_string = ""; + var _unit_roles = struct_get_names(units_saved_counts); + + for (var i = 0; i < array_length(_unit_roles); i++) { + var _unit_role = _unit_roles[i]; + var _saved_count = units_saved_counts[$ _unit_role]; + _units_saved_string += $"{string_plural_count(_unit_role, _saved_count)}"; + _units_saved_string += smart_delimeter_sign(_unit_roles, i, false); + } + + newline = $"{units_saved_count}x were saved by the {string_plural(roles[eROLE.Apothecary], apothecaries_alive)}. ({_units_saved_string})"; scr_newtext(); } + if (injured > 0) { newline = $"{injured}x survived thanks to the Sus-an Membrane."; newline_color = "red"; @@ -110,21 +141,22 @@ if (_total_deaths > 0 || injured > 0 || units_saved > 0) { } if (_total_deaths > 0) { - newline = $"{_total_deaths}x units succumbed to their wounds!"; + var _units_lost_string = ""; var _unit_roles = struct_get_names(units_lost_counts); for (var i = 0; i < array_length(_unit_roles); i++) { var _unit_role = _unit_roles[i]; var _lost_count = units_lost_counts[$ _unit_role]; - newline += $" {_lost_count}x {_unit_role}"; - if (i < array_length(_unit_roles) - 1) { - newline += ","; - } else { - newline += "."; - } + _units_lost_string += $"{string_plural_count(_unit_role, _lost_count)}"; + _units_lost_string += smart_delimeter_sign(_unit_roles, i, false); } - newline_color = "red"; + newline += $"{_total_deaths} units succumbed to their wounds! ({_units_lost_string})"; + newline_color="red"; scr_newtext(); + } + + newline = " "; + scr_newtext(); } @@ -176,28 +208,42 @@ scr_newtext(); -if (vehicles_saved > 0) { - newline = $"{string_plural(roles[eROLE.Techmarine], techmarines_alive)} were able to recover {vehicles_saved} vehicles."; +if (vehicles_saved_count > 0 || vehicle_deaths > 0) { + newline = $"{string_plural_count("Vehicle", vehicle_deaths + vehicles_saved_count)} were critically damaged during battle."; + newline_color="red"; scr_newtext(); -} -if (vehicle_deaths > 0) { - newline = $"Vehicles Lost: {vehicle_deaths}."; + if (vehicles_saved_count > 0) { + var _vehicles_saved_string = ""; + var _vehicle_types = struct_get_names(vehicles_saved_counts); + + for (var i = 0; i < array_length(_vehicle_types); i++) { + var _vehicle_type = _vehicle_types[i]; + var _saved_count = vehicles_saved_counts[$ _vehicle_type]; + _vehicles_saved_string += $"{string_plural_count(_vehicle_type, _saved_count)}"; + _vehicles_saved_string += smart_delimeter_sign(_vehicle_types, i, false); + } + + newline = $"{string_plural(roles[eROLE.Techmarine], techmarines_alive)} were able to restore {vehicles_saved_count}. ({_vehicles_saved_string})"; + scr_newtext(); + } + if (vehicle_deaths > 0) { + var _vehicles_lost_string = ""; var _vehicle_types = struct_get_names(vehicles_lost_counts); + for (var i = 0; i < array_length(_vehicle_types); i++) { var _vehicle_type = _vehicle_types[i]; var _lost_count = vehicles_lost_counts[$ _vehicle_type]; - newline += $" {_lost_count}x {_vehicle_type}"; - if (i < array_length(_vehicle_types) - 1) { - newline += ","; - } else { - newline += "."; + _vehicles_lost_string += $"{string_plural_count(_vehicle_type, _lost_count)}"; + _vehicles_lost_string += smart_delimeter_sign(_vehicle_types, i, false); } - } + newline += $"{vehicle_deaths} were lost forever. ({_vehicles_lost_string})"; newline_color="red"; scr_newtext(); + } + newline = " "; scr_newtext(); } diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index 4a35ae7b2a..3f1e52cbd7 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -147,9 +147,12 @@ injured=0; command_injured=0; seed_saved=0; seed_max=0; -units_saved=0; +units_saved_count=0; +units_saved_counts={}; +vehicles_saved_counts={}; command_saved=0; -vehicles_saved=0; +vehicles_saved_count=0; +vehicles_saved_counts={}; final_marine_deaths=0; final_command_deaths=0; vehicle_deaths=0; diff --git a/scripts/scr_after_combat/scr_after_combat.gml b/scripts/scr_after_combat/scr_after_combat.gml index f7b602e8f6..42de7df0cd 100644 --- a/scripts/scr_after_combat/scr_after_combat.gml +++ b/scripts/scr_after_combat/scr_after_combat.gml @@ -74,7 +74,7 @@ function add_vehicles_to_recovery() { } for (var i = 0; i < array_length(veh_dead); i++) { - if (veh_dead[i]) && (!veh_ally[i]) { + if (veh_dead[i] && !veh_ally[i] && veh_type[i] != "") { var _priority = 1; if (struct_exists(_vehicles_priority, veh_type[i])) { _priority = _vehicles_priority[$ veh_type[i]]; @@ -202,18 +202,21 @@ function after_battle_part2() { var _birthday = obj_ini.age[marine_co[i], marine_id[i]]; var _current_year = (obj_controller.millenium * 1000) + obj_controller.year; var _harvestable_seed = 0; + var _total_seed = 0; if (_birthday <= (_current_year - 10) && obj_ini.zygote == 0) { + _total_seed++; if (irandom_range(1, 20) > 1) { _harvestable_seed++; } } if (_birthday <= (_current_year - 5)) { + _total_seed++; if (irandom_range(1, 20) > 1) { _harvestable_seed++; } } - obj_ncombat.seed_max += _harvestable_seed; + obj_ncombat.seed_max += _total_seed; } var last=0; From 0ec4930b1ff4e51e2138b8824b932eac969314eb Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Tue, 1 Apr 2025 01:51:58 +0300 Subject: [PATCH 4/5] Minor gene-seed recovery alteration and string improvments --- objects/obj_ncombat/Alarm_5.gml | 73 +++++++++---------- objects/obj_ncombat/Create_0.gml | 3 +- objects/obj_p_assra/Alarm_0.gml | 8 +- scripts/scr_after_combat/scr_after_combat.gml | 20 ++--- scripts/scr_roster/scr_roster.gml | 2 +- .../scr_string_functions.gml | 29 ++++++++ 6 files changed, 81 insertions(+), 54 deletions(-) diff --git a/objects/obj_ncombat/Alarm_5.gml b/objects/obj_ncombat/Alarm_5.gml index 5265b78880..9013944a67 100644 --- a/objects/obj_ncombat/Alarm_5.gml +++ b/objects/obj_ncombat/Alarm_5.gml @@ -80,7 +80,6 @@ if (obj_ncombat.defeat == 0) { _column_id.veh_hp[_vehicle_id] = roll_dice(1, 10, "high"); _column_id.veh_dead[_vehicle_id] = false; vehicles_saved_count++; - vehicle_deaths--; if (!struct_exists(obj_ncombat.vehicles_saved_counts, _vehicle_type)) { obj_ncombat.vehicles_saved_counts[$ _vehicle_type] = 1; @@ -96,7 +95,6 @@ if (obj_ncombat.defeat == 0) { _column_id.veh_dead[_vehicle_id] = false; vehicle_recovery_score -= _candidate.priority; vehicles_saved_count++; - vehicle_deaths--; if (!struct_exists(obj_ncombat.vehicles_saved_counts, _vehicle_type)) { obj_ncombat.vehicles_saved_counts[$ _vehicle_type] = 1; @@ -114,8 +112,9 @@ with (obj_pnunit) { } var _total_deaths = final_marine_deaths + final_command_deaths; -if (_total_deaths > 0 || injured > 0 || units_saved_count > 0) { - newline = $"{_total_deaths + injured + units_saved_count}x units were critically injured."; +var _total_injured = _total_deaths + injured + units_saved_count; +if (_total_injured > 0) { + newline = $"{string_plural_count("unit", _total_injured)} {smart_verb("was", _total_injured)} critically injured."; newline_color = "red"; scr_newtext(); @@ -130,7 +129,7 @@ if (_total_deaths > 0 || injured > 0 || units_saved_count > 0) { _units_saved_string += smart_delimeter_sign(_unit_roles, i, false); } - newline = $"{units_saved_count}x were saved by the {string_plural(roles[eROLE.Apothecary], apothecaries_alive)}. ({_units_saved_string})"; + newline = $"{units_saved_count}x {smart_verb("was", units_saved_count)} saved by the {string_plural(roles[eROLE.Apothecary], apothecaries_alive)}. ({_units_saved_string})"; scr_newtext(); } @@ -156,7 +155,7 @@ if (_total_deaths > 0 || injured > 0 || units_saved_count > 0) { } newline = " "; - scr_newtext(); + scr_newtext(); } @@ -166,31 +165,27 @@ if (ground_mission){ } }; -seed_saved = (min(seed_max, apothecaries_alive * 40)); -if (obj_ini.doomed) then seed_saved=0; -if (seed_saved>0) then obj_controller.gene_seed+=seed_saved; +if (seed_lost > 0) { + if (obj_ini.doomed) { + newline = $"Chapter mutation prevents retrieving gene-seed. {seed_lost} gene-seed lost."; + scr_newtext(); + } else if (!apothecaries_alive) { + newline = $"No able-bodied {roles[eROLE.Apothecary]}. {seed_lost} gene-seed lost."; + scr_newtext(); + } else { + seed_saved = min(seed_harvestable, apothecaries_alive * 40); + newline = $"{seed_saved} gene-seed was recovered; {seed_lost - seed_harvestable} was lost due damage; {seed_harvestable - seed_saved} was left to rot;"; + scr_newtext(); + } -if (obj_ini.doomed && !apothecaries_alive){ - part3=$"Chapter Mutation prevents retrieving Gene-Seed. {seed_max} Gene-Seed lost."; - newline=part3; - scr_newtext(); - newline=" "; - scr_newtext(); -}else if (!apothecaries_alive && !obj_ini.doomed){ - part3=$"No able-bodied {roles[eROLE.Apothecary]}. {seed_max} Gene-Seed lost."; - newline=part3;scr_newtext(); - newline=" ";scr_newtext(); -}else if (apothecaries_alive>0 && final_marine_deaths+final_command_deaths>0 && !obj_ini.doomed){ - part3=$"Gene-Seed Recovered: {seed_saved}("; - part3 += seed_saved ? $"{round((seed_saved/seed_max)*100)}" : "0"; - part3 += "%)"; - newline=part3; - scr_newtext(); - newline=" "; + if (seed_saved > 0) { + obj_controller.gene_seed += seed_saved; + } + + newline = " "; scr_newtext(); } - if (red_thirst>2){ var voodoo=""; @@ -207,9 +202,9 @@ newline = " "; scr_newtext(); - -if (vehicles_saved_count > 0 || vehicle_deaths > 0) { - newline = $"{string_plural_count("Vehicle", vehicle_deaths + vehicles_saved_count)} were critically damaged during battle."; +var _total_damaged_count = vehicle_deaths + vehicles_saved_count; +if (_total_damaged_count > 0) { + newline = $"{string_plural_count("vehicle", _total_damaged_count)} {smart_verb("was", _total_damaged_count)} critically damaged during battle."; newline_color="red"; scr_newtext(); @@ -224,24 +219,24 @@ if (vehicles_saved_count > 0 || vehicle_deaths > 0) { _vehicles_saved_string += smart_delimeter_sign(_vehicle_types, i, false); } - newline = $"{string_plural(roles[eROLE.Techmarine], techmarines_alive)} were able to restore {vehicles_saved_count}. ({_vehicles_saved_string})"; + newline = $"{string_plural(roles[eROLE.Techmarine], techmarines_alive)} {smart_verb("was", techmarines_alive)} able to restore {vehicles_saved_count}. ({_vehicles_saved_string})"; scr_newtext(); } if (vehicle_deaths > 0) { var _vehicles_lost_string = ""; - var _vehicle_types = struct_get_names(vehicles_lost_counts); + var _vehicle_types = struct_get_names(vehicles_lost_counts); - for (var i = 0; i < array_length(_vehicle_types); i++) { - var _vehicle_type = _vehicle_types[i]; - var _lost_count = vehicles_lost_counts[$ _vehicle_type]; + for (var i = 0; i < array_length(_vehicle_types); i++) { + var _vehicle_type = _vehicle_types[i]; + var _lost_count = vehicles_lost_counts[$ _vehicle_type]; _vehicles_lost_string += $"{string_plural_count(_vehicle_type, _lost_count)}"; _vehicles_lost_string += smart_delimeter_sign(_vehicle_types, i, false); } - newline += $"{vehicle_deaths} were lost forever. ({_vehicles_lost_string})"; - newline_color="red"; - scr_newtext(); + newline += $"{vehicle_deaths} {smart_verb("was", vehicle_deaths)} lost forever. ({_vehicles_lost_string})"; + newline_color="red"; + scr_newtext(); } newline = " "; @@ -915,7 +910,7 @@ if (endline=0){ if (defeat=1){ player_forces=0; if (ground_mission){ - obj_ground_mission.recoverable_gene_seed = seed_max; + obj_ground_mission.recoverable_gene_seed = seed_lost; } } diff --git a/objects/obj_ncombat/Create_0.gml b/objects/obj_ncombat/Create_0.gml index 3f1e52cbd7..dca5c78274 100644 --- a/objects/obj_ncombat/Create_0.gml +++ b/objects/obj_ncombat/Create_0.gml @@ -146,7 +146,8 @@ vehicle_recovery_score=0; injured=0; command_injured=0; seed_saved=0; -seed_max=0; +seed_lost=0; +seed_harvestable=0; units_saved_count=0; units_saved_counts={}; vehicles_saved_counts={}; diff --git a/objects/obj_p_assra/Alarm_0.gml b/objects/obj_p_assra/Alarm_0.gml index 409ca90485..a60e95b249 100644 --- a/objects/obj_p_assra/Alarm_0.gml +++ b/objects/obj_p_assra/Alarm_0.gml @@ -6,7 +6,7 @@ for (o=0;o0){ if (unit.base_group=="astartes"){ var age=obj_ini.age[co][i]; - if (age<=((obj_controller.millenium*1000)+obj_controller.year)-10) and (obj_ini.zygote=0) then seed_max+=1; - if (age<=((obj_controller.millenium*1000)+obj_controller.year)-5) then seed_max+=1; + if (age<=((obj_controller.millenium*1000)+obj_controller.year)-10) and (obj_ini.zygote=0) then seed_lost+=1; + if (age<=((obj_controller.millenium*1000)+obj_controller.year)-5) then seed_lost+=1; } } @@ -31,7 +31,7 @@ for (o=0;o0) then obj_controller.gene_seed+=seed_max; + if (obj_fleet.capital+obj_fleet.frigate+obj_fleet.escort>0) then obj_controller.gene_seed+=seed_lost; }else if (apothecary>0){ unit.add_or_sub_health(irandom_range(9,14)); apothecary-=0.5; diff --git a/scripts/scr_after_combat/scr_after_combat.gml b/scripts/scr_after_combat/scr_after_combat.gml index 42de7df0cd..47b0b1c1c7 100644 --- a/scripts/scr_after_combat/scr_after_combat.gml +++ b/scripts/scr_after_combat/scr_after_combat.gml @@ -201,22 +201,24 @@ function after_battle_part2() { if (obj_ini.race[marine_co[i], marine_id[i]] == 1) { var _birthday = obj_ini.age[marine_co[i], marine_id[i]]; var _current_year = (obj_controller.millenium * 1000) + obj_controller.year; - var _harvestable_seed = 0; - var _total_seed = 0; + var _seed_harvestable = 0; + var _seed_lost = 0; if (_birthday <= (_current_year - 10) && obj_ini.zygote == 0) { - _total_seed++; - if (irandom_range(1, 20) > 1) { - _harvestable_seed++; + _seed_lost++; + if (irandom_range(1, 10) > 1) { + _seed_harvestable++; } } if (_birthday <= (_current_year - 5)) { - _total_seed++; - if (irandom_range(1, 20) > 1) { - _harvestable_seed++; + _seed_lost++; + if (irandom_range(1, 10) > 1) { + _seed_harvestable++; } } - obj_ncombat.seed_max += _total_seed; + + obj_ncombat.seed_harvestable += _seed_harvestable; + obj_ncombat.seed_lost += _seed_lost; } var last=0; diff --git a/scripts/scr_roster/scr_roster.gml b/scripts/scr_roster/scr_roster.gml index cd034b19bb..6f51d1f325 100644 --- a/scripts/scr_roster/scr_roster.gml +++ b/scripts/scr_roster/scr_roster.gml @@ -226,7 +226,7 @@ function Roster() constructor{ var _roster_types = struct_get_names(possible_local_roster); for (var i=0;i Date: Tue, 1 Apr 2025 21:03:28 +0300 Subject: [PATCH 5/5] JSDocs --- .../scr_array_functions/scr_array_functions.gml | 14 ++++++++++---- .../scr_string_functions/scr_string_functions.gml | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/scr_array_functions/scr_array_functions.gml b/scripts/scr_array_functions/scr_array_functions.gml index cc0a45028b..dda5d22fa6 100644 --- a/scripts/scr_array_functions/scr_array_functions.gml +++ b/scripts/scr_array_functions/scr_array_functions.gml @@ -123,7 +123,12 @@ function array_to_string_order(_strings_array, _use_and = false, _dot_end = true return result; } - +/// @description Converts two parallel arrays into a formatted string with pluralized counts +/// @param {array} _names_array Array of strings representing item names +/// @param {array} _counts_array Array of integers representing counts for each name +/// @param {bool} _exclude_null Whether to exclude entries with zero count +/// @param {bool} _dot_end Whether to end the string with a period +/// @return {string} function arrays_to_string_with_counts(_names_array, _counts_array, _exclude_null = false, _dot_end = true) { var _array_length = array_length(_names_array); var _result_string = ""; @@ -167,9 +172,10 @@ function fetch_deep_array(array, accessors){ return _array_step; } -/// @description Choose either `.` or `,` based on the array lengh and current loop iteration. -/// @param {array|real} _array_or_length -/// @param {real} _loop_iteration +/// @description Choose either `.` or `,` based on the array length and current loop iteration. +/// @param {array|real} _array_or_length Array or its length. +/// @param {real} _loop_iteration Current loop iteration. +/// @param {bool} _dot_end Whether to end with a period for the last element /// @return {string} function smart_delimeter_sign(_array_or_length, _loop_iteration, _dot_end = true) { var _delimeter = ""; diff --git a/scripts/scr_string_functions/scr_string_functions.gml b/scripts/scr_string_functions/scr_string_functions.gml index 1fc7c97bc2..a408fced02 100644 --- a/scripts/scr_string_functions/scr_string_functions.gml +++ b/scripts/scr_string_functions/scr_string_functions.gml @@ -282,6 +282,7 @@ function base64_encode_advanced(input_string) { return _encoded_string; } +/// @description Transforms a verb based on the plurality of a variable. /// @param {string} _verb The verb to be transformed (e.g., "was", "is", "has", etc.). /// @param {number} _variable A value determining singular (1) or plural (any value other than 1). /// @returns {string}