Jump to content

I think I need help debugging this


Recommended Posts

This one is weird. (Or my eyes are just glazed over and I'm missing something obvious.)

I have two dialogues structered the exact same way. Here is D5CS115.D:

Spoiler
BEGIN ~D5CS115~

IF ~Global("D5CS115","GLOBAL",1)~ THEN BEGIN d5cs115
 SAY @12001
 IF ~GlobalLT("D5CSP1","LOCALS",1) GlobalGT("D5CS115A","GLOBAL",0)~ THEN REPLY @12011 GOTO d5cs115_1		//	leadership
 IF ~GlobalLT("D5CSP2","LOCALS",1) GlobalGT("D5CS115B","GLOBAL",0)~ THEN REPLY @12013 GOTO d5cs115_2		//	grappling
 IF ~GlobalLT("D5CSP3","LOCALS",1) GlobalGT("D5CS115C","GLOBAL",0)~ THEN REPLY @12015 GOTO d5cs115_3		//	precise strike
 IF ~GlobalLT("D5CSP4","LOCALS",1) GlobalGT("D5CS115D","GLOBAL",0)~ THEN REPLY @12017 GOTO d5cs115_4		//	parry slashing
 IF ~GlobalLT("D5CSP5","LOCALS",1) GlobalGT("D5CS115E","GLOBAL",0)~ THEN REPLY @12019 GOTO d5cs115_5		//	parry piercing
 IF ~GlobalLT("D5CSP6","LOCALS",1) GlobalGT("D5CS115F","GLOBAL",0)~ THEN REPLY @12021 GOTO d5cs115_6		//	parry blunt
 IF ~GlobalLT("D5CSP7","LOCALS",1) GlobalGT("D5CS115G","GLOBAL",0)~ THEN REPLY @12023 GOTO d5cs115_7		//	missile snaring
 IF ~GlobalLT("D5CSP8","LOCALS",1) GlobalGT("D5CS115H","GLOBAL",0)~ THEN REPLY @12025 GOTO d5cs115_8		//	fighting dirty
 IF ~GlobalLT("D5CSP9","LOCALS",1) GlobalGT("D5CS115I","GLOBAL",0)~ THEN REPLY @12027 GOTO d5cs115_9		//	spell evasion
END

IF ~~ THEN BEGIN d5cs115_1 											// leadership
 SAY @12012
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP1","LOCALS",1)~ DO ~ApplySpellRES("D5CSP1L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_2											// grappling
 SAY @12014
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP2","LOCALS",1)~ DO ~ApplySpellRES("D5CSP2L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_3 											// precise strike
 SAY @12016
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP3","LOCALS",1)~ DO ~ApplySpellRES("D5CSP3L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_4 											// parry slashing
 SAY @12018
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP4","LOCALS",1)~ DO ~ApplySpellRES("D5CSP4L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_5 											// parry piercing
 SAY @12020
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP5","LOCALS",1)~ DO ~ApplySpellRES("D5CSP5L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_6 											// parry blunt
 SAY @12022
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP6","LOCALS",1)~ DO ~ApplySpellRES("D5CSP6L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_7 											// missile snaring
 SAY @12024
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP7","LOCALS",1)~ DO ~ApplySpellRES("D5CSP7L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_8 											// fighting dirty
 SAY @12026
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP8","LOCALS",1)~ DO ~ApplySpellRES("D5CSP8L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END
IF ~~ THEN BEGIN d5cs115_9 											// spell evasion
 SAY @12028
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSP9","LOCALS",1)~ DO ~ApplySpellRES("D5CSP9L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs115 
END

 

And here is D5CS124.D:

Spoiler
BEGIN ~D5CS124~

IF ~Global("D5CS124","GLOBAL",1)~ THEN BEGIN d5cs124
 SAY @12001
 IF ~GlobalLT("D5CSF1","LOCALS",1) GlobalGT("D5CS124A","GLOBAL",0)~ THEN REPLY @12031 GOTO d5cs124_1		//	health conditioning
 IF ~GlobalLT("D5CSF2","LOCALS",1) GlobalGT("D5CS124B","GLOBAL",0)~ THEN REPLY @12033 GOTO d5cs124_2		//	toughness
 IF ~GlobalLT("D5CSF3","LOCALS",1) GlobalGT("D5CS124C","GLOBAL",0)~ THEN REPLY @12035 GOTO d5cs124_3		//	resistance
 IF ~GlobalLT("D5CSF4","LOCALS",1) GlobalGT("D5CS124D","GLOBAL",0)~ THEN REPLY @12037 GOTO d5cs124_4		//	quickstride
 IF ~GlobalLT("D5CSF5","LOCALS",1) GlobalGT("D5CS124E","GLOBAL",0)~ THEN REPLY @12039 GOTO d5cs124_5		//	fortitude
 IF ~GlobalLT("D5CSF6","LOCALS",1) GlobalGT("D5CS124F","GLOBAL",0)~ THEN REPLY @12041 GOTO d5cs124_6		//	determination
 IF ~GlobalLT("D5CSF7","LOCALS",1) GlobalGT("D5CS124G","GLOBAL",0)~ THEN REPLY @12043 GOTO d5cs124_7		//	strength training
 IF ~GlobalLT("D5CSF8","LOCALS",1) GlobalGT("D5CS124H","GLOBAL",0)~ THEN REPLY @12045 GOTO d5cs124_8		//	agility training
END

IF ~~ THEN BEGIN d5cs124_1 											// health conditioning
 SAY @12032
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF1","LOCALS",1)~ DO ~ApplySpellRES("D5CSF1L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_2											// toughness
 SAY @12034
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF2","LOCALS",1)~ DO ~ApplySpellRES("D5CSF2L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_3 											// resistance
 SAY @12036
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF3","LOCALS",1)~ DO ~ApplySpellRES("D5CSF3L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_4 											// quickstride
 SAY @12038
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF4","LOCALS",1)~ DO ~ApplySpellRES("D5CSF4L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_5 											// fortitude
 SAY @12040
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF5","LOCALS",1)~ DO ~ApplySpellRES("D5CSF5L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_6 											// determination
 SAY @12042
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF6","LOCALS",1)~ DO ~ApplySpellRES("D5CSF6L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_7 											// strength training
 SAY @12044
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF7","LOCALS",1)~ DO ~ApplySpellRES("D5CSF7L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END
IF ~~ THEN BEGIN d5cs124_8 											// agility training
 SAY @12046
 IF ~~ THEN REPLY @12002 DO ~IncrementGlobal("D5CSF8","LOCALS",1)~ DO ~ApplySpellRES("D5CSF8L",Myself)~ EXIT 
 IF ~~ THEN REPLY @12003 GOTO d5cs124 
END

 

They were both built from the same template, just with different .tra references and the various variables etc. changed from 115 to 124. For some reason I can't see, the first one crashes the game. Both compile with no warnings or errors. But when I look at them in NI, I see something weird:

Spoiler

weird_dlg.thumb.jpg.506462d1ece2bc306f9f56034e8bbf79.jpg

The 8th state/response isn't showing in NI. This is weird because if I highlight that state, the proper response is shown in the window below, and looks identical to the way is displays the other states:

Spoiler

weird_dlg_2.thumb.jpg.ee88e97bf22aefeab5431f0197555511.jpg

So it has some kind of  error  that makes it  show up as blank; but when selected, all the information seems to be there and available to NI. Weird thing is, this definitely worked when I was testing a few hours ago,  and don't think changed the .D file between then and now.

If it  makes a difference, here  is the  .tra reference  for @12026:

Quote

@12026  = ~Fighting Dirty: when using this posture, up to once per round, successful melee attacks can cause debilitating secondary effects if the target fails a save vs. Breath Weapon. These secondary effects include tripping the target and briefly knocking them to the ground; and briefly blinding the target with handful of sand or dirt; and striking an sensitive nerve to briefly weaken the target.~

I'm totally confused right  now.

Edited by subtledoctor
Link to comment
2 hours ago, argent77 said:

t is possible that you inadvertently added a special UTF-8 symbol to the text

1 hour ago, jastey said:

From what I understand, @12025 would be the text in question

12025 is even simpler:

Quote

@12025  = ~Fighting Dirty~

I'm doing this in a good text editor that doesn't hide formatting or special characters, so I don't think there could be an invisible one there... this is confounding.

I don't know how to use the NI  debug console. I can call it up from the Tools menu but it is blank. Do I need to load the file into it, or something?

Link to comment
5 minutes ago, subtledoctor said:

I don't know how to use the NI  debug console. I can call it up from the Tools menu but it is blank. Do I need to load the file into it, or something?

The file is loaded correctly if there is nothing shown in the debug console. Does the string look fine when you open it in the StringRef Lookup or string table editor?

Link to comment
10 minutes ago, argent77 said:

Does the string look fine when you open it in the StringRef Lookup or string table editor?

Yeah it looks fine there.

I might worry about line endings - these are always a bit confusing to me, it seems some of my files (the ones with Weidu code?) use Unix endings and some (ones that Weidu creates or compiles after installing a mod?) use CRLF. But, if it was a  line  ending failure  wouldn't  the contents of this state be squished in with  the previous one? And for that matter wouldn't  the issue affect every state? The whole .D file is created <<<<<<<<inline >>>>>>>> within the mod's .tp2 code.

Edited by subtledoctor
Link to comment
7 hours ago, subtledoctor said:

The 8th state/response isn't showing in NI. This is weird because if I highlight that state, the proper response is shown in the window below, and looks identical to the way is displays the other states:

  Reveal hidden contents

weird_dlg_2.thumb.jpg.ee88e97bf22aefeab5431f0197555511.jpg

I also wonder why the table row for state 8 is completely empty? Even with bad or invalid strings, at least the field labels should be displayed. Does the issue persist if you replace the string in the string table with something else, or apply a different strref to the "Response" field in the dlg state?

Link to comment

Okay this is super weird. It might just be the string length? This shows up in NI:

Quote

@12026  = ~Fighting Dirty: when using this posture, up to once per round, melee attacks can cause debilitating secondary effects if the target fails a save vs. Breath Weapon. These secondary effects include tripping the target and briefly knocking then to the ground; and briefly blinding the target with a handful of~

Whereas, this leads to that weird blank row:

Quote

@12026  = ~Fighting Dirty: when using this posture, up to once per round, melee attacks can cause debilitating secondary effects if the target fails a save vs. Breath Weapon. These secondary effects include tripping the target and briefly knocking then to the ground; and briefly blinding the target with a handful of sand.~

The string that works is 307 characters long; the one that crashes the app is 312 characters long.

I'm not going to go any further down this rabbit hole; I need to get moving along now. I'll just rewrite the ability description to conform to this character limit. But, I didn't know there was a character limit? Is this normal?

Edited by subtledoctor
Link to comment

I put the relevant bits into a mini-mod over here. Download and install that, then:

  • Create a new trueclass fighter. You should have two innate abilities, one blue and one green.
  • Use the green ability: it will open a dialogue and let you choose from various feats.
  • Now use the blue ability: it crashes the game.

Or you can skip the game test and just look at the files. The green ability uses d5cs124.bcs and d5cs124.dlg. The broken blue ability uses d5cs115.bcs and d5cs115.dlg. Those all have an identical structure so I can't see why one is crashy and another is not. At first I thought it might be the script itself, because it doesn't even go to a "NO VALID REPLIES..." error. It gives me a Spinning Beach Ball of Death (what happens on Macs when an app locks up).

I thought it could be the script, going into an infinite cycle or something. But I deleted all but the last two script blocks (the one that starts the dialogue and the one with DestroySelf) and set all relevant variables to 1, and it still crashes. That's when I noticed the dialogue state acting weird and starts to focus on the dialogues. But maybe that was a red herring, and it really is the script? I have no idea. The green and blue scripts should also be largely identical, so here too I don't know why one would lock up while the other is fine...

Edited by subtledoctor
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...