Jump to content


Photo

Coding questions


  • Please log in to reply
24 replies to this topic

#21 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 19 November 2008 - 03:34 PM

Here ya go, Icen:

INTERJECT_COPY_TRANS 1 HGNYA01
~StateCheck("Sarevok",CD_STATE_NOTVALID)~
APPEND Sarev25J
== STRAIGHTMAN ~Does this always happen around you?~ [GOTO ("TalkedToNyalee","GLOBAL",1)]
~StateCheck("Valygar",CD_STATE_NOTVALID)~
== FUNNYMAN ~Most often, yes. Did I ever tell you about that time with the trolls? We were traipsing through-~ [GOTO ("TalkedToNyalee","Global",1)]
~StateCheck("Jaheira",CD_STATE_NOTVALID)~
== STOPIT ~Shh!~ [GOTO ("TalkedToNyalee","Global",1)]
END

Some of it is probably not what it should be, but at least it's acknowledging it. Could the '=''s have something to do with it?
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#22 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 19 November 2008 - 04:12 PM

APPEND
<<something>>
END

is a separate action, at close to the top level of processing. You can't build an [ APPEND<>END ] block within an I_C_T (or much else) without creating a tesseract... it would be like trying to start your car by reaching inside of a book and turning the doorknob. In another galaxy.

INTERJECT_COPY_TRANS 1 HGNYA01
== SAREV25J IF ~StateCheck("Sarevok",CD_STATE_NOTVALID)~

as I copy to start to help, I see something really wrong here. You are saying

"If, in ToB, Sarevok is dead/incapacitated/stoned/asleep/silenced/etc., then reference his file... and don't say anything"

which would not be pretty.

If you intend this set of lines only to be played if Sarevok isn't able to, then you need something like

INTERJECT_COPY_TRANS 1 HGNYA01

== STRAIGHTMAN IF ~OR(2) !InParty("sarevok") StateCheck("Sarevok",CD_STATE_NOTVALID)~ THEN ~Does this always happen around you?~ [GOTO ("TalkedToNyalee","GLOBAL",1)]
~StateCheck("Valygar",CD_STATE_NOTVALID)~
== FUNNYMAN ~Most often, yes. Did I ever tell you about that time with the trolls? We were traipsing through-~ [GOTO ("TalkedToNyalee","Global",1)]
~StateCheck("Jaheira",CD_STATE_NOTVALID)~
== STOPIT ~Shh!~ [GOTO ("TalkedToNyalee","Global",1)]
END

STRAIGHTMAN is too long for the 8 character limit for dialog files. The DV can be much longer, but the dialog file name itself must be 8 characters or less. The engine sees this as STRAIGHT.dlg, and will fail if you have done BEGIN ~STRAIGHTMAN~...


[GOTO ("TalkedToNyalee","GLOBAL",1)] << what are these? I am assuming those are notes, not code -

if you are trying to go to the state that is ("TalkedToNyalee","Global",1) vs setting the GLOBAL (must be capitalized) TalkedToNyalee=1 you need to go back a ways and read some of the tutorials carefully, to make sure you aren't going to drive yourself crazy :)

So, a couple of things to look at.

First, I_C_T works as a patch on existing dialog files. You are finding one dialog file, in this case,

HGNYA01.dlg, state 1

and inserting a set of states.

The states are inserted by using ==, so that

== SAREV25J

means

"start a new state in SAREV25J.dlg, linked back to whatever state and dialog file this is being called from - in this case, HGNYA01.dlg, state 1".

Adding conditions to the state allows it to play correctly - if I want the thing to only play if Sarevok is in the party, I can add this:

== STRAIGHTMAN IF ~InParty("sarevok")~ THEN ~Wow, I am talking because Sarevok is here.~
== STRAIGHTMAN IF ~!InParty("sarevok")~ THEN ~Wow, I am talking because Sarevok is NOT here.~

Of course, this is still impossible, because the dialog file referenced can't exist, because it is too long, so

== ~STRMAN~ IF ~InParty("sarevok")~ THEN ~Wow, I am talking because Sarevok is here.~
== ~STRMAN~ IF ~!InParty("sarevok")~ THEN ~Wow, I am talking because Sarevok is NOT here.~

And as far as going to another state outside of the loop, it is not advisable to use I_C_T. You will need to research how to use INTERJECT and COPY_TRANS as a separated action. I am pretty sure, though, that you are not trying to go to another state - it looks like you ae trying to set a global to reference later on. If this is the case, then

== ~STRMAN~ IF ~InParty("sarevok")~ THEN ~Wow, I am talking because Sarevok is here.~ DO ~SetGlobal ("TalkedToNyalee","GLOBAL",1)~
== ~STRMAN~ IF ~!InParty("sarevok")~ THEN ~Wow, I am talking because Sarevok is NOT here.~ DO ~SetGlobal ("TalkedToNyalee","GLOBAL",2)~

or something like that.


Hold on again - what the heck are you sdoing with all those extra StateCheck NotValid conditions randomly scattered through the rest of the code?

Hey, HighTimeRodea, let's flip this around, or you are going to end up going postal trying to get this stuff going. What are you actually trying to insert, no code, just dialog? It looks like you want something like this:

IF Jaheira, Sarevok and/or Valygar are incapable of commenting,
THEN play the following lines,
[STRAIGHTMAN] Does this always happen around you?
[FUNNYMAN] Most often, yes. Did I ever tell you about that time with the trolls? We were traipsing through
[STOPIT] Shh!
DO
Set the global TalkedToNyalee = 1
ELSE
do nothing
END my changes to the files

Edited by cmorgan, 19 November 2008 - 04:14 PM.


#23 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 19 November 2008 - 04:51 PM

Take no offence, HTR, but it seems you've confused it all around. You aren't the first, you aren't the last, so there's nothing to worry about :)

I believe it'd be simplier for all involved if you state what you need to get done with that interjecion and someone will make a code with comments in it.

So far I can tell that you want to use !StateCheck(Object,CD_STATE_NOTVALID) instead of StateCheck(Object,CD_STATE_NOTVALID). The difference is the '!' which means negation. In other words that an object is not 'uncapable of constructive dialog', or to put it simply 'capable of constructive dialog'.

PS I'm certain there's no difference whether "Global" is capitalized or not. At least scripts recognize both just fine. Unless there's an evidence of the opposite, I'd not put much attention to this.

Edited by GeN1e, 19 November 2008 - 05:00 PM.

Retired from modding.


#24 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 19 November 2008 - 05:23 PM

I tried leaving the [] out of it, but it wouldn't read it, kept saying there was a parsing error in there.

I have a question in all of this.

Can WeiDU dictate, individually, what code it will and won't recongize? Because I've tried to do it the way I've seen in some of the tutorials and in the files of working mods and they haven't been recongized. Though I don't....

:woot: Hello! I have an idea! I'll save this page offline for later perusal, but let me try something guys and gals...
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#25 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 20 November 2008 - 12:07 AM

Well, it does, because it has to. It will read everything in ONE way only. It is a computer program, a brilliant one, but it is very stupid, like all computers.

Your problem is the APPEND. INTERJECT automagically appends stuff so you don't have to. Cmorgan had the old way, which was very long, really.

Kill the APPEND, and you should be fine.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo