Jump to content


Photo

Q: multi IF dependent says


  • Please log in to reply
20 replies to this topic

#1 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 13 August 2002 - 03:07 PM

Hi there,
I'm pretty new at using WeiDu (by the way, thanks for such a great program, its so much fun :).
Anyway, my question, is it possible to have something like this:

IF ~~ THEN BEGIN 0
IF ~AreaCheck("AR0001")~ THEN SAY ~Your in area 0001~ DO ~~ EXIT
IF ~AreaCheck("AR0002")~ THEN SAY ~Your in area 0002~ DO ~~ EXIT
END

I can sort of see it being done with multiple blocks, but is it possible similar to how I have written it? I've browsed the forum, readme, examples, test files and a tutorial or 2, and not seen it done, but I might have missed it.
Thanks for your patience,
/bt_igi

#2 -jcompton-

-jcompton-
  • Guest

Posted 13 August 2002 - 03:30 PM

Hi there,
I'm pretty new at using WeiDu (by the way, thanks for such a great program, its so much fun :).
Anyway, my question, is it possible to have something like this:

IF ~~ THEN BEGIN 0
IF ~AreaCheck("AR0001")~ THEN SAY ~Your in area 0001~ DO ~~ EXIT
IF ~AreaCheck("AR0002")~ THEN SAY ~Your in area 0002~ DO ~~ EXIT
END

I can sort of see it being done with multiple blocks, but is it possible similar to how I have written it? I've browsed the forum, readme, examples, test files and a tutorial or 2, and not seen it done, but I might have missed it.
Thanks for your patience,
/bt_igi

In very basic terms, you would want those conditions to be in the state trigger slot.

IF ~AreaCheck("AR0001")~ THEN
BEGIN area0001
SAY ~You are in Area 0001.~
IF ~~ THEN EXIT
END

IF ~AreaCheck("AR0002")~ THEN
BEGIN area0002
SAY ~You are in Area 0002.~
IF ~~ THEN EXIT
END

Or, you could do this.

IF ~~ THEN BEGIN start
SAY ~I am going to say something different depending on what area you are in.~
IF ~AreaCheck("AR0001")~ THEN GOTO area0001
IF ~AreaCheck("AR0002")~ THEN GOTO area0002
END

IF ~~ THEN BEGIN area0001
SAY ~You are in Area 0001.~
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN area0002
SAY ~You are in Area 0002.~
IF ~~ THEN EXIT
END


(Note that you don't have to have a "DO" if you're not actually DOing an action. Note also in the second example we don't have anything special in the state triggers of the places we branch to.)

#3 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 13 August 2002 - 03:51 PM

So I have to have a block for each area check / reply?
Ah well, thats not so bad I guess, I just wondered if it could be done neater.
I'll use something akin to your second example I think, so thanks for posting it :)
And thanks for the promt reply.
/bt_igi

Visit the IESDP


#4 -jcompton-

-jcompton-
  • Guest

Posted 13 August 2002 - 04:11 PM

There is a scenario where you can have something a little closer to what you had in mind, and that's a conditional CHAIN, but it is better to learn to crawl a bit first. :)

#5 weimer

weimer
  • Member
  • 1569 posts

Posted 13 August 2002 - 10:16 PM

So I have to have a block for each area check / reply?
Ah well, thats not so bad I guess, I just wondered if it could be done neater.
I'll use something akin to your second example I think, so thanks for posting it :)
And thanks for the promt reply.
/bt_igi

The Infinity Engine DLG format requires that you have one separate state for each statement said by an NPC to the player.

Convenient syntax can hide that from you (see CHAIN, as suggested, or "multi-say" for something different but on a similar theme) but under the hood there's still one state per SAY.

After a bit of working with tools like these you'll notice that all of the mods have the same sort of dialogue structure (from a bird's eye view) ... that's because it's all the DLG format really supports. Different things could be hacked in through special scripting conditions, but it would take vast individual effort.

Good luck with WeiDU. I think you're the first person to call it "fun". :-)

#6 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 14 August 2002 - 09:27 AM

Thanks for the replies!
I havent moved on to CHAIN and MULTI-SAY, yet, I'll just stick with what I (sort of) know for now, until I have it nailed. Things are going well enough, although dialog I am writing is getting pretty big.

Since I'm here, I might as well ask my next question... which I've just solved :-) Thanks for the help you would have given anyway :)
/bt_igi

Visit the IESDP


#7 -jcompton-

-jcompton-
  • Guest

Posted 14 August 2002 - 09:53 AM

There's an (ahem) excellent tutorial on multisay and CHAIN2 in the WeiDU README already, although CHAIN2 doesn't do conditional branching. Still, if you have a long dialogue with many states that are linear (non-branching) I IMPLORE you to use it. The time savings is enormous, and I've already spoken with a couple of .d coders who DIDN'T know about them and were very very upset at themselves afterwords. :)

#8 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 14 August 2002 - 10:30 AM

I've spotted the tutorials in the readme, MULTISAY seems easy enough to use, CHAIN2 is a little beyond me, at the moment (not in understanding, but in use. My current dialog only speaks to the PC, with no interuptsions by others, in a pretty basic yes/no mannor :-)

EDIT: Sorry for all the questions, but this will be the last one for a while (I promise). I notice theres a command for adding references to the .tlk manually, how can you be sure this doesnt overwrite anything? If you can be sure? I'm trying to use DisplayStringHead(Myself,xxxx) to display a string over my head,but I dont know where it will be added in the .tlk, unless I specify it with --strapp. Is it possible without overwriting some random thing? Thanks

Anyway, got to dash, or I'll never finish :)
/bt_igi -waving to the friendly people :-)

Visit the IESDP


#9 weimer

weimer
  • Member
  • 1569 posts

Posted 14 August 2002 - 02:51 PM

EDIT: Sorry for all the questions, but this will be the last one for a while (I promise). I notice theres a command for adding references to the .tlk manually, how can you be sure this doesnt overwrite anything? If you can be sure? I'm trying to use DisplayStringHead(Myself,xxxx) to display a string over my head,but I dont know where it will be added in the .tlk, unless I specify it with --strapp. Is it possible without overwriting some random thing? Thanks

If you're thinking of STRING_SET, the answer is "YOU CAN'T". That's why the manual tells you not to use it. :-)

For what you are suggesting, put

DisplayStringHead(Myself,999999)

in your BAF and compile it to a BCS. In your TP2 file, put

COPY ~mymod/myscript.bcs~ ~override/myscript.bcs~
REPLACE ~999999~ ~Hello, this is a new string that will be over my head.~

When installed on the user's machine, 999999 will be replaced by the strref of a newly-minted string.

#10 -jcompton-

-jcompton-
  • Guest

Posted 14 August 2002 - 03:28 PM

Tashia is a good learning ground for the use of TP2 REPLACE and DisplayStringHead. Take a look at her code.

#11 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 15 August 2002 - 10:13 AM

"When installed on the user's machine, 999999 will be replaced by the strref of a newly-minted string."

What if someone else has used 999999 to do the same sort of thing? Or does WeiDu interpret 999999 as a "place at the next free space" sort of thing?

I've mostly been using guess work (fun fun fun :) and valen (sounds about the simplest npc out there) as reference work. I also occasionly look at solaufein. I've avoided Kesley (it seems to be the reason half these nifty command were added, so it would seem to be a bit over my head for now). I'm downloading Tashia now, its always nice to have something new to dissect.
/bt_igi

Visit the IESDP


#12 weimer

weimer
  • Member
  • 1569 posts

Posted 15 August 2002 - 05:54 PM

The scope of 999999 is (loosely) "local to that script in your mod". So use 999998 for your next string (or whatever) but you can't possibly conflict with any other mod out there. Basically, WeiDU makes up a new string, appends it to your dialog.tlk, and then replaces 999999 in that one file with the number for the newly-created string.

If you're still confused about this, ask again and someone will explain it in more detail.

#13 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 16 August 2002 - 09:22 AM

No, I understand what your saying. All references are local to each mod, and weidu just appends them to the end of dialogl.tlk, and then fixes it so references in your mod point to the right place. Clever :)

I've run out of questions now, so thanks for the help!
/bt_igi

Visit the IESDP


#14 -jcompton-

-jcompton-
  • Guest

Posted 16 August 2002 - 09:26 AM

Again, take a peek at Tashia. You just assign a nonsense value (99999 has become popular, though) and tell the TP2 script to replace it. Obviously, you need each value to be unique, so 99990, 99991, 99992, etc. so that each one only gets replaced once.

#15 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 28 August 2002 - 09:11 AM

Hiya,
Come back to this thread to extend my question.
My latest project is getting a sword to display a string when its equipped (ie. equip sword, text displays). The sword is made, the text is written, but linking the two...
The sword is set to display reference 999999. In the tp2 file, I've used
REPLACE ~999999~ ~My Text~
but it doesnt seem to work. When the sword is equipped the character name appears, but where the text should be is empty.
Looking at mymod.tp2, it says REPLACE can be used ot patch ASCII numbers in any file. I dont think the reference in the .itm file shows as ASCII, so is this option ruled out?
However, also looking at mymod.tp2, I think it could be possible using SAY XXX (line 69ish), but I dont know the XXX offset. Maybe if I changed the item to display reference 111111 and compared the files, found the offset of the difference and used that as the patch offset?
Hope someone can understand my question
/bt_igi

Visit the IESDP


#16 -jcompton-

-jcompton-
  • Guest

Posted 28 August 2002 - 09:39 AM

Show a larger portion of your TP2 code.

What you want to do is something like

COPY ~scriptsource~ ~override\scriptdest~
REPLACE ~999999~ ~Your text~

#17 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 28 August 2002 - 10:06 AM

The part of the tp2 that pertains to the item:

COPY    ~item/iissw03.itm~      ~override/iissw03.itm~
REPLACE ~999999~ ~As you take hold of the sword in your hand, you hear a disembodied voice laughing, and a sense of imminent danger takes hold of you~

  SAY NAME1 ~Short Sword~
  SAY UNIDENTIFIED_DESC #6747

  SAY NAME2 ~Magic Short Sword ~
  SAY DESC ~A magic short sword~

/bt_igi

Visit the IESDP


#18 -jcompton-

-jcompton-
  • Guest

Posted 28 August 2002 - 11:49 AM

Someone who knows more about item editing is going to have to address whether what you're doing is sensible. I don't know if there is or isn't a field inside an .itm that displays a string when you pick it up.

#19 igi

igi

    IESDP Guardian

  • Administrator
  • 1058 posts

Posted 28 August 2002 - 01:25 PM

Well, there is an effect you can have on items that displays a string, and you can set it to happen when the item is equipped.
The .itm file stores the number of the string to display (the strref, i think it is called).
So, I guess it should be possible to patch the .itm file with the new offset, if I knew what offset weidu was giving my new string (or, a better way, figure out weidu enough to get it to do it for me).
(ummm... that still means I am looking for help if someone has any bright ideas :)
/bt_igi

Visit the IESDP


#20 weimer

weimer
  • Member
  • 1569 posts

Posted 28 August 2002 - 02:57 PM

Hiya,
Come back to this thread to extend my question.
My latest project is getting a sword to display a string when its equipped (ie. equip sword, text displays). The sword is made, the text is written, but linking the two...
The sword is set to display reference 999999. In the tp2 file, I've used
REPLACE ~999999~ ~My Text~
but it doesnt seem to work. When the sword is equipped the character name appears, but where the text should be is empty.
Looking at mymod.tp2, it says REPLACE can be used ot patch ASCII numbers in any file. I dont think the reference in the .itm file shows as ASCII, so is this option ruled out?
However, also looking at mymod.tp2, I think it could be possible using SAY XXX (line 69ish), but I dont know the XXX offset. Maybe if I changed the item to display reference 111111 and compared the files, found the offset of the difference and used that as the patch offset?
Hope someone can understand my question
/bt_igi

If you're patching the sword ITM file, you really want to use SAY (yeah, these are arbitrary).

Use Near Infinity to find the Offset.