Jump to content
lordfrith

[solved] Dissappearing variables after export to PBO

Recommended Posts

Hi Folks, yet another wierd scripting problem!

 

i have a mission which has a switch do for worldname, depending on which map it is i want it to load a bunch of pre defined loactions.

 

the problem is everything works real good in eden editor, and also works after export to MP. Export to SP pbo and the switch seems to fail.

 

here is the switch in question:

 

Spoiler

 ///////////////////////////////////LOCATION ARRAYS
  switch worldName do {
		case "Altis":{
				LF_MilSites = [
						["Telos","HQ",[16084.6,16996.3,0]],
						["Anthrakia","Outpost",[15413.5,15848,0]],
						["Anthrakia","Patrol Post",[15353.6,16207.4,0]],
						["Telos","Air Base",[15180.7,17346.1,0]],
						["Gravia","Air Base",[14336.8,16239.9,0]],
						["Gravia","Patrol Post",[17639.6,17290.1,0]],
						["Charkia","Barracks",[18350.9,15273,0]],
						["Lakka","Barracks",[13126.1,16347,0]],
						["Lakka","FOB",[12807.6,16668.5,0]],
						["Athira","Outpost",[13810,18960,0]],
						["Kalithea","Patrol Post",[18104.2,19185.7,0]],
						["Pyrgos","HQ",[17434.4,13156.9,0]],
						["Stavros","Outpost",[12463.8,15201.7,0]],
						["Sagonisi","Outpost",[14283,13040.2,0]],
						["Pyrgos","Patrol Post",[16657.9,12296.1,0]],
						["Pyrgos","Outpost",[16823.1,12045.7,0]],
						["Agios Georgios","Patrol Post",[20346.8,18771.2,0]],
						["Frini","Outpost",[14208.6,21222.9,0]],
						["Agios Georgios","Outpost",[20600.5,18812.7,0]],
						["Katalaki","Outpost",[12508.7,12735.3,0]],
						["Faronaki","Patrol Post",[15406.8,11345.9,0]],
						["Pefkas","HQ",[20936,19245.8,0]],
						["Pefkas","Outpost",[20611.4,20117.3,0]],
						["Galati","Outpost",[9942.42,19376.5,0]],
						["Syrta","Outpost",[8397.66,18254.5,0]],
						["Zaros","Patrol Post",[10011.6,11230.9,0]],
						["Krya Nera","Patrol Post",[9707.03,22304.7,0]],
						["Vikos","Outpost",[12299.7,8877.13,0]],
						["Delfinaki","FOB",[23604.1,21101.6,0]],
						["Kore","Outpost",[6824.63,16063.3,0]],
						["Riga","Outpost",[8309.57,10075.9,0]],
						["Sofia","Outpost",[25281.9,21793.6,0]],
						["Selakano","Outpost",[20081.9,6731.96,0]],
						["Aggelochori","Patrol Post",[5240.6,14178.3,0]],
						["Negades","Outpost",[4550.7,15420.1,0]],
						["Feres","Patrol Post",[23008.4,7260,0]],
						["Neri","Outpost",[3898.73,12295.4,0]]
				];
				LF_heliPads = [
						["Land_HelipadSquare_F",[12876.4,16740.3,0.0459366]],
						["Land_HelipadSquare_F",[12833.8,16736.4,0.0461884]],
						["Land_HelipadSquare_F",[12495.8,15195.9,0.0461884]],
						["Land_HelipadSquare_F",[17550.5,13240.4,0.0200338]],
						["Land_HelipadSquare_F",[14156.5,21255.1,-0.0137939]],
						["Land_HelipadCircle_F",[11578.5,11908.1,0.0100117]],
						["Land_HelipadSquare_F",[9906.99,19424.7,0.0203094]],
						["Land_HelipadSquare_F",[8423.31,18207.4,0.0205231]],
						["Land_HelipadSquare_F",[20597.2,20075.7,0.0202065]],
						["Land_HelipadSquare_F",[23483.8,21145.2,0.0202332]],
						["Land_HelipadCircle_F",[20798.3,7227.64,0.0384903]],
						["Land_HelipadSquare_F",[23080.1,7299.23,0.0200424]]
				];
		};
		case "Stratis":{
				LF_MilSites = [];
		};
};

 

 

steps to reproduce:

 

1. download test scenario from dropbox

 

2. run in eden editor, type 'hint str LF_MilSites'; in debug editor. should come up with full array of military sites

 

3. export mission to SP, run from scenarios

 

4. type 'hint str LF_MilSites'; in debug editor. nothing, switch do has failed

 

very strange how the switch would fail after export

 

 

Edited by lordfrith
solved

Share this post


Link to post
Share on other sites

Its because using switch with strings is case-sensitive, and command worldname returns "Altis" in editor preview and "altis" in SP.

You should use toLower or toUper for consistence like this:

 

switch (toLower worldName) do {
		case "altis":{

You should also predefine your global variables before switch scope and use default scope

 LF_MilSites = [];
 LF_heliPads = [];
  switch (toLower worldName) do {
		case "altis":{
				LF_MilSites = [
						["Telos","HQ",[16084.6,16996.3,0]]
				];
				LF_heliPads = [
						["Land_HelipadSquare_F",[12876.4,16740.3,0.0459366]]
				];
		};
		case "stratis":{
				LF_MilSites = [];
		};
		default {};
};

 

  • Like 2

Share this post


Link to post
Share on other sites

@davidoss i got back home to test it just now...  YES!  :slayer6:, that was indeed the problem, it seems so... simple with hindsight.

 

also tidied up the switch as you suggested,

 

thanks again for your help good sir.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×