Author Topic: CHAIN + PC response  (Read 1966 times)

Sev

  • Guest
CHAIN + PC response
« on: July 11, 2006, 04:18:41 PM »
I looked this up on other mods, and it works fine for them, but not for me. *sighs*

Code: [Select]
CHAIN NOBLE3 InsultFest
~Athkatla certainly has changed since I saw it last. I've never seen such an incredible number of *freaks* before. Honestly, I don't understand why the Council doesn't screen you all and send you to the asylum! We need to keep our streets safe from maniacs!~
== A_CYRA
~Are you spewing your verbal diarrhea in my direction, sir?~
== NOBLE3
~Such gall! Standing there on a public street like a *normal* person in the most holy part of the city! You shouldn't even be *allowed* here! Do you think you deserve the same rights as the rest of us?~
END
    ++ ~Hey! She hasn't done anything to you! Leave her alone!~ GOTO 2
    ++ ~*ignore him*~ DO ~SetGlobal("CyraIgnored","GLOBAL",1)~ EXIT
    ++ ~I agree completely! We should go alert the Council to this dangerous girl's whereabouts!~ GOTO 3

It seemed so empty after GOTO 3, so I tried adding END. That didn't work. So I tried EXIT. No dice. Odd. I'll probably figure this out before getting a response, though. That seems to be how things work with me ::)


Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #1 on: July 11, 2006, 10:59:16 PM »
You'll have to be a little more specific about what isn't working. And if you have a problem you can't seem to pin down it usually means the error is actually slightly above where the error message tells you it is.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Sev

  • Guest
Re: CHAIN + PC response
« Reply #2 on: July 12, 2006, 12:24:51 PM »
Okay, the rest of the .d file is as follows:

Code: [Select]
IF ~~ THEN BEGIN 2
SAY ~Why would *you* care about a lunatic like her? Fine, go ahead, stay. I can't stand to be in her presence any longer. I heard madness is contagious.~
IF ~~ THEN DO ~EscapeArea()
SetGlobal("RescueCyra","GLOBAL"1)~ EXIT
END

IF ~~ THEN BEGIN 3
SAY ~That sounds like an excellent idea! I'll go straight away!~
IF ~~ THEN DO ~EscapeArea()
SetGlobal("CyraInsulted","GLOBAL",1)~ EXIT
END

I get the error  PARSE ERROR at line 14 column 12-16
Near Text: BEGIN
        syntax error

Line 14, column 12-16 being the "BEGIN 2"

If I add an END after the PC's responses, I get a parse error for it.

If I add an EXIT in the same place, I get a parse error for that, as well.

Adding EXIT then END gets an error for the EXIT.

And adding END then EXIT gets an error for END.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #3 on: July 12, 2006, 12:40:20 PM »
As I said:

if you have a problem you can't seem to pin down it usually means the error is actually slightly above where the error message tells you it is.

If you're getting an error which isn't readily explained, it's probably immediately above the line in question. Look above line 14.

However--you appear to be defining new dialogue with integers as your state labels.

Never, never, never, never, never, never never never NEVER do that. Stop immediately, change your code. It's not the cause of your immediate problems, but you will deeply regret it eventually nonetheless.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: CHAIN + PC response
« Reply #4 on: July 12, 2006, 01:03:07 PM »
It seemed so empty after GOTO 3, so I tried adding END. That didn't work. So I tried EXIT. No dice.
There is neither END nor EXIT required after the PC responses. Did you try to leave it empty?

Sev

  • Guest
Re: CHAIN + PC response
« Reply #5 on: July 12, 2006, 01:48:39 PM »
Never, never, never, never, never, never never never NEVER do that. Stop immediately, change your code. It's not the cause of your immediate problems, but you will deeply regret it eventually nonetheless.

Yes sir! I thought it helped me keep things in order, but I'll go change that.

And yes, I did look ABOVE line 14, that's why I'm assuming that I need to put something after the PC's responses.

Quote from: jastey
There is neither END nor EXIT required after the PC responses. Did you try to leave it empty?

Yes, that's the first thing I tried:

Quote from: Sev
I get the error  PARSE ERROR at line 14 column 12-16
Near Text: BEGIN
        syntax error

I know there's nothing wrong with my IF ~~ THEN BEGIN 2 (which I'll be changing to something other than a number right now!), so it must do with something just above that. Either way, I get an error.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #6 on: July 12, 2006, 02:25:50 PM »
Oh, oh, oh, oh. Now I see what the problem is.

CHAIN implicitly terminates a BEGIN DLG statement. So WeiDU doesn't know where you want those "2" and "3" states to be placed.

Solution 1:

Put an APPEND DLG before those new states.

Solution 2:

Move those states above the CHAIN (to where you presumably have a BEGIN DLG statement, although it's not clear from what you posted.)
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Sev

  • Guest
Re: CHAIN + PC response
« Reply #7 on: July 12, 2006, 06:47:00 PM »
Excellent, it compiles now. Glad I asked, I would've never figured it out on my own. Thanks.

Question: Does SHOUTDL2 not work when the dialogue starts with a chain?

The way I have it set out is that both Cyra and this Nobleman spawn by each other in the Temple district. When approaching said Nobleman, I want him to start his line: "Athkatla certainly has changed, blah blah blah." Then Cyra will say her line, it will go back to the Nobleman, CHARNAME will say his/her part, and the Nobleman will leave, thus leaving CHARNAME free to talk to Cyra. However, Nobleman's lines don't fire, and I'm stuck with "Nobleman has nothing to say to you." Cyra gets the same, but that's fine, because I don't want to be able to talk to her until the exchange with the Nobleman.

I hope that wasn't too vague.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #8 on: July 12, 2006, 07:25:24 PM »
There's nothing about a dialogue that would make it "not work with a CHAIN."

Most likely, you haven't assigned a valid state trigger as part of this new dialogue. Show.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Sev

  • Guest
Re: CHAIN + PC response
« Reply #9 on: July 12, 2006, 08:13:47 PM »
I don't have anything besides what's been posted. His script is:

Code: [Select]
IF
 See(Player1)
 NumTimesTalkedTo(0)
THEN
 RESPONSE #100
 Dialogue(Player1)
END

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #10 on: July 12, 2006, 08:48:31 PM »
Well, that's your problem. A state cannot be used to initiate dialogue without a state trigger which is true at the time you make the Dialogue() call. So you'll want something like

CHAIN IF ~True()~ NOBLE3 InsultFest

(although "True()" is a poor choice since it will mean this dialogue could occur multiple times. Work it out so that this dialogue only takes place once. There are roughly a zillion examples of this behavior in the core game and in mods you can crib from.)
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Sev

  • Guest
Re: CHAIN + PC response
« Reply #11 on: July 12, 2006, 09:49:33 PM »
Odd, now it's telling me there's a syntax error near NOBLE3 (after IF ~True()~)

One problem after another, hurray.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #12 on: July 12, 2006, 10:09:22 PM »
Try

CHAIN IF ~True()~ THEN NOBLE3 blah

("THEN" isn't supposed to be required anywhere anymore, but CHAIN has always been finicky about its use.)

And I renew my plea for you to look at some actual code out there and make yours look like stuff that works.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Sev

  • Guest
Re: CHAIN + PC response
« Reply #13 on: July 12, 2006, 10:27:06 PM »
Okay, it works now. Not entirely sure WHY, but it does.

Quote from: jcompton
And I renew my plea for you to look at some actual code out there and make yours look like stuff that works.

I'll keep that in mind for future endeavors. Are there any specific mods in particular?

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7246
Re: CHAIN + PC response
« Reply #14 on: July 12, 2006, 10:36:29 PM »
Banter Pack.

Anyway. What part of "why" don't you understand?

You cannot initiate dialogue unless the game finds a valid state trigger.

You start "the search" with one of the Dialogue() commands (or Interact() for NPC banter files listed in INTERDIA.) When a dialogue command has been called on a CRE, the game searches through the state triggers, in weight order. The first one it finds that evaluates true gets played. If none are found to be true, you get "has nothing to say to you."
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Sev

  • Guest
Re: CHAIN + PC response
« Reply #15 on: July 12, 2006, 10:45:01 PM »
Yeah, got that bit. But why did "blah" work and "InsultFest" did not?

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: CHAIN + PC response
« Reply #16 on: July 12, 2006, 10:53:26 PM »
CHAIN IF ~True()~ NOBLE3 InsultFest
CHAIN IF ~True()~ THEN NOBLE3 blah
Earn Money Sleeping.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: