Jump to content

[solved] Why does this dialogue loop? Need new pair of eyes.


jastey

Recommended Posts

EDIT with solution: It was an ~ActionOverride("npcname",DestroyItem("itemname"))~ action before these states that cued all transactions inside the dialogue. Changing it to

~ActionOverride("FIREBE",TakePartyItem("itemname"))
ActionOverride("FIREBE",DestroyItem("itemname"))~

solved the problem.

--------------------------

This is the dialogue after installing and decompiling it. It loops from state 15 to 16 and back from 17 to 14 and so forth and I don't know why. I already started a completely new game, I checked whether this is actually the dialogue that's the one I see ingame etcpp.

If I change the code so the dialogue ends after state 16 and then check the variable Global("C#Br_HaveSaphire","GLOBAL") via cheats it is set to 1.

Does anyone see the obvious?

EDIT: In case that matters: this is firebe.dlg talking, I'm on BGT. I am using this "set variable and check it two states later" trick in all my dialogues to prevent repetition of reply options or loops like this one and I have no clue what is going on here.

 

IF ~~ THEN BEGIN 13 // from: 12.0
  SAY #97704 /* ~Always needed for the right consistency of magical ink.~ */
  IF ~~ THEN DO ~SetGlobal("C#Br_HaveSaphire","GLOBAL",1)
~ GOTO 16
END

IF ~~ THEN BEGIN 14 // from: 17.1
  SAY #97705 /* ~A potion of Regeneration!~ */
  IF ~~ THEN GOTO 15
END

IF ~~ THEN BEGIN 15 // from: 14.0
  SAY #102322 /* ~And we are still at this looping game, aren't we?~ */
  IF ~~ THEN EXIT
  IF ~  Global("C#Br_HaveSaphire","GLOBAL",0)
~ THEN DO ~SetGlobal("C#Br_HaveSaphire","GLOBAL",1)
~ GOTO 16
END

IF ~~ THEN BEGIN 16 // from: 13.0 15.1
  SAY #97707 /* ~A Star Saphire!~ */
  IF ~~ THEN GOTO 17
END

IF ~~ THEN BEGIN 17 // from: 16.0
  SAY #97708 /* ~Always a sight for sore eyes.~ */
  IF ~~ THEN EXIT
  IF ~  Global("C#Br_HavePotion","GLOBAL",0)
~ THEN DO ~SetGlobal("C#Br_HavePotion","GLOBAL",1)
~ GOTO 14
END

 

Link to comment

@argent77 thank you! The typo you mentioned, is it in the syntax or in the text? I am down to "install a new BGT" to be honest. The dialogue starts like this, item "c#broink" is taken out of the inventory alright (displayed in the text window), and then the dialogue loops and I have no idea why.

Spoiler

/* octopus ink */
IF WEIGHT #-1
~OR(2)
    Global("C#Br_BookRestore","GLOBAL",2)
    Global("C#Br_BookRestore","GLOBAL",4)
OR(2) PartyHasItem("c#br0001") HasItem("c#br0001","C#Brandock")
OR(2) PartyHasItem("c#broink") HasItem("c#broink","C#Brandock")
Global("C#Br_HaveInk","MYAREA",0)
InMyArea(Player1)
InMyArea("C#Brandock")
OR(2) InParty("C#Brandock") Global("C#BrandockJoined","GLOBAL",2)
!StateCheck("C#Brandock",CD_STATE_NOTVALID)~ THEN ingredient_01
SAY @751 /* ~Ah, the young <CHARNAME> and <PRO_HISHER> unfortunate friend. I see you have ingredients I requested.~ */
IF ~~ THEN DO ~ActionOverride("FIREBE",TakePartyItem("c#broink"))
ActionOverride("FIREBE",DestroyItem("c#broink"))
SetGlobal("C#Br_HaveInk","MYAREA",1)~ + ingredient_04
IF ~HasItem("c#broink","C#Brandock")~ THEN DO ~ActionOverride("C#Brandock",DestroyItem("c#broink"))
SetGlobal("C#Br_HaveInk","MYAREA",1)~ + ingredient_04
END

/* octopus ink */
IF ~~ THEN ingredient_04
SAY @754 /* ~Octopus ink!~ */
= @759 /* ~Always needed for the right consistency of magical ink.~ */
IF ~~ THEN DO ~SetGlobal("C#Br_HaveSaphire","GLOBAL",1)~ + ingredient_06
END

/* potion of regeneration */
IF ~~ THEN ingredient_05
SAY @762 /* ~A potion of Regeneration!~ */
= @983 /* ~A powerful magic, and useful in more than one way if you know how.~ */
IF ~~ THEN EXIT
IF ~Global("C#Br_HaveSaphire","GLOBAL",0)~ THEN DO ~SetGlobal("C#Br_HaveSaphire","GLOBAL",1)~ + ingredient_06
END

/* star spahire */
IF ~~ THEN ingredient_06
SAY @984 /* ~A Star Saphire!~ */
= @985 /* ~Always a sight for sore eyes.~ */
IF ~~ THEN EXIT
IF ~Global("C#Br_HavePotion","GLOBAL",0)~ THEN DO ~SetGlobal("C#Br_HavePotion","GLOBAL",1)~ + ingredient_05
END

I started with local variables and some other transactions, and reduced it to global variables and no other transactions and the loop just remains (changed the dialogue to make sure I'm actually seeing the right one).

 

 

Link to comment
21 minutes ago, jastey said:

The typo you mentioned, is it in the syntax or in the text?

It's a spelling error (Saphire -> Sapphire).

I was able to reproduce the looping issue with the full script. After a bit of testing I could determine the culprit. The action DestroyItem() appears to block further script execution. I remember that lynx (or Avenger?) mentioned some time ago that only script actions listed in INSTANT.IDS are safe to be used in dialogs. Most other script actions block further script execution.

Link to comment
4 minutes ago, argent77 said:

The action DestroyItem() appears to block further script execution. I remember that lynx (or Avenger?) mentioned some time ago that only script actions listed in INSTANT.IDS are safe to be used in dialogs. Most other script actions block further script execution.

Oooh. Awesome. Thank you very much! I'd never have figured this out by myself. 👍

Link to comment

Yep, that worked.

For "7th" group member (in familiar status) of my NPC, this action lead to all following transactions in the dialogue (also for later states!) being cued until after the end of the dialogue (even though it was the questcharacter's dialogue!):
~ActionOverride("npcname",DestroyItem("itemname"))~

Whereas, letting this be done by a questcharacter did not lead to the same effect, transactions after that were executed as expected:

~ActionOverride("FIREBE",TakePartyItem("itemname"))
ActionOverride("FIREBE",DestroyItem("itemname"))~

 

Thanks again @argent77 for your help with this!

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...