Jump to content

Noobish question about READ_2DA_ENTRY


smeagolheart

Recommended Posts

I want to create an item with the description from the HELP column from kitlist.2da

 

So I want to read the HELP column from kitlist.2da and I'm kinda failing.

 

COPY_EXISTING ~kitlist.2da~ ~override~
    COUNT_2DA_ROWS ~9~ "rows"
        READ_2DA_ENTRY 1 4 10 ~s9desc~
    BUT_ONLY

then on my item

  SAY DESC "%s9desc%"
is giving me identified description of 24284
Not so very helpful, how do I get the full text?
Is there another way of doing what I want to do? I suppose I want to read all the things into an array eventually but for now I'm just trying to get the description from the first kit.
Link to comment

Ok... I can get it to work sorta, the first few work anyway but it gets stuck.. Can one of you please tell me what's wrong with this?

 

Here's what I have now:

COPY_EXISTING ~kitlist.2da~ ~override~
	READ_2DA_ENTRIES_NOW ~_#_#read_kitlist~ 8
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 2 ~1BERSERK~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 3 ~2WIZRDSL~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 4 ~3KENSAI~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 5 ~4CAVALIE~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 6 ~5INQUISI~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 7 ~6UNDEDHN~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 8 ~7FERALAN~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 9 ~8STALKER~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 10 ~9BEASTMA~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 11 ~10ASSASI~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 12 ~11BOUNTY~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 13 ~12SWASHB~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 14 ~13BLADE~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 15 ~14JESTER~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 16 ~15SKALD~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 17 ~16TOTEMI~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 18 ~17SHAPES~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 19 ~18BESTFR~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 20 ~19TALOS~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 21 ~20HELM~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 22 ~21LATHAN~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 23 ~22ABJURE~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 24 ~23CONJUR~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 25 ~24DIVINE~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 26 ~25ENCHAN~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 27 ~26ILLUSI~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 28 ~27INVOKE~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 29 ~28NECROM~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 30 ~29TRANSM~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 31 ~30WILDMA~
	READ_2DA_ENTRY_FORMER ~_#_#read_kitlist~ 0 32 ~31BARBAR~

It appears the first few work but it chokes on no matter how nicely I ask it. I must not be using the right words:

 

ERROR: [kitlist.2da] -> [override] Patching Failed (COPY) (Failure("ERROR: READ_2DA_ENTRY_FORMER failed on variable %_#_#read_kitlist_0_9%"))
Stopping installation because of error.
Is it because it's going from 9 to 10 (two digits) or something?
Link to comment

Ah thank you.

 

Well one step forward then another full stop. I think I've run into a bug mentioned in the weidu documentation.

	READ_2DA_ENTRY_FORMER ~read_kitlist~ 30 4 ~29TRANSM~
	READ_2DA_ENTRY_FORMER ~read_kitlist~ 31 4 ~30WILDMA~
	READ_2DA_ENTRY_FORMER ~read_kitlist~ 32 4 ~31BARBAR~
BUT_ONLY	
	/*ACTION_IF GAME_IS ~bgee bg2ee~ THEN BEGIN  //BGEE kits
		
	END
	ACTION_IF GAME_IS ~iwdee~ THEN BEGIN  //EE kits
		READ_2DA_ENTRY 1 35 10 
		READ_2DA_ENTRY 1 36 10 
	END */
	
	PRINT "%31BARBAR%"	// Hey this works! 

//	STORE 1 ITEMS								  		 		          
//																	  
//	Fighters =------------------------------------------------------------------------------------------------
// Barbarian (fighter kit according to the BG2 engine)
COPY ~kittomes/itm/s9tome01.itm~ ~override/s9tome31.itm~
  SAY NAME1 ~Manual~
  SAY NAME2 ~Book of the Barbarian~
  WRITE_LONG DESC "%31BARBAR%"  

error:

ERROR: Cannot find 1 rows with at least 10 columns.ERROR: [kittomes/itm/S9tome01.itm] -> [override/S9tome01.itm] Patching Failed (COPY) (Failure("Cannot Read 2DA Entry"))
Stopping installation because of error.
So it's still reading the kitlist.2da for some reason. hehe sorry how do I make it stop?
The weidu example looks the same to me:
// this is OK and works
COPY_EXISTING ~weapprof.2da~ ~override~
SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ 34 7 3
SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ 34 39 3
//do something else
COPY_EXISTING ~weapprof.2da~ ~override~
SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ 34 40 3
SET_2DA_ENTRIES_NOW ~_#_#_#weapprof~ 1

// this, however, is a bug:
COPY_EXISTING ~weapprof.2da~ ~override~
SET_2DA_ENTRY_LATER ~_#_#_#weapprof~ 34 7 3 /* (*) */ <- this looks the same as above so I'm missing where the error is
edit:
hmm I think I figured out a problem but can't test it yet - at work.
Think needed to set READ_2DA_ENTRIES_NOW to 31 instead of 9 in order to read all default kits. Then I guess I'll make another variable to capture BG2EE kits or IWDEE kit uniqueness since I'm aiming for cross game possibility.
Link to comment

I was wrong :/ still getting the error.

 

Can anyone help me, trying to read the help column in kitlist 2da and store to a variable. Then use those variables later individually.

 

I will need to capture differences between BG2, BGEEs, and IWDEE in kitlists though I think I might be able to get that bit if I can get the first part going.

Link to comment

When I replicated your code, I didn't encounter any errors. Maybe the problem had to do with something that wasn't posted.

 

Anyway, this should work:

 

COPY_EXISTING ~kitlist.2da~ ~override~
  READ_2DA_ENTRIES_NOW ~r2en_kitlist~ 9
  FOR (row = 1; row < r2en_kitlist; row += 1) BEGIN
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 1 kit
    READ_2DA_ENTRY_FORMER ~r2en_kitlist~ row 4 description
    SET $description(~%kit%~) = description
  END
  BUT_ONLY
  
COPY ~kittomes/itm/s9tome01.itm~ ~override/s9tome31.itm~
  SAY NAME1 ~Manual~
  SAY NAME2 ~Book of the Barbarian~
  WRITE_LONG DESC $description(~BARBARIAN~)
Link to comment

You can only use SET when the value is an integer. Every row in the file except for the first one should have an integer in the HELP column. The loop should be skipping that first row, but you can always add this safety check:

 

PATCH_IF (IS_AN_INT description) BEGIN
  SET $description(~%kit%~) = description
END
Link to comment

Any idea why the items names are fine in BGEE but blank strings in IWDEE? My actor is unnamed as well. The description of the books is the only thing that works. :/

For whatever reason, it seems to be unusally common for people to install their mods in the wrong language on IWD: EE. Make sure the language in weidu.conf matches the language you are playing the game in.
Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...