debug.log and GetConfigStringArray(....)

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

debug.log and GetConfigStringArray(....)

Post by Tomi »

I'm getting this error message to debug.log all the time I'm running 1 of my scripts.

Script Error in 'pkg/commands/trainee/go.ecl' PC=1460:
Call to function GetConfigStringArray:
Parameter 0: Expected datatype ApplicObj, got datatype Error

and when I searched for that in the .lst file of the script I find out exactly which of my 3 calls to GetConfigStringArray it was in the script.

I added some Print to check what they really return like this:

Code: Select all

function GoCategoryGump( character, realm_string )

	var cfg;

	Print( realm_string );

	case ( realm_string )
		"Felucca":	cfg := "Go_Felucca";
		"Trammel":	cfg := "Go_Trammel";
		"Ilshenar":  cfg := "Go_Ilshenar";
		"Malas":      cfg := "Go_Malas";
		"Tokuno":	 cfg := "Go_Tokuno";
		default:
			SysLog( "No such realm string in Go command." + realm_String );
			DebugLog( GetPid(), "No such realm string in Go command." + realm_string );
			return 0;
	endcase

	var cfg_file	:= ReadConfigFile( ":Commands:" + cfg );
	Print( "Category Gump " + cfg_file );
	var cfg_elem	:= FindConfigElem( cfg_file, realm_string );
	Print( "Category Gump " + cfg_elem );
	var cfg_array	:= GetConfigStringArray( cfg_elem, "Category" );
The debug.log point out like it should be the cfg_elem that is having some problems.

but... my Print return always for both cfg_file and cfg_elem that they are of type ApplicObj:ConfigFileRef and ApplicObj:ConfigElemRef

That's why I dont understand anymore what could cause this, and I'm asking for some advices here.

Anyone having advices or ideas what could possibly cause that error to debug.log ?
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am

Re: debug.log and GetConfigStringArray(....)

Post by coltain »

Should be:

var cfg_file := ReadConfigFile( ":Commands:" + cfg );
if(cfg_file)
Print( "Category Gump " + cfg_file );
var cfg_elem := FindConfigElem( cfg_file, realm_string );
if(cfg_elem)
Print( "Category Gump " + cfg_elem );
var cfg_array := GetConfigStringArray( cfg_elem, "Category" );
endif
endif

debugger shows this info when You call a function with unwanted type of parameter .
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: debug.log and GetConfigStringArray(....)

Post by Tomi »

yes I know it shows because of unwanted parameter, but what still makes me wonder, is that because my Prints shows that the cfg_file and cfg_elem variables are exactly of the type what they should be.

But I will try with some if sentences there and see what happen.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Re: debug.log and GetConfigStringArray(....)

Post by MuadDib »

I will do some digging on this end. This may be a thread related issue. If this happens A LOT, or, you can EASILY reproduce the debug.log report, please try doing so. Then, rename debug.log to debug.error.log and change Multithread in pol.cfg to 0, and try again. If that stops the reports, that means this is a threading issue and we need to investigate some more thread-safe abilities with the eScript backend in POL. Ugh, lol

In C#, this could be easily resolved, but if this IS a thread issue, will take me some time to track it down in C++. My make Nando work with me on this one if it is ;)
Post Reply