Author Topic: Using I_C_T statenames as working variables in multiple states  (Read 1232 times)

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Hey - I am still resetting my machine, so am without the means of testing this... I have a vague recollection of several mods (including BG1NPC) using the same statename for multiple I_C_Ts, so that

Code: [Select]
/* SoA: Mithrest Inn */

I_C_T ~WWENCH~ 0 c-aranmithrest /* ~Welcome to the Mithrest, <SIRMAAM>. Please see Pugney if you wish to partake of the lavish splendors of the Inn.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) <<ROMANCE->>~ THEN ~[ARAN] TEXT~
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) <<ROMANCE+>>~ THEN ~[ARAN] TEXT~
END

I_C_T ~WWENCH~ 1  c-aranmithrest /* 1 ~Please enjoy your stay here, <LADYLORD>.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) <<ROMANCE->>~ THEN ~[ARAN] TEXT~
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) <<ROMANCE+>>~ THEN ~[ARAN] TEXT~
END

I_C_T ~WWENCH~ 2  c-aranmithrest /* ~I must not dally, <SIRMAAM>. I shall be fired if Pugney catches me shirking.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) <<ROMANCE->>~ THEN ~[ARAN] ~
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) <<ROMANCE+>>~ THEN ~[ARAN] ~
END

will allow the materials to only play once, setting  "c-aranmithrest","GLOBAL",1 via the I_C_T (successive loops through the three random responses in the original .dlg will not trigger Aran's lines).

Have I remembered correctly and this a valid WeiDU construct, or will it throw parse errors because it is recreating dupicate states (state1 = c-aranmithrest, state2 = c-aranmithrest, state3 = c-aranmithrest)?


Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Using I_C_T statenames as working variables in multiple states
« Reply #1 on: December 12, 2009, 11:04:06 AM »
Got a working test install and confirmed: the underlying idea works fine.

BUT - reminder if someone is looking this up in the future - you can't code an I_C_T like a CHAIN. The output of the above code produces

c-aranj.dlg
Code: [Select]
// creator  : DLTCEP_enhanced_WeiDU (version 21200)
// argument : C-ARANJ.DLG
// game : .
// source : ./override/C-ARANJ.DLG
// dialog : ./dialog.tlk
// dialogF  : (none)

BEGIN ~C-ARANJ~

IF ~~ THEN BEGIN 0 // from:
  SAY #74107 /* ~[ARAN] hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN GOTO 1
END

IF ~~ THEN BEGIN 1 // from: 0.1
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 2 // from:
  SAY #74107 /* ~[ARAN] hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN GOTO 3
END

IF ~~ THEN BEGIN 3 // from: 2.1
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 4 // from:
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 5 // from:
  SAY #74107 /* ~[ARAN] hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN GOTO 6
END

IF ~~ THEN BEGIN 6 // from: 5.1
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
END

definitely *not* what is being tried out - coding the above as a series of I_C_Ts with passback results in the expected behavior -

ict.d
Code: [Select]
BEGIN ~c-aranj~

/* SoA: Mithrest Inn */

I_C_T ~WWENCH~ 0 c-aranmithrest /* ~Welcome to the Mithrest, <SIRMAAM>. Please see Pugney if you wish to partake of the lavish splendors of the Inn.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) !Global("c-aranrom","GLOBAL",2)~ THEN ~[ARAN] hit on waitress ~
== ~WWENCH~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[WWENCH] cool your jets, big boy ~
END

I_C_T ~WWENCH~ 0 c-aranmithrest /* ~Welcome to the Mithrest, <SIRMAAM>. Please see Pugney if you wish to partake of the lavish splendors of the Inn.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[ARAN] not hit on waitress ~
== ~WWENCH~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[WWENCH] cool your jets, big boy ~
END

I_C_T ~WWENCH~ 1 c-aranmithrest /* ~Please enjoy your stay here, <LADYLORD>.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) !Global("c-aranrom","GLOBAL",2)~ THEN ~[ARAN] hit on waitress ~
== ~WWENCH~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[WWENCH] cool your jets, big boy ~
END

I_C_T ~WWENCH~ 1 c-aranmithrest /* ~Please enjoy your stay here, <LADYLORD>.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[ARAN] not hit on waitress ~
== ~WWENCH~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[WWENCH] cool your jets, big boy ~
END

I_C_T ~WWENCH~ 2 c-aranmithrest /* ~I must not dally, <SIRMAAM>. I shall be fired if Pugney catches me shirking.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) !Global("c-aranrom","GLOBAL",2)~ THEN ~[ARAN] hit on waitress ~
== ~WWENCH~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[WWENCH] cool your jets, big boy ~
END

I_C_T ~WWENCH~ 2 c-aranmithrest /* ~I must not dally, <SIRMAAM>. I shall be fired if Pugney catches me shirking.~ */
== ~c-aranj~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[ARAN] not hit on waitress ~
== ~WWENCH~ IF ~InParty("c-aran") InMyArea("c-aran") !StateCheck("c-aran",CD_STATE_NOTVALID) Global("c-aranrom","GLOBAL",2)~ THEN ~[WWENCH] cool your jets, big boy ~
END

results in the wanted structure
Code: [Select]
// creator  : DLTCEP_enhanced_WeiDU (version 21200)
// argument : WWENCH.DLG
// game : .
// source : ./override/WWENCH.DLG
// dialog : ./dialog.tlk
// dialogF  : (none)

BEGIN ~WWENCH~ 2 // non-zero flags may indicate non-pausing dialogue

IF ~RandomNum(3,1)
~ THEN BEGIN 0 // from:
  SAY #28787 /* ~Welcome to the Mithrest, <SIRMAAM>. Please see Pugney if you wish to partake of the lavish splendors of the Inn.~ */
  IF ~~ THEN EXIT
  IF ~Global("c-aranmithrest","GLOBAL",0)
InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
!Global("c-aranrom","GLOBAL",2)
~ THEN DO ~SetGlobal("c-aranmithrest","GLOBAL",1)~ EXTERN ~C-ARANJ~ 0
  IF ~Global("c-aranmithrest","GLOBAL",0)
InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN DO ~SetGlobal("c-aranmithrest","GLOBAL",1)~ EXTERN ~C-ARANJ~ 1
END

IF ~RandomNum(3,2)
~ THEN BEGIN 1 // from:
  SAY #28790 /* ~Please enjoy your stay here, <LADYLORD>.~ */
  IF ~~ THEN EXIT
  IF ~Global("c-aranmithrest","GLOBAL",0)
InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
!Global("c-aranrom","GLOBAL",2)
~ THEN DO ~SetGlobal("c-aranmithrest","GLOBAL",1)~ EXTERN ~C-ARANJ~ 2
  IF ~Global("c-aranmithrest","GLOBAL",0)
InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN DO ~SetGlobal("c-aranmithrest","GLOBAL",1)~ EXTERN ~C-ARANJ~ 3
END

IF ~RandomNum(3,3)
~ THEN BEGIN 2 // from:
  SAY #28792 /* ~I must not dally, <SIRMAAM>. I shall be fired if Pugney catches me shirking.~ */
  IF ~~ THEN EXIT
  IF ~Global("c-aranmithrest","GLOBAL",0)
InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
!Global("c-aranrom","GLOBAL",2)
~ THEN DO ~SetGlobal("c-aranmithrest","GLOBAL",1)~ EXTERN ~C-ARANJ~ 4
  IF ~Global("c-aranmithrest","GLOBAL",0)
InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN DO ~SetGlobal("c-aranmithrest","GLOBAL",1)~ EXTERN ~C-ARANJ~ 5
END

IF ~~ THEN BEGIN 3 // from:
  SAY #74109 /* ~[WWENCH] cool your jets, big boy ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 4 // from:
  SAY #74109 /* ~[WWENCH] cool your jets, big boy ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 5 // from:
  SAY #74109 /* ~[WWENCH] cool your jets, big boy ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 6 // from:
  SAY #74109 /* ~[WWENCH] cool your jets, big boy ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 7 // from:
  SAY #74109 /* ~[WWENCH] cool your jets, big boy ~ */
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN 8 // from:
  SAY #74109 /* ~[WWENCH] cool your jets, big boy ~ */
  IF ~~ THEN EXIT
END


c-aranj.dlg
Code: [Select]
// creator  : DLTCEP_enhanced_WeiDU (version 21200)
// argument : C-ARANJ.DLG
// game : .
// source : ./override/C-ARANJ.DLG
// dialog : ./dialog.tlk
// dialogF  : (none)

BEGIN ~C-ARANJ~

IF ~~ THEN BEGIN 0 // from:
  SAY #74107 /* ~[ARAN] hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN EXTERN ~WWENCH~ 3
END

IF ~~ THEN BEGIN 1 // from:
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN EXTERN ~WWENCH~ 4
END

IF ~~ THEN BEGIN 2 // from:
  SAY #74107 /* ~[ARAN] hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN EXTERN ~WWENCH~ 5
END

IF ~~ THEN BEGIN 3 // from:
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN EXTERN ~WWENCH~ 6
END

IF ~~ THEN BEGIN 4 // from:
  SAY #74107 /* ~[ARAN] hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN EXTERN ~WWENCH~ 7
END

IF ~~ THEN BEGIN 5 // from:
  SAY #74108 /* ~[ARAN] not hit on waitress ~ */
  IF ~~ THEN EXIT
  IF ~InParty("c-aran")
InMyArea("c-aran")
!StateCheck("c-aran",STATE_NORMAL)
Global("c-aranrom","GLOBAL",2)
~ THEN EXTERN ~WWENCH~ 8
END
« Last Edit: December 12, 2009, 11:05:52 AM by cmorgan »

 

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)?: