subtledoctor Posted February 6, 2015 Share Posted February 6, 2015 Instead of writing your new proficiency string on top of the "Bastard Sword" strref [with STRING_SET], you should assign your string its own strref and update the value stored in weapprof.2da. I've only ever looked at weapprof.2da in NI and I only see text there - I didn't even realize it contains strrefs. I suppose NI must automatically translate them? (I think this issue tripped me up once a few months ago.) Would I do something like: COPY_EXISTING ~weapprof.2da~ ~override~ REPLACE_TEXTUALLY 25000 @100 ...? Or would I need to first RESOLVE_STR_REF, get the result, and pass that into the text replacement? Something like, SET %bsword% to RESOLVE_STR_REF @100 COPY_EXISTING ~weapprof.2da~ ~override~ REPLACE_TEXTUALLY 25000 %bsword% ...? I just need a little help in implementation, since it involves a technique I'm not familiar with. Little help? Link to comment
Mike1072 Posted February 6, 2015 Share Posted February 6, 2015 I'd recommend RESOLVE_STR_REF and SET_2DA_ENTRY. COPY_EXISTING ~weapprof.2da~ ~override~ COUNT_2DA_COLS num_cols SET_2DA_ENTRY 8 2 num_cols RESOLVE_STR_REF (@100) BUT_ONLY Link to comment
lynx Posted February 6, 2015 Share Posted February 6, 2015 http://gemrb.org/iesdp/files/2da/2da_tob/weapprof.htm Link to comment
subtledoctor Posted February 9, 2015 Author Share Posted February 9, 2015 Out of curiosity, why bother with the COUNT_2DA_COLS? Why not just do SET_2DA_ENTRY 8 2 1 or whatever? Link to comment
Jarno Mikkola Posted February 9, 2015 Share Posted February 9, 2015 Out of curiosity, why bother with the COUNT_2DA_COLS? Why not just do SET_2DA_ENTRY 8 2 1 or whatever?Well, it's easier to make example out of... as you have to know the subject, aka he had probably used the same code previously and likes to use the same (example) code (he has in his work)... Link to comment
Mike1072 Posted February 9, 2015 Share Posted February 9, 2015 Out of curiosity, why bother with the COUNT_2DA_COLS? Why not just do SET_2DA_ENTRY 8 2 1 or whatever? There's no way to know in advance how many columns are in the file, since it depends on how many kits are currently installed. If you set the required column count to num_cols, then the data in your array will be indexed with rows starting at 0. If you set the required column count to some number less than num_cols, then you'd have to calculate what row your array data starts at and offset your row indices by that amount. The only time I would set the required column count to something other than num_cols is when I'd set it to (num_cols - 1) in order to include the column labels. In that case, any code dealing with the array data row indices would be offset by 1 (e.g. loops would start at 1 rather than 0). Link to comment
subtledoctor Posted February 9, 2015 Author Share Posted February 9, 2015 Interesting. My practice til now (because I didn't know about the COUNT_2DA_COLS function) was to simply use 1 as the column count for files where the # of columns may change. E.g. right now I'm getting precisely the same result from COPY_EXISTING ~weapprof.2da~ ~override~ SET_2DA_ENTRY 11 2 1 RESOLVE_STR_REF (@100) BUT_ONLY...as from COPY_EXISTING ~weapprof.2da~ ~override~ COUNT_2DA_COLS num_cols SET_2DA_ENTRY 10 2 num_cols RESOLVE_STR_REF (@100) BUT_ONLY Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.