Author Topic: EXTEND_BOTTOM Use in Interjections  (Read 2441 times)

0 Members and 1 Guest are viewing this topic.

Offline Sir_Carnifex

  • Scourge of Kobolds
  • Modders
  • Level 1
  • *****
  • Posts: 200
  • Karma: +8/-0
  • Scourge of Kobolds
    • View Profile
EXTEND_BOTTOM Use in Interjections
« on: August 14, 2012, 12:04:03 PM »
I posted this elsewhere, but I figured if it's in two forums I get a chance have having a reply sooner.  Maybe one of you can help me out.  ;D


I just got to the interjections I coded in my four-year old script.   I can't remember exactly how I came about the code since it was so long ago, but I'm guessing it was probably taken from some tutorial or I sneaked a peek at some other mod.  Most likely the former since I started out almost entirely just using tutorials alone.  Anyway, I had....

Code: [Select]

APPEND ARNGRL01
IF ~!NumTimesTalkedTo(0)
    !InPartySlot(LastTalkedToBy,0)
    Name("CXHalbo",LastTalkedToBy)
    Global("HalboMissy","LOCALS",0)~
THEN BEGIN HalboCommentMissy
SAY ~Drop that, stumpy! Get your paws off my coats! I'll not have another one go missing to a grubby little filcher!~
IF ~~ THEN DO ~SetGlobal("HalboMissy","LOCALS",1)~ EXTERN CXHALBOJ HalboCommentMissy2
END
END

-----------------------------These two sections are actually separated into different sections of the J file.-------------------------

IF ~~ THEN BEGIN HalboCommentMissy2
SAY ~insert witty (or not) retort.~
IF ~~ THEN EXIT
END

Now, I started comparing this to another mod to see what differences there were and also, hopefully, to get a better grasp of how to go about this.  I noticed that it was similar except.... mine is missing EXTEND_BOTTOM.  Also, there's a little difference with the THEN, and an extra END at the bottom.   I went ahead and just filled in the second code with the content of the first to make it more similar.   I left out the locals though...

Code: [Select]
EXTEND_BOTTOM ARNGRL01
  IF ~!InPartySlot(LastTalkedToBy,0) Name("CXHalbo",LastTalkedToBy)~ EXTERN ARNGRL01 HalboCommentMissy
END

APPEND ARNGRL01
IF ~~ HalboCommentMissy
  SAY ~Drop that, stumpy! Get your paws off my coats! I'll not have another one go missing to a grubby little filcher!~
  IF ~~ EXTERN CXHALBOJ HalboCommentMissy2
END
END

APPEND CXHALBOJ
IF ~~ HalboCommentMissy2
  SAY ~Insert witty (or not) retort.~
  IF ~~ EXIT
END
END

So is there something critical that I'm missing in the original?  Is EXTEND_BOTTOM a necessary thing, or is this matter of preference?  And about the END... would having the extra in the second be there possibly because of the order in which dialogues are done?  Originally I followed a tutorial that puts the externs all at the top and the appends at the bottom.  I'm not sure if that makes a difference in the number of ENDs that have to be added.

Also, I think I do actually prefer putting the APPENDs and EXTERNs together than doing them separately as I originally did.  It's much, much easier to edit the text.

Thanks for any help.
In progress - Armin Kasun - a mercenary NPC for BG2

On hold - Halbo NPC for BG2, the evil halfling thief, food critic, and party troublemaker

Offline Solaufein

  • Lord of the Realms
  • Administrator
  • Level 5
  • *****
  • Posts: 5149
  • Karma: +127/-19
  • Gender: Male
  • The night is dark and full of terrors...
    • ICQ Messenger - 251194643
    • Yahoo Instant Messenger - gscott7833
    • View Profile
    • http://teambg.net
Re: EXTEND_BOTTOM Use in Interjections
« Reply #1 on: August 14, 2012, 08:27:48 PM »
Its been a while but the reason a lot of people use EXTEND_BOTTOM is because the game reads from the bottom up. You need the END because of the APPEND.

APPEND ARNGRL01
IF ~!NumTimesTalkedTo(0)
    !InPartySlot(LastTalkedToBy,0)
    Name("CXHalbo",LastTalkedToBy)
    Global("HalboMissy","LOCALS",0)~
THEN BEGIN HalboCommentMissy
SAY ~Drop that, stumpy! Get your paws off my coats! I'll not have another one go missing to a grubby little filcher!~
IF ~~ THEN DO ~SetGlobal("HalboMissy","LOCALS",1)~ EXTERN CXHALBOJ HalboCommentMissy2
END
END

You have two different statements and each one needs an end. The last END belongs to the APPEND, the other belongs to IF.
My mods:
Dark Horizons
The Undying
Nikita
IWD2 store

Co-contributor:
Dark Side of the Sword Coast BG1 Weidu
Aurils Bane
Encounters
Saerileth
Baldur's Gate - Enhanced Edition beta tester
Baldur's Gate 2 - Enhanced Edition beta tester
Icewind Dale - Enhanced Edition beta tester

Offline Sir_Carnifex

  • Scourge of Kobolds
  • Modders
  • Level 1
  • *****
  • Posts: 200
  • Karma: +8/-0
  • Scourge of Kobolds
    • View Profile
Re: EXTEND_BOTTOM Use in Interjections
« Reply #2 on: August 15, 2012, 12:42:08 PM »
Okay, now the ENDs make sense.  I can actually relate that to nwscript coding, too.

So because the game reads from the bottom up, does that mean using EXTEND_BOTTOM just makes sure that the new content gets read faster?  Or is order important here?
In progress - Armin Kasun - a mercenary NPC for BG2

On hold - Halbo NPC for BG2, the evil halfling thief, food critic, and party troublemaker

Offline Raven

  • Miriam's sane half
  • Administrator
  • Level 5
  • *****
  • Posts: 3603
  • Karma: +118/-33
  • Gender: Female
  • Like Awesome!
    • View Profile
    • Vampire Tales
Re: EXTEND_BOTTOM Use in Interjections
« Reply #3 on: October 14, 2012, 10:46:04 PM »
There may be some important game scripting that must occur and a mod may not make it happen which is safer to put it in the bottom so the in games script is read last.
Per me si va nella citta dolente.
Per me si va nell eterno dolore.
Per me si va tra la perduta gente...
Lasciate ogni speranza perduta che'entrate!