Aller au contenu

Photo

using GetM2DAstring to access my own 2DA


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

#1
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
hi. i have this code trying to access a 2DA called test2da_fh.xls. the worksheet is called test2da_fh and the second column is called Label and stores strings. i've made another file called 2DA_base_fh.xls to try and get an ID for my first 2DA so i can use that id whith GetM2DAstring. i've put both of those files in the override directory of my full_heal module. when i compile the code below i get the error: undefined identifier from GetM2DAstring. not sure what's wrong.
 
            string s2DA;
            s2DA = GetM2DAstring(43000, "Label", 3);
            DisplayFloatyMessage(stEvent.oTarget, s2DA, FLOATY_MESSAGE,16777215, 10.00);

#2
Phaenan

Phaenan
  • Members
  • 315 messages
Hm. Should work.
Maybe it's because you extended 2DA_Base and not M2DA_Base ? Not sure since I never tried the former myself as there's a note in the source 2DA_base sheet saying we shouldn't.

On a side note, you can also access your custom 2DA tables by specifying the sheet name directly :
GetM2DAstring(-1, "Label", 3, "test2da_fh");
According to the function comment that's not ideal, but the lazy me has been doing it quite a lot nevertheless. :?

#3
Eshme

Eshme
  • Members
  • 756 messages
Yep ,have to be M2DA_base_fh

#4
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
maybe i'm missing an include file? what include files do you guys use?

#5
anakin5

anakin5
  • Members
  • 258 messages
It is because it is GetM2DAString and not GetM2DAstring

#6
Phaenan

Phaenan
  • Members
  • 315 messages
Oh, right !

Kinda forgot to pay attention to the error message in the OP. Yay, one more wide off the mark post for me ! :o

#7
Eshme

Eshme
  • Members
  • 756 messages
Oh that may be the reason i get random errors so often lol

#8
Magic

Magic
  • Members
  • 187 messages
While the compile error surely comes from the typo - did you create gda files out of the xls files? I found the whole 2da concept not very intuitve but maybe that's just me.

http://social.biowar.../Compiling_2DAs

For your (or everybody's?) information, the "base" in M2DA_base_fh is not required.

#9
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
you were right anakin now the script compiles but i'm still not able to extract strings from 2da's. the code below makes "gulk" appear above the target of a heal spell. that is intended so the problem is not with the code itself it has something to do with accessing the GDA files.



string s2DA;

s2DA = "gulk";

DisplayFloatyMessage(stEvent.oTarget, s2DA, FLOATY_MESSAGE,16777215, 10.00);



below is the gda file i've done that i'm trying to access:



Posted Image

#10
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
pic of my override folder (just trying to give as much information as i can in case anyone can understand what i'm doing wrong)



Posted Image

#11
Phaenan

Phaenan
  • Members
  • 315 messages
If your sheet has the ID 43000 in M2DA_base :
DisplayFloatyMessage(stEvent.oTarget, GetM2DAString(43000, "Label", 0));
By the way, note that Bioware reserved ID below 1'000'000 in M2DA_base, so you may want to change that ID if your project is meant to be public at some point.

If your sheet isn't defined in M2DA_base :
DisplayFloatyMessage(stEvent.oTarget, GetM2DAString(-1, "Label", 0, "test2da_fh"));

Modifié par Phaenan, 10 février 2010 - 05:30 .


#12
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
yup that worked. thanks for the help.