Jump to content


Photo

TOOLTIP.2DA patching problem


  • This topic is locked This topic is locked
7 replies to this topic

#1 King Diamond

King Diamond

    Give Me Your Soul...Please

  • Modder
  • 1430 posts

Posted 24 March 2006 - 04:23 AM

With the release of WeiDU v191 this problem arose.

Here's a quick fix for that.

Plz find the following block in TDD and/or CtB TP2:
COPY_EXISTING ~TOOLTIP.2DA~ ~override~
 SET required_columns = 10			//10 for CtB, 6 for TDD
 SET rows=2
 SET rows_prev=0
 SET col_cnt=0
 WHILE "%rows%">1 BEGIN
   col_cnt = col_cnt + 1
   rows_prev = rows
   COUNT_2DA_ROWS col_cnt rows
 END
 col_cnt = col_cnt - 1
 SET ccc = col_cnt - 1

 PATCH_IF 1 BEGIN
   SPRINT str_add ""
   SPRINT str "%ccc%"
   FOR(cnt="%col_cnt%"; cnt<="%required_columns%"; cnt+=1) BEGIN
	 SPRINT str "%str%"^"		  %cnt%"
	 SPRINT str_add "%str_add%"^"		 -1"
   END
   
   PATCH_IF("%ccc%"<"%required_columns%") BEGIN
	 SET_2DA_ENTRY 0 ccc ccc "%str%"

	 FOR(j=1; j<="%rows_prev%"; j+=1) BEGIN
	   READ_2DA_ENTRY j ccc col_cnt "last"
	   SPRINT str "%last%"^"%str_add%"
	   SET_2DA_ENTRY j ccc col_cnt "%str%"
	 END
   END
 END
BUT_ONLY_IF_IT_CHANGES

and make modifications:


COPY_EXISTING ~TOOLTIP.2DA~ ~override~
SET required_columns = 10
SET rows=2
SET rows_prev=0
SET col_cnt=0
WHILE "%rows%">1 BEGIN
col_cnt = col_cnt + 1
rows_prev = rows
COUNT_2DA_ROWS col_cnt rows
END
col_cnt = col_cnt - 1
SET ccc = col_cnt - 1

PATCH_IF 1 BEGIN
SPRINT str_add ""
SPRINT str "%ccc%"
FOR(cnt="%col_cnt%"; cnt<="%required_columns%"; cnt+=1) BEGIN
SPRINT str "%str%"^" %cnt%"
SPRINT str_add "%str_add%"^" -1"
END

READ_2DA_ENTRY 0 0 3 "test"
PATCH_IF( "%test%"=1 ) BEGIN
SET_2DA_ENTRY 0 0 3 "0 1"
END


PATCH_IF("%ccc%"<"%required_columns%") BEGIN
SET_2DA_ENTRY 0 ccc ccc "%str%"

FOR(j=1; j<="%rows_prev%"; j+=1) BEGIN
READ_2DA_ENTRY j ccc col_cnt "last"
SPRINT str "%last%"^"%str_add%"
SET_2DA_ENTRY j ccc col_cnt "%str%"
END
END
END
BUT_ONLY_IF_IT_CHANGES


Edited by King Diamond, 24 March 2006 - 04:28 AM.

(last update: 02-12-2008)
----------------------------------------------
SoS, v1.13
TDD, v1.12
TS-BP, v6.10
CtB, v1.11
RoT, v2.1
----------------------------------------------
BP Animations Scheme


#2 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 24 March 2006 - 04:30 AM

Might I know where the bug lies? I didn't experience it by running that piece of code alone.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#3 King Diamond

King Diamond

    Give Me Your Soul...Please

  • Modder
  • 1430 posts

Posted 24 March 2006 - 04:39 AM

Might I know where the bug lies? I didn't experience it by running that piece of code alone.


A line of original TOOLTIP with column numbers has empty spot for the 1st column (no '0').
READ_2DA_ENTRY 0 0 3 num
returns 1 correctly.

But if you'd try
SET_2DA_ENTRY 0 0 3 smthn
and
SET_2DA_ENTRY 0 1 3 smthn

they both will do the same thing. Just try it and see.


P.S. That bug was there long before. So I had to make some poor trick to make things behave nicely, but v191 stopped to swallow such things....

Edited by King Diamond, 24 March 2006 - 04:41 AM.

(last update: 02-12-2008)
----------------------------------------------
SoS, v1.13
TDD, v1.12
TS-BP, v6.10
CtB, v1.11
RoT, v2.1
----------------------------------------------
BP Animations Scheme


#4 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 24 March 2006 - 04:50 AM

Is that the v191 bug? I didn't touch *_2DA_ENTRY operations in 191...

Anyway, I can't really fix that without breaking older mods, or introducing SET_2DA_ENTRY_CORRECT (which is stupid at the very least). You can use SET_2DA_ENTRY_LATER/NOW for that to behave properly, anyway.

<<<<<<<< stuff
   1  2  3
10 11 12 13
20 21 22 23
>>>>>>>>

COPY ~stuff~ ~stiff~
  READ_2DA_ENTRY 0 0 3 x
  SET_2DA_ENTRY  0 0 3 ~asd~
PATCH_PRINT ~%x% should be 1~
AT_NOW ~cat stiff~

COPY ~stuff~ ~stiff~
  SET_2DA_ENTRY  0 1 3 ~asd~
AT_NOW ~cat stiff~

COPY ~stuff~ ~stiff~
  SET_2DA_ENTRY_LATER _#_#_#  0 0 ~asd~
  SET_2DA_ENTRIES_NOW _#_#_# 3
AT_NOW ~cat stiff~

COPY ~stuff~ ~stiff~
  SET_2DA_ENTRY_LATER _#_#_#  0 1 ~asd~
  SET_2DA_ENTRIES_NOW _#_#_# 3
AT_NOW ~cat stiff~
result:
Copying and patching 1 file ...  
								 
1 should be 1					
asd  2  3						
10 11 12 13					  
20 21 22 23					  
Copying and patching 1 file ...  
   asd  2  3					 
10 11 12 13					  
20 21 22 23					  
Copying and patching 1 file ...  
asd	 2	   3				
10	  11	  12	  13	   
20	  21	  22	  23	   
Copying and patching 1 file ...  
1	   asd	 3				
10	  11	  12	  13	   
20	  21	  22	  23

EDIT: as for WeiDU not swallowing it, I've just tried to install the tooltip.2da code from the tdd tp2 without problems.

Edited by the bigg, 24 March 2006 - 04:51 AM.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#5 erebusant

erebusant

    It takes a village...

  • Modder
  • 2109 posts

Posted 24 March 2006 - 06:24 PM

With the release of WeiDU v191 this problem arose.

Here's a quick fix for that.

Plz find the following block in TDD and/or CtB TP2:

COPY_EXISTING ~TOOLTIP.2DA~ ~override~
 SET required_columns = 10			//10 for CtB, 6 for TDD
 SET rows=2
 SET rows_prev=0
 SET col_cnt=0
 WHILE "%rows%">1 BEGIN
   col_cnt = col_cnt + 1
   rows_prev = rows
   COUNT_2DA_ROWS col_cnt rows
 END
 col_cnt = col_cnt - 1
 SET ccc = col_cnt - 1

 PATCH_IF 1 BEGIN
   SPRINT str_add ""
   SPRINT str "%ccc%"
   FOR(cnt="%col_cnt%"; cnt<="%required_columns%"; cnt+=1) BEGIN
	 SPRINT str "%str%"^"		  %cnt%"
	 SPRINT str_add "%str_add%"^"		 -1"
   END
   
   PATCH_IF("%ccc%"<"%required_columns%") BEGIN
	 SET_2DA_ENTRY 0 ccc ccc "%str%"

	 FOR(j=1; j<="%rows_prev%"; j+=1) BEGIN
	   READ_2DA_ENTRY j ccc col_cnt "last"
	   SPRINT str "%last%"^"%str_add%"
	   SET_2DA_ENTRY j ccc col_cnt "%str%"
	 END
   END
 END
BUT_ONLY_IF_IT_CHANGES

and make modifications:


COPY_EXISTING ~TOOLTIP.2DA~ ~override~
SET required_columns = 10
SET rows=2
SET rows_prev=0
SET col_cnt=0
WHILE "%rows%">1 BEGIN
col_cnt = col_cnt + 1
rows_prev = rows
COUNT_2DA_ROWS col_cnt rows
END
col_cnt = col_cnt - 1
SET ccc = col_cnt - 1

PATCH_IF 1 BEGIN
SPRINT str_add ""
SPRINT str "%ccc%"
FOR(cnt="%col_cnt%"; cnt<="%required_columns%"; cnt+=1) BEGIN
SPRINT str "%str%"^" %cnt%"
SPRINT str_add "%str_add%"^" -1"
END

READ_2DA_ENTRY 0 0 3 "test"
PATCH_IF( "%test%"=1 ) BEGIN
SET_2DA_ENTRY 0 0 3 "0 1"
END


PATCH_IF("%ccc%"<"%required_columns%") BEGIN
SET_2DA_ENTRY 0 ccc ccc "%str%"

FOR(j=1; j<="%rows_prev%"; j+=1) BEGIN
READ_2DA_ENTRY j ccc col_cnt "last"
SPRINT str "%last%"^"%str_add%"
SET_2DA_ENTRY j ccc col_cnt "%str%"
END
END
END
BUT_ONLY_IF_IT_CHANGES


KD, tried it and it worked great!! Thanks!!! :Bow:

It takes a village...


#6 Chevalier

Chevalier

    Knight of the Realms

  • Modder
  • 2405 posts

Posted 24 March 2006 - 08:31 PM

It worked for me too. ;)

I Ride for the King!


a.k.a. Chev


#7 King Diamond

King Diamond

    Give Me Your Soul...Please

  • Modder
  • 1430 posts

Posted 27 March 2006 - 12:14 AM

2Admins
Plz pin this topic

(last update: 02-12-2008)
----------------------------------------------
SoS, v1.13
TDD, v1.12
TS-BP, v6.10
CtB, v1.11
RoT, v2.1
----------------------------------------------
BP Animations Scheme


#8 horred the plague

horred the plague

    Scourge of the Seven Seas

  • Modder
  • 1899 posts

Posted 27 March 2006 - 01:16 PM

I fixed the code in BP, as well, before uploading v176.