diff --git a/ChapterMaster.yyp b/ChapterMaster.yyp index e8dac67a17..9e6009eaae 100644 --- a/ChapterMaster.yyp +++ b/ChapterMaster.yyp @@ -792,7 +792,6 @@ {"id":{"name":"scr_music","path":"scripts/scr_music/scr_music.yy",},}, {"id":{"name":"spr_artificer_colors2","path":"sprites/spr_artificer_colors2/spr_artificer_colors2.yy",},}, {"id":{"name":"spr_bionic_eye_2","path":"sprites/spr_bionic_eye_2/spr_bionic_eye_2.yy",},}, - {"id":{"name":"string_reverse","path":"scripts/string_reverse/string_reverse.yy",},}, {"id":{"name":"clean_tags","path":"scripts/clean_tags/clean_tags.yy",},}, {"id":{"name":"spr_weapon_powfist4","path":"sprites/spr_weapon_powfist4/spr_weapon_powfist4.yy",},}, {"id":{"name":"is_specialist","path":"scripts/is_specialist/is_specialist.yy",},}, @@ -808,9 +807,7 @@ {"id":{"name":"scr_colors_initialize","path":"scripts/scr_colors_initialize/scr_colors_initialize.yy",},}, {"id":{"name":"scr_shader_initialize","path":"scripts/scr_shader_initialize/scr_shader_initialize.yy",},}, {"id":{"name":"spr_sal_mk6_helm","path":"sprites/spr_sal_mk6_helm/spr_sal_mk6_helm.yy",},}, - {"id":{"name":"string_to_integer","path":"scripts/string_to_integer/string_to_integer.yy",},}, {"id":{"name":"spr_weapon_boarding","path":"sprites/spr_weapon_boarding/spr_weapon_boarding.yy",},}, - {"id":{"name":"string_rpos","path":"scripts/string_rpos/string_rpos.yy",},}, {"id":{"name":"spr_bionics_hand","path":"sprites/spr_bionics_hand/spr_bionics_hand.yy",},}, {"id":{"name":"explode_script","path":"scripts/explode_script/explode_script.yy",},}, {"id":{"name":"relative_direction","path":"scripts/relative_direction/relative_direction.yy",},}, @@ -935,7 +932,7 @@ {"id":{"name":"scr_enemy_ai_d","path":"scripts/scr_enemy_ai_d/scr_enemy_ai_d.yy",},}, {"id":{"name":"scr_enemy_ai_e","path":"scripts/scr_enemy_ai_e/scr_enemy_ai_e.yy",},}, {"id":{"name":"scr_mission_reward","path":"scripts/scr_mission_reward/scr_mission_reward.yy",},}, - {"id":{"name":"scr_convert_to_string","path":"scripts/scr_convert_to_string/scr_convert_to_string.yy",},}, + {"id":{"name":"scr_string_functions","path":"scripts/scr_string_functions/scr_string_functions.yy",},}, {"id":{"name":"scr_income","path":"scripts/scr_income/scr_income.yy",},}, {"id":{"name":"scr_apothecary_ship","path":"scripts/scr_apothecary_ship/scr_apothecary_ship.yy",},}, {"id":{"name":"scr_apothecary_ground","path":"scripts/scr_apothecary_ground/scr_apothecary_ground.yy",},}, @@ -964,7 +961,6 @@ {"id":{"name":"scr_audience","path":"scripts/scr_audience/scr_audience.yy",},}, {"id":{"name":"spr_ba_mk7_helm","path":"sprites/spr_ba_mk7_helm/spr_ba_mk7_helm.yy",},}, {"id":{"name":"spr_intelligence_icon","path":"sprites/spr_intelligence_icon/spr_intelligence_icon.yy",},}, - {"id":{"name":"scr_truncate_string_width","path":"scripts/scr_truncate_string_width/scr_truncate_string_width.yy",},}, {"id":{"name":"spr_dread_heavy_bolter","path":"sprites/spr_dread_heavy_bolter/spr_dread_heavy_bolter.yy",},}, {"id":{"name":"spr_purity_seal","path":"sprites/spr_purity_seal/spr_purity_seal.yy",},}, {"id":{"name":"scr_zoom","path":"scripts/scr_zoom/scr_zoom.yy",},}, @@ -1001,7 +997,6 @@ {"id":{"name":"action_another_room","path":"scripts/action_another_room/action_another_room.yy",},}, {"id":{"name":"action_color","path":"scripts/action_color/action_color.yy",},}, {"id":{"name":"action_draw_ellipse","path":"scripts/action_draw_ellipse/action_draw_ellipse.yy",},}, - {"id":{"name":"scr_string","path":"scripts/scr_string/scr_string.yy",},}, {"id":{"name":"action_if_number","path":"scripts/action_if_number/action_if_number.yy",},}, {"id":{"name":"action_if_variable","path":"scripts/action_if_variable/action_if_variable.yy",},}, {"id":{"name":"spr_medicine_icon","path":"sprites/spr_medicine_icon/spr_medicine_icon.yy",},}, @@ -1022,7 +1017,6 @@ {"id":{"name":"__view_set_internal","path":"scripts/__view_set_internal/__view_set_internal.yy",},}, {"id":{"name":"__init_view","path":"scripts/__init_view/__init_view.yy",},}, {"id":{"name":"__init_global","path":"scripts/__init_global/__init_global.yy",},}, - {"id":{"name":"scr_string_plural","path":"scripts/scr_string_plural/scr_string_plural.yy",},}, {"id":{"name":"__global_object_depths","path":"scripts/__global_object_depths/__global_object_depths.yy",},}, {"id":{"name":"sReplaceColor","path":"shaders/sReplaceColor/sReplaceColor.yy",},}, {"id":{"name":"fnt_cul_14","path":"fonts/fnt_cul_14/fnt_cul_14.yy",},}, diff --git a/objects/obj_controller/Create_0.gml b/objects/obj_controller/Create_0.gml index c9e0c86874..ab1269eeaa 100644 --- a/objects/obj_controller/Create_0.gml +++ b/objects/obj_controller/Create_0.gml @@ -1475,14 +1475,16 @@ if (global.load==0) then marines-=command; // **** INTRO SCREEN **** temp[30]=string(check_number)+" "+string(year_fraction)+" "+string(year)+".M"+string(millenium);// Date temp[31]=string_upper(adept_name);// Adept name -temp[32]=string_upper(obj_ini.name[0,1]);// Master name +temp[32]=string_upper(obj_ini.name[0][0]);// Master name temp[33]=string_upper(scr_thought());// Thought of the day -// Starts the vars for the 4 pages of intro +// +// Game start welcoming message +// var njm=34,com=0,vih=0,word="",masta=0,forga=0,chapla=0,apa=0,liba=0,techa=0,libra=0,coda=0,lexa=0,apotha=0,old_dudes=0; -var honoh=0,termi=0,veter=0,capt=0,chap=0,apoth=0,stand=0,dread=0,tact=0,assa=0,deva=0,rhino=0,speeder=0,raider=0,standard=0,bike=0,scou=0,whirl=0,pred=0; -for(var mm=1; mm<=100; mm++){ +var honoh=0,termi=0,veter=0,capt=0,chap=0,apoth=0,stand=0,dread=0,champ=0,tact=0,assa=0,deva=0,rhino=0,speeder=0,raider=0,standard=0,bike=0,scou=0,whirl=0,pred=0,lib=0,serg=0,vet_serg=0; +for(var mm=0; mm<=100; mm++){ if (obj_ini.role[com,mm]=="Chapter Master") then masta=1; if (obj_ini.role[com,mm]=="Forge Master") then forga=1; if (obj_ini.role[com,mm]=="Master of Sanctity") then chapla=1; @@ -1497,33 +1499,34 @@ for(var mm=1; mm<=100; mm++){ if (obj_ini.role[com,mm]==obj_ini.role[100][2]) then honoh+=1; } -temp[njm]="Command staff which includes"; +temp[njm]="Command staff made of"; + +if (masta == 1) then temp[njm] += $", your majesty Chapter Master {obj_ini.name[com][0]}"; +if (forga == 1) then temp[njm] += $", Forge Master {obj_ini.name[com][1]}"; +if (chapla == 1) then temp[njm] += $", Master of Sanctity {obj_ini.name[com][2]}"; +if (apa == 1) then temp[njm] += $", Master of the Apothecarion {obj_ini.name[com][3]}"; +if (liba == 1) then temp[njm] += $", and Chief Librarian {obj_ini.name[com][4]}. "; -if (masta==1) then temp[njm]+=", your majesty "+string(obj_ini.name[com,1]); -if (forga==1) then temp[njm]+=", Forge Master "+string(obj_ini.name[com,2]); -if (chapla==1) then temp[njm]+=", Master of Sanctity "+string(obj_ini.name[com,3]); -if (apa==1) then temp[njm]+=", Master of the Apothecarion "+string(obj_ini.name[com,4]); -if (liba==1) then temp[njm]+=", and Chief Librarian "+string(obj_ini.name[com,5])+". "; vih=string_pos(",",temp[njm]); temp[njm]=string_delete(temp[njm],vih,1); njm+=1; -temp[njm] = ""; -temp[njm]+=" It has"; -if (techa>0) then temp[njm]+=", "+string(techa)+" "+string(obj_ini.role[100][16])+"s"; -if (old_dudes>0) then temp[njm]+=", "+string(techa)+" "+string(obj_ini.role[100][16])+"s"; -if (apotha>0) then temp[njm]+=", "+string(apotha)+" "+string(obj_ini.role[100][15])+"s"; -if (libra>0) then temp[njm]+=", "+string(libra)+" "+string(obj_ini.role[100,17])+"s"; -if (coda>0) then temp[njm]+=", "+string(coda)+" Codiciery"; -if (lexa>0) then temp[njm]+=", "+string(lexa)+" Lexicanum."; +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)}."; vih=string_pos(",",temp[njm]); temp[njm]=string_delete(temp[njm],vih,1); -if (honoh>0) then temp[njm]+=" You have an Honour Guard which contains "+string(honoh)+" souls."; +if (honoh>0) then temp[njm]+=$"\n\nHonour Guard, having the {honoh} most veteran {string_plural("marine", honoh)} of your chapter serving in it."; + for(var company=0; company<10; company++){ - njm+=1; - com+=1; + njm++; + com++; fisted=0; techa=0; termi=0; @@ -1533,6 +1536,7 @@ for(var company=0; company<10; company++){ apoth=0; stand=0; dread=0; + champ=0; tact=0; assa=0; deva=0; @@ -1544,20 +1548,29 @@ for(var company=0; company<10; company++){ scou=0; whirl=0; pred=0; + lib=0; + serg=0; + vet_serg=0; for(var mm=1; mm<=400; mm++){ - if (obj_ini.role[com,mm]==obj_ini.role[100][4]) then termi+=1; if (obj_ini.role[com,mm]==obj_ini.role[100][3]) then veter+=1; - if (obj_ini.role[com,mm]=="Venerable "+string(obj_ini.role[100][6])) then dread+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][4]) then termi+=1; if (obj_ini.role[com,mm]==obj_ini.role[100][5]) then capt+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][14]) then chap+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][15]) then apoth+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][16]) then techa+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][11]) then standard+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][6]) then dread+=1; + if (obj_ini.role[com,mm]=="Venerable "+string(obj_ini.role[100][6])) then dread+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][7]) then champ+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][8]) then tact+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][10]) then assa+=1; if (obj_ini.role[com,mm]==obj_ini.role[100][9]) then deva+=1; - if (obj_ini.role[com,mm]==obj_ini.role[100][6]) then dread+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][10]) then assa+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][11]) then standard+=1; if (obj_ini.role[com,mm]==obj_ini.role[100][12]) then scou+=1; + + if (obj_ini.role[com,mm]==obj_ini.role[100][14]) then chap+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][15]) then apoth+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][16]) then techa+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][17]) then lib+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][18]) then serg+=1; + if (obj_ini.role[com,mm]==obj_ini.role[100][19]) then vet_serg+=1; } for(vih=1; vih<=100; vih++){ if (obj_ini.veh_role[com,vih]=="Land Raider") then raider+=1; @@ -1568,50 +1581,35 @@ for(var company=0; company<10; company++){ if (obj_ini.veh_role[com,vih]=="Whirlwind") then whirl+=1; } - if (com==1) then word="first"; - if (com==2) then word="second"; - if (com==3) then word="third"; - if (com==4) then word="fourth"; - if (com==5) then word="fifth"; - if (com==6) then word="sixth"; - if (com==7) then word="seventh"; - if (com==8) then word="eighth"; - if (com==9) then word="ninth"; - if (com==10) then word="tenth"; - if (com>=1){ - if (veter+termi+stand+dread+tact+assa+deva+rhino+raider+standard+scou+whirl>0) then temp[njm]="You have a "+string(word)+" company. It has"; + if (com > 0){ + if (veter+termi+stand+dread+tact+assa+deva+rhino+raider+standard+scou+whirl>0) then temp[njm]=$"{integer_to_words(com, true, true)} company made of"; else{temp[njm]="";} } - if (capt==1) then temp[njm]+=", "+string(capt)+" "+string(obj_ini.role[100][5]); - if (chap==1) then temp[njm]+=", "+string(chap)+" "+string(obj_ini.role[100][14]); - if (chap>1) then temp[njm]+=", "+string(chap)+" "+string(obj_ini.role[100][14])+"s"; - if (apoth==1) then temp[njm]+=", "+string(apoth)+" "+string(obj_ini.role[100][15]); - if (apoth>1) then temp[njm]+=", "+string(apoth)+" "+string(obj_ini.role[100][15])+"s"; - if (techa==1) then temp[njm]+=", "+string(techa)+" "+string(obj_ini.role[100][16]); - if (techa>1) then temp[njm]+=", "+string(techa)+" "+string(obj_ini.role[100][16])+"s"; + 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 (standard==1) then temp[njm]+=", "+string(standard)+" "+string(obj_ini.role[100][11])+"s"; - if (termi>0) then temp[njm]+=", "+string(termi)+" "+string(obj_ini.role[100][4])+"s"; - if (veter>0) then temp[njm]+=", "+string(veter)+" "+string(obj_ini.role[100][3])+"s"; - if (tact>0) then temp[njm]+=", "+string(tact)+" "+string(obj_ini.role[100][8])+"s"; - if (assa>0) then temp[njm]+=", "+string(assa)+" "+string(obj_ini.role[100][10])+"s"; - if (deva>0) then temp[njm]+=", "+string(deva)+" "+string(obj_ini.role[100][9])+"s"; - if (scou>0) then temp[njm]+=", "+string(scou)+" "+string(obj_ini.role[100][12])+"s"; - if (dread==1) then temp[njm]+=", "+string(dread)+" "+string(obj_ini.role[100][6])+""; - if (dread>1) then temp[njm]+=", "+string(dread)+" "+string(obj_ini.role[100][6])+"s"; - if (raider==1) then temp[njm]+=", "+string(raider)+" Land Raider"; - if (raider>1) then temp[njm]+=", "+string(raider)+" Land Raiders"; - if (pred==1) then temp[njm]+=", "+string(pred)+" Predator"; - if (pred>1) then temp[njm]+=", "+string(pred)+" Predators"; - if (whirl==1) then temp[njm]+=", "+string(whirl)+" Whirlwind"; - if (whirl>1) then temp[njm]+=", "+string(whirl)+" Whirlwinds"; - if (rhino==1) then temp[njm]+=", "+string(rhino)+" Rhino"; - if (rhino>1) then temp[njm]+=", "+string(rhino)+" Rhinos"; - if (speeder==1) then temp[njm]+=", "+string(speeder)+" Land Speeder"; - if (speeder>1) then temp[njm]+=", "+string(speeder)+" Land Speeders"; - if (bike==1) then temp[njm]+=", "+string(bike)+" Attack Bike"; - if (bike>1) then temp[njm]+=", "+string(raider)+" Attack Bikes"; + 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 (string_length(temp[njm])>0) then temp[njm]+="."; @@ -1621,150 +1619,151 @@ for(var company=0; company<10; company++){ } } -temp[59]="CLASSIFICATION: SECTOR LOGISTICAE#++++++++++DATE: "+string(temp[30])+"#++++++++AUTHOR: MASTER ADEPT "+string(temp[31])+"#++++++++++++RE: INTRODUCTORY MISSIVE#+++++RECIPIENT: CHAPTER MASTER "+string(temp[32])+"##++THOUGHT: "+string(temp[33])+"++##I see you have made it unscathed, your grace. Death comes with you as it should! The enemy is on the horizon. Thy chapter is mighty and only waits for your word to wreak havoc upon our enemies.##Your chapter contains-#"; -temp[60]=string(temp[59])+string(temp[34])+string(temp[35])+"##"+string(temp[36])+"##"+string(temp[37])+"##"+string(temp[38])+"##"+string(temp[39])+"##"+string(temp[40])+"##"+string(temp[41])+"##"+string(temp[42])+"##"+string(temp[43])+"##"+string(temp[44])+"##"+string(temp[45]); +temp[59] = $"CLASSIFICATION: SECTOR LOGISTICAE#++++++++++DATE: {temp[30]}#++++++++AUTHOR: MASTER ADEPT {temp[31]}#++++++++++++RE: INTRODUCTORY MISSIVE#+++++RECIPIENT: CHAPTER MASTER {temp[32]}##++THOUGHT: {temp[33]}++##I see you have made it unscathed, your grace. Death comes with you as it should! The enemy is on the horizon. Thy chapter is mighty and only waits for your word to wreak havoc upon our enemies.##Your chapter contains-"; -temp[61]="##Your armamentarium contains some spare equipment- "; -for(var u=1; u<=30; u++){ - if (obj_ini.equipment[u]!="") then temp[61]+=string(obj_ini.equipment_number[u])+" "+string(obj_ini.equipment[u])+", "; +temp[60] = $"{temp[59]}\n\n{temp[34]}\n\n{temp[35]}##{temp[36]}##{temp[37]}##{temp[38]}##{temp[39]}##{temp[40]}##{temp[41]}##{temp[42]}##{temp[43]}##{temp[44]}##{temp[45]}"; + + +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[62]="##Your fleet contains "; -var bb=0,sk=0,glad=0,hunt=0,ships=0,bb_names="",sk_names="",glad_names="",hunt_names=""; +var bb=0,sk=0,glad=0,hunt=0,ships=0,bb_names=[],sk_names=[],glad_names=[],hunt_names=[]; codex[0]="";codex_discovered[0]=0; -for(var mm=1; mm<=30; mm++){ +for(var mm=0; mm<=30; mm++){ if (obj_ini.ship[mm]!=""){ - ships+=1; - if (obj_ini.ship_class[mm]=="Battle Barge"){ - bb+=1; - bb_names+=", "+string(obj_ini.ship[mm]); + ships++; + if (obj_ini.ship_class[mm] == "Battle Barge") { + bb++; + array_push(bb_names, string(obj_ini.ship[mm])); } - if (obj_ini.ship_class[mm]=="Strike Cruiser"){ - sk+=1; - sk_names+=", "+string(obj_ini.ship[mm]); + if (obj_ini.ship_class[mm] == "Strike Cruiser") { + sk++; + array_push(sk_names, string(obj_ini.ship[mm])); } - if (obj_ini.ship_class[mm]=="Gladius"){ - glad+=1; - glad_names+=", "+string(obj_ini.ship[mm]); + if (obj_ini.ship_class[mm] == "Gladius") { + glad++; + array_push(glad_names, string(obj_ini.ship[mm])); } - if (obj_ini.ship_class[mm]=="Hunter"){ - hunt+=1; - hunt_names+=", "+string(obj_ini.ship[mm]); + if (obj_ini.ship_class[mm] == "Hunter") { + hunt++; + array_push(hunt_names, string(obj_ini.ship[mm])); } } codex[mm]=""; codex_discovered[mm]=0; } -temp[62]+=string(ships)+" warships.#"; - -vih=string_pos(",",bb_names); -bb_names=string_delete(bb_names,vih,1); -vih=string_pos(",",sk_names); -sk_names=string_delete(sk_names,vih,1); -vih=string_pos(",",glad_names); -glad_names=string_delete(glad_names,vih,1); -vih=string_pos(",",hunt_names); -hunt_names=string_delete(hunt_names,vih,1); - -if (obj_ini.fleet_type != ePlayerBase.home_world) or (bb==1) then temp[62]+="Your flagship is the Battle Barge "+string(obj_ini.ship[1])+". "; -if (obj_ini.fleet_type==ePlayerBase.home_world) and (bb>1){ - temp[62]+="There are "+string(bb)+" Battle Barges; "+string(bb_names)+". "; +temp[62]+=string(ships)+$" {string_plural("warship")}-\n"; + +if (obj_ini.fleet_type != ePlayerBase.home_world || bb == 1) { + temp[62] += $"Your flagship, Battle Barge {obj_ini.ship[1]}."; + temp[62] += "\n"; + bb--; } -temp[62]+="#"; -if (sk>0){ - temp[62]+="There are "+string(sk)+" Strike Cruisers; "+string(sk_names)+". "; - temp[62]+="#"; +if (bb > 0) { + temp[62] += $"{bb} {string_plural("Battle Barge")}: {array_to_string_order(bb_names)}."; + temp[62] += "\n"; } -if (glad>0){ - temp[62]+="There are "+string(glad)+" Gladius Escorts; "+string(glad_names)+". "; - temp[62]+="#"; +if (sk > 0) { + temp[62] += $"{sk} {string_plural("Strike Cruiser")}: {array_to_string_order(sk_names)}."; + temp[62] += "\n"; } -if (hunt>0){ - temp[62]+="There are "+string(hunt)+" Hunter Escorts; "+string(hunt_names)+"."; - temp[62]+="#"; +if (glad > 0) { + temp[62] += $"{glad} {string_plural("Gladius Escort")}: {array_to_string_order(glad_names)}."; + temp[62] += "\n"; } +if (hunt > 0) { + temp[62] += $"{hunt} {string_plural("Hunter Escort")}: {array_to_string_order(hunt_names)}."; + temp[62] += "\n"; +} + + // show_message(temp[61]); // show_message(temp[62]); // 61 : equipment // 62 : ships -var lol=160; +var lol=240; draw_set_font(fnt_small); -vih=string_height(string_hash_to_newline(string(temp[60])+string(temp[61])+string(temp[62]))); -vih-=210;vih=(vih/lol)+1; +welcome_pages=string_height(string_hash_to_newline(string(temp[60])+string(temp[61])+string(temp[62]))); +welcome_pages-=260; +welcome_pages=(welcome_pages/lol)+1; -if (floor(vih)=1){ +if (welcome_pages>=1){ for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[65]))>210){ + if (string_height(string_hash_to_newline(temp[65]))>260){ lig=string_length(temp[65]); - temp[65]=string_delete(temp[65],lig-1,1); + temp[65]=string_delete(temp[65],lig,1); } } } remov=string_length(string(temp[65]))+1; -if (vih>=2){ +if (welcome_pages>=2){ temp[66]=string_delete(temp[66],1,remov); for(var i=0; i<4000; i++){ - if (string_height(string_hash_to_newline(temp[66]))>130){ + if (string_height(string_hash_to_newline(temp[66]))>lol){ lig=string_length(temp[66]); - temp[66]=string_delete(temp[66],lig-1,1); + temp[66]=string_delete(temp[66],lig,1); } } } remov=string_length(string(temp[65])+string(temp[66]))+1; // show_message(remov); -if (vih>=3){ +if (welcome_pages>=3){ temp[67]=string_delete(temp[67],1,remov); for(var i=0; i<4000; i++){ if (string_height(string_hash_to_newline(temp[67]))>lol){ lig=string_length(temp[67]); - temp[67]=string_delete(temp[67],lig-1,1); + temp[67]=string_delete(temp[67],lig,1); } } } remov=string_length(string(temp[65])+string(temp[66])+string(temp[67]))+1; -if (vih<4) then temp[68]=""; -if (vih>=4){ +if (welcome_pages<4) then temp[68]=""; +if (welcome_pages>=4){ temp[68]=string_delete(temp[68],1,remov); for(var i=0; i<4000; i++){ if (string_height(string_hash_to_newline(temp[68]))>lol){ lig=string_length(temp[68]); - temp[68]=string_delete(temp[68],lig-1,1); + temp[68]=string_delete(temp[68],lig,1); } } } remov=string_length(string(temp[65])+string(temp[66])+string(temp[67])+string(temp[68]))+1; -if (vih<5) then temp[69]=""; -if (vih>=5){ +if (welcome_pages<5) then temp[69]=""; +if (welcome_pages>=5){ temp[69]=string_delete(temp[69],1,remov); for(var i=0; i<4000; i++){ if (string_height(string_hash_to_newline(temp[69]))>lol){ lig=string_length(temp[69]); - temp[69]=string_delete(temp[69],lig-1,1); + temp[69]=string_delete(temp[69],lig,1); } } } diff --git a/objects/obj_controller/Draw_0.gml b/objects/obj_controller/Draw_0.gml index 935220b230..1b20b40b28 100644 --- a/objects/obj_controller/Draw_0.gml +++ b/objects/obj_controller/Draw_0.gml @@ -3,7 +3,7 @@ try{ scr_ui_manage(); } catch(_exception){ - show_debug_message(_exception); + handle_exception(_exception); manage = 0; menu = 0; @@ -11,21 +11,21 @@ try{ try{ scr_ui_advisors(); } catch(_exception){ - show_debug_message(_exception); + handle_exception(_exception); manage = 0; menu = 0; } try{ scr_ui_diplomacy(); } catch(_exception){ - show_debug_message(_exception); + handle_exception(_exception); manage = 0; menu = 0; } try{ scr_ui_settings(); } catch(_exception){ - show_debug_message(_exception); + handle_exception(_exception); manage = 0; menu = 0; } diff --git a/objects/obj_star/Draw_0.gml b/objects/obj_star/Draw_0.gml index 5b78b7a7e6..09c928ea39 100644 --- a/objects/obj_star/Draw_0.gml +++ b/objects/obj_star/Draw_0.gml @@ -55,7 +55,7 @@ if (!global.load && (obj_controller.zoomed || in_camera_view(star_box_shape()))) var faction_sprite = obj_img.force[owner]; draw_sprite_ext(faction_sprite,faction_index,xx+(panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); } catch(_exception){ - show_debug_message("{0}", _exception); + handle_exception(_exception); } } else { draw_sprite_ext(faction_sprite,faction_index,xx+(panel_width/2)-30,yy+25, 0.60, 0.60, 0, c_white, 1); diff --git a/scripts/JsonFileListLoader/JsonFileListLoader.gml b/scripts/JsonFileListLoader/JsonFileListLoader.gml index 41e48cd161..f3126e3475 100644 --- a/scripts/JsonFileListLoader/JsonFileListLoader.gml +++ b/scripts/JsonFileListLoader/JsonFileListLoader.gml @@ -50,8 +50,8 @@ function JsonFileListLoader() constructor { result.is_success = true; debugl($"Successfully loaded {item_total} values from {relative_file_path}"); - } catch (_ex) { - debugl($"Could not load data from {relative_file_path}: {_ex.message}."); + } catch (_exception) { + handle_exception(_exception); result.values = {}; // do not return incomplete/invalid data } finally { if (is_undefined(file_buffer) == false) { diff --git a/scripts/UIRenderComponents/UIRenderComponents.gml b/scripts/UIRenderComponents/UIRenderComponents.gml index 851086e513..673e9bf60c 100644 --- a/scripts/UIRenderComponents/UIRenderComponents.gml +++ b/scripts/UIRenderComponents/UIRenderComponents.gml @@ -185,7 +185,7 @@ function UISpriteRendererComponent(owner, name) : UIRenderComponent(owner, name) alpha ) } catch(_exception){ - show_debug_message(_exception.message); + handle_exception(_exception); } img_index = (img_index + img_speed) % __spr_frames; } diff --git a/scripts/scr_add_artifact/scr_add_artifact.gml b/scripts/scr_add_artifact/scr_add_artifact.gml index 1554213584..7331929c5e 100644 --- a/scripts/scr_add_artifact/scr_add_artifact.gml +++ b/scripts/scr_add_artifact/scr_add_artifact.gml @@ -380,7 +380,7 @@ function corrupt_artifact_collectors(last_artifact){ } } catch( _exception){ - show_debug_message(_exception.message); + handle_exception(_exception); } } diff --git a/scripts/scr_array_functions/scr_array_functions.gml b/scripts/scr_array_functions/scr_array_functions.gml index e62ea67b16..7c81f8846a 100644 --- a/scripts/scr_array_functions/scr_array_functions.gml +++ b/scripts/scr_array_functions/scr_array_functions.gml @@ -62,4 +62,31 @@ function array_to_string_list(_array) { } } return _string_list; -} \ No newline at end of file +} + +/// @function array_to_string_order +/// @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) { + var result = ""; + var length = array_length(_strings_array); + + // Loop through the array + for (var i = 0; i < length; i++) { + // Append the current string + result += _strings_array[i]; + + // 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) { + result += " and "; + } else { + result += ", "; + } + } + } + + return result; +} diff --git a/scripts/scr_cheatcode/scr_cheatcode.gml b/scripts/scr_cheatcode/scr_cheatcode.gml index 7a7b733f75..6513e1809f 100644 --- a/scripts/scr_cheatcode/scr_cheatcode.gml +++ b/scripts/scr_cheatcode/scr_cheatcode.gml @@ -283,9 +283,6 @@ function scr_cheatcode(argument0) { } } } catch(_exception) { - log_into_file(_exception.longMessage); - log_into_file(_exception.script); - log_into_file(_exception.stacktrace); show_debug_message(_exception.longMessage); } } \ No newline at end of file diff --git a/scripts/scr_company_order/scr_company_order.gml b/scripts/scr_company_order/scr_company_order.gml index 261b1c8150..74abf8c686 100644 --- a/scripts/scr_company_order/scr_company_order.gml +++ b/scripts/scr_company_order/scr_company_order.gml @@ -13,7 +13,7 @@ function temp_marine_variables(co, unit_num){ break; } } catch( _exception) { - show_debug_message("{0}",_exception); + handle_exception(_exception); unit.squad="none"; } } diff --git a/scripts/scr_convert_to_string/scr_convert_to_string.gml b/scripts/scr_convert_to_string/scr_convert_to_string.gml deleted file mode 100644 index 96db4c3e33..0000000000 --- a/scripts/scr_convert_to_string/scr_convert_to_string.gml +++ /dev/null @@ -1,15 +0,0 @@ -function scr_convert_company_to_string(company_num, possessive = false, flavour=false){ - var _company_num = company_num; - var _suffixes = ["st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th"]; - var _flavours = ["Veteran", "Battle", "Battle", "Battle", "Battle", "Reserve", "Reserve", "Reserve", "Reserve", "Scout"]; - var _str_company = possessive ? "Company's" : "Company"; - - if (_company_num < 1) || (_company_num > 10) { - return ""; - } else { - var _flavour_text = flavour ? _flavours[_company_num - 1] : ""; - _company_num = string(_company_num) + _suffixes[_company_num - 1]; - var _converted_string = string_join(" ", _company_num, _flavour_text, _str_company); - return _converted_string; - } -} diff --git a/scripts/scr_convert_to_string/scr_convert_to_string.yy b/scripts/scr_convert_to_string/scr_convert_to_string.yy deleted file mode 100644 index b152abef7c..0000000000 --- a/scripts/scr_convert_to_string/scr_convert_to_string.yy +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resourceType": "GMScript", - "resourceVersion": "1.0", - "name": "scr_convert_to_string", - "isCompatibility": false, - "isDnD": false, - "parent": { - "name": "Scripts", - "path": "folders/Scripts.yy", - }, -} \ No newline at end of file diff --git a/scripts/scr_has_adv/scr_has_adv.gml b/scripts/scr_has_adv/scr_has_adv.gml index 5ffc07caf8..9d5dc204ce 100644 --- a/scripts/scr_has_adv/scr_has_adv.gml +++ b/scripts/scr_has_adv/scr_has_adv.gml @@ -11,7 +11,7 @@ function scr_has_adv(advantage){ result = array_contains(obj_ini.adv, advantage); } } catch (_exception){ - show_debug_message(_exception); + handle_exception(_exception); result = false; } return result; diff --git a/scripts/scr_has_disadv/scr_has_disadv.gml b/scripts/scr_has_disadv/scr_has_disadv.gml index e35b372c99..5336dd8c39 100644 --- a/scripts/scr_has_disadv/scr_has_disadv.gml +++ b/scripts/scr_has_disadv/scr_has_disadv.gml @@ -11,7 +11,7 @@ function scr_has_disadv(disadvantage){ result = array_contains(obj_ini.dis, disadvantage); } } catch (_exception){ - show_debug_message(_exception); + handle_exception(_exception); result = false; } return result; diff --git a/scripts/scr_librarium/scr_librarium.gml b/scripts/scr_librarium/scr_librarium.gml index 63cdd3e5c2..c1563abd64 100644 --- a/scripts/scr_librarium/scr_librarium.gml +++ b/scripts/scr_librarium/scr_librarium.gml @@ -228,7 +228,7 @@ function scr_librarium(){ try{ artif_descr = obj_ini.artifact_struct[menu_artifact].description(); } catch( _exception){ - show_debug_message(_exception.message); + handle_exception(_exception); } tooltip = ""; tooltip_other = ""; diff --git a/scripts/scr_random_event/scr_random_event.gml b/scripts/scr_random_event/scr_random_event.gml index 630108550c..b3fa026ab9 100644 --- a/scripts/scr_random_event/scr_random_event.gml +++ b/scripts/scr_random_event/scr_random_event.gml @@ -295,7 +295,7 @@ function scr_random_event(execute_now) { evented = true; } catch(_exception){ - show_debug_message("{0} \n hulk error",_exception); + handle_exception(_exception); } } } diff --git a/scripts/scr_string/scr_string.gml b/scripts/scr_string/scr_string.gml deleted file mode 100644 index 266186bab6..0000000000 --- a/scripts/scr_string/scr_string.gml +++ /dev/null @@ -1,26 +0,0 @@ -/// @function string_upper_first -/// @description Capitalizes the first character in a string. -/// @param {string} _string The string to be modified. -/// @returns {string} Modified string. - -function string_upper_first(_string) { - try { - var _first_char; - var _modified_string; - - _first_char = string_char_at(_string, 1); - _first_char = string_upper( _first_char ); - - _modified_string = _string; - _modified_string = string_delete(_modified_string, 1, 1); - _modified_string = string_insert(_first_char, _modified_string, 1); - - return _modified_string; - } - catch(_exception) { - log_into_file(_exception.longMessage); - log_into_file(_exception.script); - log_into_file(_exception.stacktrace); - show_debug_message(_exception.longMessage); - } -} \ No newline at end of file diff --git a/scripts/scr_string/scr_string.yy b/scripts/scr_string/scr_string.yy deleted file mode 100644 index c7d2aaf8f8..0000000000 --- a/scripts/scr_string/scr_string.yy +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resourceType": "GMScript", - "resourceVersion": "1.0", - "name": "scr_string", - "isCompatibility": false, - "isDnD": false, - "parent": { - "name": "Text", - "path": "folders/Scripts/Helpers/Text.yy", - }, -} \ No newline at end of file diff --git a/scripts/scr_string_functions/scr_string_functions.gml b/scripts/scr_string_functions/scr_string_functions.gml new file mode 100644 index 0000000000..ebbb784f14 --- /dev/null +++ b/scripts/scr_string_functions/scr_string_functions.gml @@ -0,0 +1,238 @@ +/// @function string_upper_first +/// @description Capitalizes the first character in a string. +/// @param {string} _string +/// @returns {string} +function string_upper_first(_string) { + try { + var _first_char = string_char_at(_string, 1); + var _modified_string = _string; + + _first_char = string_upper(_first_char); + + _modified_string = string_delete(_modified_string, 1, 1); + _modified_string = string_insert(_first_char, _modified_string, 1); + + return _modified_string; + } + catch(_exception) { + handle_exception(_exception); + } +} + +/// @function string_plural +/// @description This function formats a string into a plural form by adding affixes following common rules. +/// @param {string} _string +/// @param {real} _variable (Optional) Variable to check if more than 1 before converting to plural. +/// @returns {string} Modified string. +function string_plural(_string, _variable = 2) { + if (_variable < 2) { + return _string; + } + + var _last_char = string_char_at(_string, string_length(_string)); + var _last_two_chars = string_copy(_string, string_length(_string) - 1, 2); + if (_last_char == "y") { + return string_copy(_string, 1, string_length(_string) - 1) + "ies"; + } + else if (array_contains(["s", "x", "z", "ch", "sh"], _last_char)) { + return _string + "es"; + } + else if (_last_char == "f" || _last_two_chars == "fe") { + return string_copy(_string, 1, string_length(_string) - string_length(_last_two_chars)) + "ves"; + } + else { + return _string + "s"; + } +} + +/// @function string_truncate +/// @description Truncates a string to fit within a specified pixel width, appending "..." if the string was truncated. +/// @param {string} _string +/// @param {real} _max_width The maximum allowable pixel width for the string. +/// @returns {string} +function string_truncate(_string, _max_width) { + var _ellipsis = "..."; + var _ellipsis_width = string_width(_ellipsis); + var _text_width = string_width(_string); + if (_text_width > _max_width) { + var i = string_length(_string); + while (_text_width + _ellipsis_width > _max_width && i > 0) { + i--; + _string = string_delete(_string, i+1, 1); + _text_width = string_width(_string + _ellipsis); + } + return _string + _ellipsis; + } else { + return _string; + } +} + +/// @function integer_to_words +/// @description Converts an integer to an english word. +/// @param {real} _integer +/// @param {bool} _capitalize_first Capitalize first letter of the resulting word? +/// @param {bool} _ordinal Use ordinal form? +/// @returns {string} +function integer_to_words(_integer, _capitalize_first = false, _ordinal = false) { + var _ones = []; + var _teens = []; + var _tens = []; + var _thousands = []; + + if (_ordinal) { + _ones = ["zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth"]; + _teens = ["tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth"]; + _tens = ["", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth"]; + _thousands = ["", "thousandth", "millionth", "billionth"]; + } else { + _ones = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]; + _teens = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]; + _tens = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]; + _thousands = ["", "thousand", "million", "billion"]; + } + + var _num_str = ""; + var _num_int = floor(real(_integer)); + + if (_num_int < 10) { + _num_str += _ones[_num_int]; + } else if (_num_int < 20) { + _num_str += _teens[_num_int - 10]; + } else if (_num_int < 100) { + _num_str += _tens[floor(_num_int / 10)] + (_num_int % 10 != 0 ? " " + _ones[_num_int % 10] : ""); + } else if (_num_int < 1000) { + _num_str += _ones[floor(_num_int / 100)] + " hundred" + (_num_int % 100 != 0 ? " " + integer_to_words(_num_int % 100) : ""); + } else { + for (var _i = 0; _num_int > 0; _i += 1) { + if (_num_int % 1000 != 0) { + var _part = integer_to_words(_num_int % 1000); + _num_str = _part + " " + _thousands[_i] + (_num_str != "" ? " " : "") + _num_str; + } + _num_int = floor(_num_int / 1000); + } + } + + _num_str = string_trim(_num_str); + + if (_capitalize_first) { + _num_str = string_upper_first(_num_str); + } + + return _num_str; +} + +/// @function string_reverse +/// @description Returns the string written backwards. +/// @param {string} _string +/// @returns {string} +function string_reverse(_string) { + var str,length,i,out,char; + str=_string + out="" + length=string_length(_string) + for(i=0;i 10) { + return ""; + } else { + var _flavour_text = flavour ? _flavours[_company_num - 1] : ""; + _company_num = string(_company_num) + _suffixes[_company_num - 1]; + var _converted_string = string_join(" ", _company_num, _flavour_text, _str_company); + return _converted_string; + } +} + +/// @function scr_convert_company_to_string +/// @description This script converts a word or longer string into an integer, with each letter corresponding to a value from 1-26. +/// @param {string} _string +/// @returns {real} +function string_to_integer(_string) { + // The purpose of this is to allow a marine's + // name to generate a semi-unique variable for the future display of veterency + // decorations when inspected in management. Whether it is odd, from 0-9, and so + // on can determine what shows on their picture at certain experience values. + + var lol,m1,val; + lol=_string;val=0; + m1=string_length(lol); + + repeat(m1){ + if (string_lower(string_char_at(lol,0))="a") then val+=1; + if (string_lower(string_char_at(lol,0))="b") then val+=2; + if (string_lower(string_char_at(lol,0))="c") then val+=3; + if (string_lower(string_char_at(lol,0))="d") then val+=4; + if (string_lower(string_char_at(lol,0))="e") then val+=5; + if (string_lower(string_char_at(lol,0))="f") then val+=6; + if (string_lower(string_char_at(lol,0))="g") then val+=7; + if (string_lower(string_char_at(lol,0))="h") then val+=8; + if (string_lower(string_char_at(lol,0))="i") then val+=9; + if (string_lower(string_char_at(lol,0))="j") then val+=10; + if (string_lower(string_char_at(lol,0))="k") then val+=11; + if (string_lower(string_char_at(lol,0))="l") then val+=12; + if (string_lower(string_char_at(lol,0))="m") then val+=13; + if (string_lower(string_char_at(lol,0))="n") then val+=14; + if (string_lower(string_char_at(lol,0))="o") then val+=15; + if (string_lower(string_char_at(lol,0))="p") then val+=16; + if (string_lower(string_char_at(lol,0))="q") then val+=17; + if (string_lower(string_char_at(lol,0))="r") then val+=18; + if (string_lower(string_char_at(lol,0))="s") then val+=19; + if (string_lower(string_char_at(lol,0))="t") then val+=20; + if (string_lower(string_char_at(lol,0))="u") then val+=21; + if (string_lower(string_char_at(lol,0))="v") then val+=22; + if (string_lower(string_char_at(lol,0))="w") then val+=23; + if (string_lower(string_char_at(lol,0))="x") then val+=24; + if (string_lower(string_char_at(lol,0))="y") then val+=25; + if (string_lower(string_char_at(lol,0))="z") then val+=26; + lol=string_delete(lol,0,1); + } + return(val); +} diff --git a/scripts/scr_string_plural/scr_string_plural.yy b/scripts/scr_string_functions/scr_string_functions.yy similarity index 85% rename from scripts/scr_string_plural/scr_string_plural.yy rename to scripts/scr_string_functions/scr_string_functions.yy index 5e91f6c317..51d81dcb1b 100644 --- a/scripts/scr_string_plural/scr_string_plural.yy +++ b/scripts/scr_string_functions/scr_string_functions.yy @@ -1,7 +1,7 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "scr_string_plural", + "name": "scr_string_functions", "isCompatibility": false, "isDnD": false, "parent": { diff --git a/scripts/scr_string_plural/scr_string_plural.gml b/scripts/scr_string_plural/scr_string_plural.gml deleted file mode 100644 index ca7ea877d9..0000000000 --- a/scripts/scr_string_plural/scr_string_plural.gml +++ /dev/null @@ -1,18 +0,0 @@ -/// @function string_plural -/// @description This function formats a string into a plural form by adding affixes following common rules. -function string_plural(_string) { - var _last_char = string_char_at(_string, string_length(_string)); - var _last_two_chars = string_copy(_string, string_length(_string) - 1, 2); - if (_last_char == "y") { - return string_copy(_string, 1, string_length(_string) - 1) + "ies"; - } - else if (array_contains(["s", "x", "z", "ch", "sh"], _last_char)) { - return _string + "es"; - } - else if (_last_char == "f" || _last_two_chars == "fe") { - return string_copy(_string, 1, string_length(_string) - string_length(_last_two_chars)) + "ves"; - } - else { - return _string + "s"; - } -} \ No newline at end of file diff --git a/scripts/scr_truncate_string_width/scr_truncate_string_width.gml b/scripts/scr_truncate_string_width/scr_truncate_string_width.gml deleted file mode 100644 index e881a3f251..0000000000 --- a/scripts/scr_truncate_string_width/scr_truncate_string_width.gml +++ /dev/null @@ -1,21 +0,0 @@ -/// @function string_truncate -/// @description Truncates a string to fit within a specified pixel width, appending "..." if the string was truncated. -/// @param {string} _text The string to be truncated. -/// @param {int} _max_width The maximum allowable pixel width for the string. -/// @returns {string} Original or truncated string. -function string_truncate(_text, _max_width) { - var _ellipsis = "..."; - var _ellipsis_width = string_width(_ellipsis); - var _text_width = string_width(_text); - if (_text_width > _max_width) { - var i = string_length(_text); - while (_text_width + _ellipsis_width > _max_width && i > 0) { - i--; - _text = string_delete(_text, i+1, 1); - _text_width = string_width(_text + _ellipsis); - } - return _text + _ellipsis; - } else { - return _text; - } -} \ No newline at end of file diff --git a/scripts/scr_truncate_string_width/scr_truncate_string_width.yy b/scripts/scr_truncate_string_width/scr_truncate_string_width.yy deleted file mode 100644 index b893dd1dd8..0000000000 --- a/scripts/scr_truncate_string_width/scr_truncate_string_width.yy +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resourceType": "GMScript", - "resourceVersion": "1.0", - "name": "scr_truncate_string_width", - "isCompatibility": false, - "isDnD": false, - "parent": { - "name": "Text", - "path": "folders/Scripts/Helpers/Text.yy", - }, -} \ No newline at end of file diff --git a/scripts/scr_ui_advisors/scr_ui_advisors.gml b/scripts/scr_ui_advisors/scr_ui_advisors.gml index 9eb118b5ed..f7a4dabb8a 100644 --- a/scripts/scr_ui_advisors/scr_ui_advisors.gml +++ b/scripts/scr_ui_advisors/scr_ui_advisors.gml @@ -1,4 +1,4 @@ - +/// @mixin obj_controller function scr_ui_advisors() { var xx, yy, blurp, eta, va; @@ -861,8 +861,7 @@ function scr_ui_advisors() { if (menu = 502) then draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[67])), -1, 660); if (menu = 503) then draw_text_ext(xx + 370, yy + 72, string_hash_to_newline(string(temp[68])), -1, 660); draw_set_halign(fa_center); - if (temp[68] = "") then draw_text(xx + 702, yy + 695, string_hash_to_newline(string(menu - 499) + "/4 (Press Any Key)")); - if (temp[68] != "") then draw_text(xx + 702, yy + 695, string_hash_to_newline(string(menu - 499) + "/4 (Press Any Key)")); + draw_text(xx + 702, yy + 695, $"{menu - 499}/{welcome_pages} (Press Any Key)"); draw_set_halign(fa_left); } diff --git a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml index bd9f4f6d21..faad67eb1c 100644 --- a/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml +++ b/scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml @@ -102,7 +102,7 @@ function UnitQuickFindPanel() constructor{ } } }catch(_exception){ - show_debug_message(_exception.message); + handle_exception(_exception); } } update_mission_log(); diff --git a/scripts/string_reverse/string_reverse.gml b/scripts/string_reverse/string_reverse.gml deleted file mode 100644 index 2afe22d872..0000000000 --- a/scripts/string_reverse/string_reverse.gml +++ /dev/null @@ -1,20 +0,0 @@ -function string_reverse(argument0) { - /* - Reverse String - Reverse a string with ease - - Argument0 - String - */ - - var str,length,i,out,char; - str=argument0 - out="" - length=string_length(argument0) - for(i=0;i