Aller au contenu

Photo

getm2da* functions not working


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
edmogt1

edmogt1
  • Members
  • 52 messages
I've created my own 2DA and nothing was being returned in my script.  So, I tested the functions on the core 2DAs and same thing. 

I'm doing this:

PrintToLog(GetM2DAString(1006, "Label", 0));

and it comes back with empty string. 

Are there any gotchas with these functions and how to use them?
Image IPBImage IPB

#2
FergusM

FergusM
  • Members
  • 460 messages
This is probably not your issue, but it's worth noting that the 2DA you're referencing there appears to start at ID number 1.

#3
Proleric

Proleric
  • Members
  • 2 354 messages
GetM2DAInt definitely works on a custom 2DA. I haven't tested the string function yet.

I can only suggest double-checking the M2DA_base entry, and ensuring that your custom 2DA is strictly compliant with the format given in the wiki (especially the two header rows).

#4
edmogt1

edmogt1
  • Members
  • 52 messages
I figured out my problem. It was the documentation that mislead me. I assumed "index of the row" meant the row number.

Better documentation would be:

int GetM2DAInt(

int n2DA,
string sColumn,
int nRow,
string s2da = ""

);

nRow: The value in the ID field of the row you wish to access.

rather than something that says "0 based index" which led me to assume that 0 was the first row of data.


Image IPBImage IPB

Modifié par edmogt1, 03 août 2010 - 11:48 .


#5
Proleric

Proleric
  • Members
  • 2 354 messages
I updated the wiki for that family of functions.